3
���h�( � @ s0 d Z ddlmZmZ ddlmZmZ ddlm Z m
Z
ddlmZ ddl
mZ ddlmZmZmZmZmZmZmZ ddlmZ dd lmZ dd
ljjZddl m!Z!m"Z" ddl#m$Z$m%Z% dd
l&m'Z' e'dddddddgej( edd�e'dddddddddd d!d"ge�G d#d$� d$e%���Z)e)j*� d(e)d%�d&d'�Z+d
S ))z implement the TimedeltaIndex � )�index�lib)� Timedelta� to_offset)�DtypeObj�Label)�InvalidIndexError)�doc)�TD64NS_DTYPE�is_float�
is_integer� is_scalar�is_timedelta64_dtype�is_timedelta64_ns_dtype�pandas_dtype)�datetimelike)�TimedeltaArrayN)�Index�maybe_extract_name)�DatetimeIndexOpsMixin�DatetimeTimedeltaMixin)�
inherit_names�__neg__�__pos__�__abs__�
total_seconds�round�floor�ceilT)�wrapZ _bool_opsZ_object_ops�
_field_opsZ_datetimelike_opsZ_datetimelike_methodsZ
_other_ops�
componentsZto_pytimedelta�sumZstdZmedianZ_format_native_typesc @ s� e Zd ZU dZdZejZddgZddgZ dZ
edde
jdeddfdd �Zedeed
�dd��Zed
d� �Zeej�ddd��Zeed�dd�Zd dd�Zed�dd�Zed�dd�Zeed�dd��Z dS )!�TimedeltaIndexa�
Immutable ndarray of timedelta64 data, represented internally as int64, and
which can be boxed to timedelta objects.
Parameters
----------
data : array-like (1-dimensional), optional
Optional timedelta-like data to construct index with.
unit : unit of the arg (D,h,m,s,ms,us,ns) denote the unit, optional
Which is an integer/float number.
freq : str or pandas offset object, optional
One of pandas date offset strings or corresponding objects. The string
'infer' can be passed in order to set the frequency of the index as the
inferred frequency upon creation.
copy : bool
Make a copy of input ndarray.
name : object
Name to be stored in the index.
Attributes
----------
days
seconds
microseconds
nanoseconds
components
inferred_freq
Methods
-------
to_pytimedelta
to_series
round
floor
ceil
to_frame
mean
See Also
--------
Index : The base pandas Index type.
Timedelta : Represents a duration between two dates or times.
DatetimeIndex : Index of datetime64 data.
PeriodIndex : Index of Period data.
timedelta_range : Create a fixed-frequency TimedeltaIndex.
Notes
-----
To learn more about the frequency strings, please see `this link
<https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`__.
Ztimedeltaindex�name�freqTNFc C s� t ||| �}t|�r.t| j� dt|�� d���|d kr>td��t|t�rl|tj krl|r^|j
� }| j||d�S t|t�r�|tj kr�|d kr�|r�|j
� S |j
� S tj|||||d�}| j||d�S )
Nz2() must be called with a collection of some kind, z was passed�Y�y�MzqUnits 'M', 'Y', and 'y' are no longer supported, as they do not represent unambiguous timedelta values durations.)r$ )r% �unit�dtype�copy> r' |