pandas.DatetimeIndex¶
-
class
pandas.
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.
Parameters: data : array-like (1-dimensional), optional
Optional datetime-like data to construct index with
copy : bool
Make a copy of input ndarray
freq : string or pandas offset object, optional
One of pandas date offset strings or corresponding objects
start : starting value, datetime-like, optional
If data is None, start is used as the start point in generating regular timestamp data.
periods : int, optional, > 0
Number of periods to generate, if generating index. Takes precedence over end argument
end : end time, datetime-like, optional
If periods is none, generated index will extend to first conforming time on or just past end argument
closed : string or None, default None
Make the interval closed with respect to the given frequency to the ‘left’, ‘right’, or both sides (None)
tz : pytz.timezone or dateutil.tz.tzfile
ambiguous : ‘infer’, bool-ndarray, ‘NaT’, default ‘raise’
- ‘infer’ will attempt to infer fall dst-transition hours based on order
- bool-ndarray where True signifies a DST time, False signifies a non-DST time (note that this flag is only applicable for ambiguous times)
- ‘NaT’ will return NaT where there are ambiguous times
- ‘raise’ will raise an AmbiguousTimeError if there are ambiguous times
infer_dst : boolean, default False (DEPRECATED)
Attempt to infer fall dst-transition hours based on order
name : object
Name to be stored in the index
Attributes
T
return the transpose, which is by definition self asi8
asobject
base
return the base object if the memory of the underlying data is shared data
return the data pointer of the underlying data date
Returns numpy array of datetime.date. day
The days of the datetime dayofweek
The day of the week with Monday=0, Sunday=6 dayofyear
The ordinal day of the year days_in_month
The number of days in the month daysinmonth
The number of days in the month dtype
dtype_str
flags
freq
get/set the frequncy of the Index freqstr
return the frequency object as a string if its set, otherwise None has_duplicates
hasnans
hour
The hours of the datetime inferred_freq
inferred_type
is_all_dates
is_monotonic
alias for is_monotonic_increasing (deprecated) is_monotonic_decreasing
return if the index is monotonic decreasing (only equal or is_monotonic_increasing
return if the index is monotonic increasing (only equal or is_month_end
Logical indicating if last day of month (defined by frequency) is_month_start
Logical indicating if first day of month (defined by frequency) is_normalized
is_quarter_end
Logical indicating if last day of quarter (defined by frequency) is_quarter_start
Logical indicating if first day of quarter (defined by frequency) is_unique
is_year_end
Logical indicating if last day of year (defined by frequency) is_year_start
Logical indicating if first day of year (defined by frequency) itemsize
return the size of the dtype of the item of the underlying data microsecond
The microseconds of the datetime millisecond
The milliseconds of the datetime minute
The minutes of the datetime month
The month as January=1, December=12 name
names
nanosecond
The nanoseconds of the datetime nbytes
return the number of bytes in the underlying data ndim
return the number of dimensions of the underlying data, by definition 1 nlevels
offset
quarter
The quarter of the date resolution
second
The seconds of the datetime shape
return a tuple of the shape of the underlying data size
return the number of elements in the underlying data strides
return the strides of the underlying data time
Returns numpy array of datetime.time. tz
tzinfo
Alias for tz attribute values
return the underlying data as an ndarray week
The week ordinal of the year weekday
The day of the week with Monday=0, Sunday=6 weekofyear
The week ordinal of the year year
The year of the datetime Methods