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)

name : object

Name to be stored in the index

Attributes

T Same as self.transpose(), except that self is returned if self.ndim < 2.
asi8
asobject Convert to Index of datetime objects
base Base object if memory is from some other object.
ctypes An object to simplify the interaction of the array with the ctypes module.
data Python buffer object pointing to the start of the array’s data.
date Returns numpy array of datetime.date.
day
dayofweek
dayofyear
dtype
flags
flat A 1-D iterator over the array.
freq
freqstr
hour
imag The imaginary part of the array.
inferred_type
is_all_dates
is_monotonic
itemsize Length of one array element in bytes.
microsecond
minute
month
names
nanosecond
nbytes Total bytes consumed by the elements of the array.
ndim Number of array dimensions.
nlevels
quarter
real The real part of the array.
second
shape Tuple of array dimensions.
size Number of elements in the array.
strides Tuple of bytes to step in each dimension when traversing an array.
time Returns numpy array of datetime.time.
tzinfo Alias for tz attribute
values
week
weekday
weekofyear
year
name  
offset  

Methods

all([axis, out]) Returns True if all elements evaluate to True.
any([axis, out]) Returns True if any of the elements of a evaluate to True.
append(other) Append a collection of Index options together
argmax([axis, out]) Return indices of the maximum values along the given axis.
argmin()
argsort(*args, **kwargs) See docstring for ndarray.argsort
asof(label) For a sorted index, return the most recent label up to and including the passed label.
asof_locs(where, mask) where : array of timestamps
astype(dtype)
byteswap(inplace) Swap the bytes of the array elements
choose(choices[, out, mode]) Use an index array to construct a new array from a set of choices.
clip(a_min, a_max[, out]) Return an array whose values are limited to [a_min, a_max].
compress(condition[, axis, out]) Return selected slices of this array along given axis.
conj() Complex-conjugate all elements.
conjugate() Return the complex conjugate, element-wise.
copy([names, name, dtype, deep]) Make a copy of this object.
cumprod([axis, dtype, out]) Return the cumulative product of the elements along the given axis.
cumsum([axis, dtype, out]) Return the cumulative sum of the elements along the given axis.
delete(loc) Make new DatetimeIndex with passed location deleted
diagonal([offset, axis1, axis2]) Return specified diagonals.
diff(other) Compute sorted set difference of two Index objects
dot(b[, out]) Dot product of two arrays.
drop(labels) Make new Index with passed list of labels deleted
dump(file) Dump a pickle of the array to the specified file.
dumps() Returns the pickle of the array as a string.
equals(other) Determines if two Index objects contain the same elements.
fill(*args, **kwargs) This method will not function because object is immutable.
flatten([order]) Return a copy of the array collapsed into one dimension.
format([name, formatter]) Render a string representation of the Index
get_duplicates()
get_indexer(target[, method, limit]) Compute indexer and mask for new index given the current index.
get_indexer_non_unique(target, **kwargs) return an indexer suitable for taking from a non unique index
get_level_values(level) Return vector of label values for requested level, equal to the length
get_loc(key) Get integer location for requested label
get_value(series, key) Fast lookup of value from 1-dimensional ndarray.
get_value_maybe_box(series, key)
get_values()
getfield(dtype[, offset]) Returns a field of the given array as a certain type.
groupby(f)
holds_integer()
identical(other) Similar to equals, but check that other comparable attributes are
indexer_at_time(time[, asof]) Select values at particular time of day (e.g.
indexer_between_time(start_time, end_time[, ...]) Select values between particular times of day (e.g., 9:00-9:30AM)
insert(loc, item) Make new Index inserting new item at location
intersection(other) Specialized intersection for DatetimeIndex objects. May be much faster
is_(other) More flexible, faster check like is but that works through views
is_floating()
is_integer()
is_lexsorted_for_tuple(tup)
is_mixed()
is_numeric()
is_type_compatible(typ)
isin(values) Compute boolean array of whether each index value is found in the
item(*args) Copy an element of an array to a standard Python scalar and return it.
itemset(*args, **kwargs) This method will not function because object is immutable.
join(other[, how, level, return_indexers]) See Index.join
map(f)
max([axis]) Overridden ndarray.max to return a Timestamp
mean([axis, dtype, out]) Returns the average of the array elements along given axis.
min([axis]) Overridden ndarray.min to return a Timestamp
newbyteorder([new_order]) Return the array with the same data viewed with a different byte order.
nonzero() Return the indices of the elements that are non-zero.
normalize() Return DatetimeIndex with times to midnight. Length is unaltered
order([return_indexer, ascending]) Return sorted copy of Index
prod([axis, dtype, out]) Return the product of the array elements over the given axis
ptp([axis, out]) Peak to peak (maximum - minimum) value along a given axis.
put(*args, **kwargs) This method will not function because object is immutable.
ravel([order]) Return a flattened array.
reindex(target[, method, level, limit, ...]) For Index, simply returns the new index and the results of
rename(name[, inplace]) Set new names on index.
repeat(repeats[, axis]) Analogous to ndarray.repeat
reshape(shape[, order]) Returns an array containing the same data with a new shape.
resize(new_shape[, refcheck]) Change shape and size of array in-place.
round([decimals, out]) Return a with each element rounded to the given number of decimals.
searchsorted(key[, side])
set_names(names[, inplace]) Set new names on index.
set_value(arr, key, value) Fast lookup of value from 1-dimensional ndarray.
setfield(val, dtype[, offset]) Put a value into a specified place in a field defined by a data-type.
setflags([write, align, uic]) Set array flags WRITEABLE, ALIGNED, and UPDATEIFCOPY, respectively.
shift(n[, freq]) Specialized shift which produces a DatetimeIndex
slice_indexer([start, end, step]) Index.slice_indexer, customized to handle time slicing
slice_locs([start, end]) Index.slice_locs, customized to handle partial ISO-8601 string slicing
snap([freq]) Snap time stamps to nearest occurring frequency
sort(*args, **kwargs)
squeeze([axis]) Remove single-dimensional entries from the shape of a.
std([axis, dtype, out, ddof]) Returns the standard deviation of the array elements along given axis.
sum([axis, dtype, out]) Return the sum of the array elements over the given axis.
summary([name])
swapaxes(axis1, axis2) Return a view of the array with axis1 and axis2 interchanged.
take(indices[, axis]) Analogous to ndarray.take
to_datetime([dayfirst])
to_native_types([slicer]) slice and dice then format
to_period([freq]) Cast to PeriodIndex at a particular frequency
to_pydatetime() Return DatetimeIndex as object ndarray of datetime.datetime objects
to_series() return a series with both index and values equal to the index keys
tofile(fid[, sep, format]) Write array to a file as text or binary (default).
tolist() See ndarray.tolist
tostring([order]) Construct a Python string containing the raw data bytes in the array.
trace([offset, axis1, axis2, dtype, out]) Return the sum along diagonals of the array.
transpose(*axes) Returns a view of the array with axes transposed.
tz_convert(tz) Convert DatetimeIndex from one time zone to another (using pytz)
tz_localize(tz[, infer_dst]) Localize tz-naive DatetimeIndex to given time zone (using pytz)
union(other) Specialized union for DatetimeIndex objects. If combine
union_many(others) A bit of a hack to accelerate unioning a collection of indexes
unique() Index.unique with handling for DatetimeIndex metadata
var([axis, dtype, out, ddof]) Returns the variance of the array elements, along given axis.
view(*args, **kwargs)