class pandas.DatetimeIndex
[source]
Immutable ndarray of datetime64 data, represented internally as int64, and which can be boxed to Timestamp objects that are subclasses of datetime and carry metadata such as frequency information.
Parameters: |
|
---|
See also
Index
TimedeltaIndex
PeriodIndex
to_datetime
date_range
To learn more about the frequency strings, please see this link.
Creating a DatetimeIndex based on start
, periods
, and end
has been deprecated in favor of date_range()
.
year | The year of the datetime. |
month | The month as January=1, December=12. |
day | The days of the datetime. |
hour | The hours of the datetime. |
minute | The minutes of the datetime. |
second | The seconds of the datetime. |
microsecond | The microseconds of the datetime. |
nanosecond | The nanoseconds of the datetime. |
date | Returns numpy array of python datetime.date objects (namely, the date part of Timestamps without timezone information). |
time | Returns numpy array of datetime.time. |
timetz | Returns numpy array of datetime.time also containing timezone information. |
dayofyear | The ordinal day of the year. |
weekofyear | The week ordinal of the year. |
week | The week ordinal of the year. |
dayofweek | The day of the week with Monday=0, Sunday=6. |
weekday | The day of the week with Monday=0, Sunday=6. |
quarter | The quarter of the date. |
freq | Return the frequency object if it is set, otherwise None. |
freqstr | Return the frequency object as a string if it is set, otherwise None. |
is_month_start | Indicates whether the date is the first day of the month. |
is_month_end | Indicates whether the date is the last day of the month. |
is_quarter_start | Indicator for whether the date is the first day of a quarter. |
is_quarter_end | Indicator for whether the date is the last day of a quarter. |
is_year_start | Indicate whether the date is the first day of a year. |
is_year_end | Indicate whether the date is the last day of the year. |
is_leap_year | Boolean indicator if the date belongs to a leap year. |
inferred_freq | Tryies to return a string representing a frequency guess, generated by infer_freq. |
tz |
normalize (self, \*args, \*\*kwargs) | Convert times to midnight. |
strftime (self, \*args, \*\*kwargs) | Convert to Index using specified date_format. |
snap (self[, freq]) | Snap time stamps to nearest occurring frequency |
tz_convert (self, \*args, \*\*kwargs) | Convert tz-aware Datetime Array/Index from one time zone to another. |
tz_localize (self, \*args, \*\*kwargs) | Localize tz-naive Datetime Array/Index to tz-aware Datetime Array/Index. |
round (self, \*args, \*\*kwargs) | Perform round operation on the data to the specified freq . |
floor (self, \*args, \*\*kwargs) | Perform floor operation on the data to the specified freq . |
ceil (self, \*args, \*\*kwargs) | Perform ceil operation on the data to the specified freq . |
to_period (self, \*args, \*\*kwargs) | Cast to PeriodArray/Index at a particular frequency. |
to_perioddelta (self, \*args, \*\*kwargs) | Calculate TimedeltaArray of difference between index values and index converted to PeriodArray at specified freq. |
to_pydatetime (self, \*args, \*\*kwargs) | Return Datetime Array/Index as object ndarray of datetime.datetime objects |
to_series (self[, keep_tz, index, name]) | Create a Series with both index and values equal to the index keys useful with map for returning an indexer based on an index |
to_frame (self[, index, name]) | Create a DataFrame with a column containing the Index. |
month_name (self, \*args, \*\*kwargs) | Return the month names of the DateTimeIndex with specified locale. |
day_name (self, \*args, \*\*kwargs) | Return the day names of the DateTimeIndex with specified locale. |
mean (self, \*args, \*\*kwargs) | Return the mean value of the Array. |
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.DatetimeIndex.html