DatetimeIndex

DatetimeIndex 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.

Time/Date Components

DatetimeIndex.year The year of the datetime
DatetimeIndex.month The month as January=1, December=12
DatetimeIndex.day The days of the datetime
DatetimeIndex.hour The hours of the datetime
DatetimeIndex.minute The minutes of the datetime
DatetimeIndex.second The seconds of the datetime
DatetimeIndex.microsecond The microseconds of the datetime
DatetimeIndex.nanosecond The nanoseconds of the datetime
DatetimeIndex.date Returns numpy array of datetime.date.
DatetimeIndex.time Returns numpy array of datetime.time.
DatetimeIndex.dayofyear The ordinal day of the year
DatetimeIndex.weekofyear The week ordinal of the year
DatetimeIndex.week The week ordinal of the year
DatetimeIndex.dayofweek The day of the week with Monday=0, Sunday=6
DatetimeIndex.weekday The day of the week with Monday=0, Sunday=6
DatetimeIndex.weekday_name The name of day in a week (ex: Friday)
DatetimeIndex.quarter The quarter of the date
DatetimeIndex.tz
DatetimeIndex.freq get/set the frequncy of the Index
DatetimeIndex.freqstr Return the frequency object as a string if its set, otherwise None
DatetimeIndex.is_month_start Logical indicating if first day of month (defined by frequency)
DatetimeIndex.is_month_end Logical indicating if last day of month (defined by frequency)
DatetimeIndex.is_quarter_start Logical indicating if first day of quarter (defined by frequency)
DatetimeIndex.is_quarter_end Logical indicating if last day of quarter (defined by frequency)
DatetimeIndex.is_year_start Logical indicating if first day of year (defined by frequency)
DatetimeIndex.is_year_end Logical indicating if last day of year (defined by frequency)
DatetimeIndex.is_leap_year Logical indicating if the date belongs to a leap year
DatetimeIndex.inferred_freq

Selecting

DatetimeIndex.indexer_at_time(time[, asof]) Select values at particular time of day (e.g.
DatetimeIndex.indexer_between_time(...[, ...]) Select values between particular times of day (e.g., 9:00-9:30AM).

Time-specific operations

DatetimeIndex.normalize() Return DatetimeIndex with times to midnight.
DatetimeIndex.strftime(date_format) Return an array of formatted strings specified by date_format, which supports the same string format as the python standard library.
DatetimeIndex.snap([freq]) Snap time stamps to nearest occurring frequency
DatetimeIndex.tz_convert(tz) Convert tz-aware DatetimeIndex from one time zone to another (using
DatetimeIndex.tz_localize(*args, **kwargs) Localize tz-naive DatetimeIndex to given time zone (using
DatetimeIndex.round(freq, *args, **kwargs) round the index to the specified freq
DatetimeIndex.floor(freq) floor the index to the specified freq
DatetimeIndex.ceil(freq) floor the index to the specified freq

Conversion

DatetimeIndex.to_datetime([dayfirst])
DatetimeIndex.to_period([freq]) Cast to PeriodIndex at a particular frequency
DatetimeIndex.to_perioddelta(freq) Calcuates TimedeltaIndex of difference between index values and index converted to PeriodIndex at specified freq.
DatetimeIndex.to_pydatetime() Return DatetimeIndex as object ndarray of datetime.datetime objects
DatetimeIndex.to_series([keep_tz]) Create a Series with both index and values equal to the index keys