MCPcopy
hub / github.com/pandas-dev/pandas / DatetimeIndex

Class DatetimeIndex

pandas/core/indexes/datetimes.py:142–1245  ·  view source on GitHub ↗

Immutable ndarray-like of datetime64 data. Represented internally as int64, and which can be boxed to Timestamp objects that are subclasses of datetime and carry metadata. .. versionchanged:: 2.0.0 The various numeric date/time attributes (:attr:`~DatetimeIndex.day`,

Source from the content-addressed store, hash-verified

140)
141@set_module("pandas")
142class DatetimeIndex(DatetimeTimedeltaMixin):
143 """
144 Immutable ndarray-like of datetime64 data.
145
146 Represented internally as int64, and which can be boxed to Timestamp objects
147 that are subclasses of datetime and carry metadata.
148
149 .. versionchanged:: 2.0.0
150 The various numeric date/time attributes (:attr:`~DatetimeIndex.day`,
151 :attr:`~DatetimeIndex.month`, :attr:`~DatetimeIndex.year` etc.) now have dtype
152 ``int32``. Previously they had dtype ``int64``.
153
154 Parameters
155 ----------
156 data : array-like (1-dimensional)
157 Datetime-like data to construct index with.
158 freq : str or pandas offset object, optional
159 One of pandas date offset strings or corresponding objects. The string
160 'infer' can be passed in order to set the frequency of the index as the
161 inferred frequency upon creation.
162 tz : zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or str
163 Set the Timezone of the data.
164 ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise'
165 When clocks moved backward due to DST, ambiguous times may arise.
166 For example in Central European Time (UTC+01), when going from 03:00
167 DST to 02:00 non-DST, 02:30:00 local time occurs both at 00:30:00 UTC
168 and at 01:30:00 UTC. In such a situation, the `ambiguous` parameter
169 dictates how ambiguous times should be handled.
170
171 - 'infer' will attempt to infer fall dst-transition hours based on
172 order
173 - bool-ndarray where True signifies a DST time, False signifies a
174 non-DST time (note that this flag is only applicable for ambiguous
175 times)
176 - 'NaT' will return NaT where there are ambiguous times
177 - 'raise' will raise a ValueError if there are ambiguous times.
178 dayfirst : bool, default False
179 If True, parse dates in `data` with the day first order.
180 yearfirst : bool, default False
181 If True parse dates in `data` with the year first order.
182 dtype : numpy.dtype or DatetimeTZDtype or str, default None
183 Note that the only NumPy dtype allowed is `datetime64[ns]`.
184 copy : bool, default None
185 Whether to copy input data, only relevant for array, Series, and Index
186 inputs (for other input, e.g. a list, a new array is created anyway).
187 Defaults to True for array input and False for Index/Series.
188 Set to False to avoid copying array input at your own risk (if you
189 know the input data won't be modified elsewhere).
190 Set to True to force copying Series/Index up front.
191 name : label, default None
192 Name to be stored in the index.
193
194 Attributes
195 ----------
196 year
197 month
198 day
199 hour

Callers 15

setupMethod · 0.90
time_from_list_of_strMethod · 0.90
setupMethod · 0.90
datesMethod · 0.90
holidaysMethod · 0.90
_get_time_binsMethod · 0.90
_asfreq_compatFunction · 0.90
_box_as_indexlikeFunction · 0.90

Calls

no outgoing calls