o
    5c                     @  s&  d dl mZ d dlmZmZmZmZmZ d dlZd dlm	Z	m
Z
mZ d dlZd dlZd dlmZmZmZmZmZ d dlmZmZmZmZmZ d dlmZ d dlmZ d d	l m!Z!m"Z"m#Z#m$Z$m%Z% d d
l&m'Z'm(Z( d dl)m*Z* d dl+m,Z,m-Z-m.Z.m/Z/ d dl0m1Z1 d dl2m3Z3m4Z4 d dl5m6  m7Z8 d dl9m:Z:m;Z;m<Z< d dl=m>Z> d dl?m@Z@ d dlAmBZB e	rd dlCmDZDmEZEmFZFmGZG dd ZHe@e3jIdd e3jJD  e3dde@ddge3dde@g de3jK e3G dd de>ZLdddddd dejMdf	d7d*d+ZNdddd,dddddejMdfd8d0d1ZOd9d5d6ZPdS ):    )annotations)datedatetimetime	timedeltatzinfoN)TYPE_CHECKINGHashableLiteral)NaTPeriod	Timestampindexlib)
BaseOffset
Resolutionperiods_per_day	timezones	to_offset)NpyDatetimeUnit)prefix_mapping)DtypeDtypeObjIntervalClosedTypeIntervalLeftRightnpt)cache_readonlydoc)find_stack_level)is_datetime64_dtypeis_datetime64tz_dtypeis_dtype_equal	is_scalar)is_valid_na_for_dtype)DatetimeArraytz_to_dtype)Indexget_unanimous_namesmaybe_extract_name)DatetimeTimedeltaMixin)inherit_names)to_time)	DataFrameFloat64IndexPeriodIndexTimedeltaIndexc                 C  s   d|v rPt |d tsP|d}t |ts*|d}|d}tj|t||d}n|}dD ]}||v rD|| t||ks?J || q.| j|fi |}|S t  t	d | j
| fi |}W d   |S 1 snw   Y  |S )zu
    This is called upon unpickling, rather than the default which doesn't
    have arguments and breaks __new__
    datatzfreq)dtyper2   )r1   r2   ignoreN)
isinstanceDatetimeIndexpopr$   _simple_newr%   getattrwarningscatch_warningssimplefilter__new__)clsdr0   r1   r2   dtakeyresult rC   S/var/www/html/gps/gps/lib/python3.10/site-packages/pandas/core/indexes/datetimes.py_new_DatetimeIndexP   s*   







rE   c                 C  s   g | ]}|d vr|qS ))tz_localize
tz_convertstrftimerC   ).0methodrC   rC   rD   
<listcomp>s   s    rK   T)wrapis_normalized_resolution_obj)cache)	r1   r   r3   to_pydatetime_format_native_typesr   r   timetzstdc                      s  e Zd ZU dZdZeZdZediddZ	de
d	< d
e
d< de
d< eejdjddZeejdkddZeejdldkddZeejdmdnddZeejdoddZeejdpddZeejdqd!d"Zdejdd#ddd#d#dd#dfdrd/d0Zedsd1d2Zd3d4 Zdtd6d7Zed8d9 Zds fd:d;Zd<d= Zdud@dAZdvdCdDZejddfdEdFZdwdkdHdIZ dxdNdOZ!dydzdRdSZ"d{dTdUZ#d|dWdXZ$ee%j&ejfd} fd[d\Z&dddejfd]d^Z'ed~d_d`Z(dyddcddZ)	dddgdhZ*  Z+S )r6   u8  
    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.

    Parameters
    ----------
    data : array-like (1-dimensional)
        Datetime-like data to construct index with.
    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.
    tz : pytz.timezone or dateutil.tz.tzfile or datetime.tzinfo or str
        Set the Timezone of the data.
    normalize : bool, default False
        Normalize start/end dates to midnight before generating date range.
    closed : {'left', 'right'}, optional
        Set whether to include `start` and `end` that are on the
        boundary. The default includes boundary points on either end.
    ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise'
        When clocks moved backward due to DST, ambiguous times may arise.
        For example in Central European Time (UTC+01), when going from 03:00
        DST to 02:00 non-DST, 02:30:00 local time occurs both at 00:30:00 UTC
        and at 01:30:00 UTC. In such a situation, the `ambiguous` parameter
        dictates how ambiguous times should be handled.

        - '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.
    dayfirst : bool, default False
        If True, parse dates in `data` with the day first order.
    yearfirst : bool, default False
        If True parse dates in `data` with the year first order.
    dtype : numpy.dtype or DatetimeTZDtype or str, default None
        Note that the only NumPy dtype allowed is ‘datetime64[ns]’.
    copy : bool, default False
        Make a copy of input ndarray.
    name : label, default None
        Name to be stored in the index.

    Attributes
    ----------
    year
    month
    day
    hour
    minute
    second
    microsecond
    nanosecond
    date
    time
    timetz
    dayofyear
    day_of_year
    weekofyear
    week
    dayofweek
    day_of_week
    weekday
    quarter
    tz
    freq
    freqstr
    is_month_start
    is_month_end
    is_quarter_start
    is_quarter_end
    is_year_start
    is_year_end
    is_leap_year
    inferred_freq

    Methods
    -------
    normalize
    strftime
    snap
    tz_convert
    tz_localize
    round
    floor
    ceil
    to_period
    to_perioddelta
    to_pydatetime
    to_series
    to_frame
    month_name
    day_name
    mean
    std

    See Also
    --------
    Index : The base pandas Index type.
    TimedeltaIndex : Index of timedelta64 data.
    PeriodIndex : Index of Period data.
    to_datetime : Convert argument to datetime.
    date_range : Create a fixed-frequency DatetimeIndex.

    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>`__.
    datetimeindexTreturntype[libindex.DatetimeEngine]c                 C  s   t jS N)libindexDatetimeEngineselfrC   rC   rD   _engine_type  s   zDatetimeIndex._engine_typer$   _dataz
str | Noneinferred_freqztzinfo | Noner1   r&   c                 C  s   | j |}t|| jtdS )N)namer3   )r]   rH   r&   r_   object)r[   date_formatarrrC   rC   rD   rH     s   zDatetimeIndex.strftimec                 C  s    | j |}t| j|| jdS Nr_   )r]   rG   typer8   r_   )r[   r1   rb   rC   rC   rD   rG     s   zDatetimeIndex.tz_convertraisec                 C  s$   | j |||}t| j|| jdS rc   )r]   rF   re   r8   r_   )r[   r1   	ambiguousnonexistentrb   rC   rC   rD   rF     s   zDatetimeIndex.tz_localizeNr.   c                 C  (   ddl m} | j|}|j|| jdS )Nr   )r.   rd   )pandas.core.indexes.apir.   r]   	to_periodr8   r_   )r[   r2   r.   rb   rC   rC   rD   rk        zDatetimeIndex.to_periodr/   c                 C  ri   )Nr   )r/   rd   )rj   r/   r]   to_perioddeltar8   r_   )r[   r2   r/   rb   rC   rC   rD   rm   #  rl   zDatetimeIndex.to_perioddeltar-   c                 C  s&   ddl m} | j }|j|| jdS )Nr   )r-   rd   )rj   r-   r]   to_julian_dater8   r_   )r[   r-   rb   rC   rC   rD   rn   *  s   
zDatetimeIndex.to_julian_dater,   c                 C  s   | j  }|| S rW   )r]   isocalendar	set_index)r[   dfrC   rC   rD   ro   1  s   

zDatetimeIndex.isocalendarFr2    str | BaseOffset | lib.NoDefault	normalizebooldayfirst	yearfirstr3   Dtype | Nonecopyr_   r	   c              
   C  s   t |r	| |t||| }t|tr.|tju r.|d u r.|	d u r.|
r'| }| j||dS t|trO|tju rO|d u rOt	|j
|	rO|
rH| }| j||dS tj||	|
|||||d}| j||d}|S )Nrd   )r3   rx   r1   r2   ru   rv   rg   )r"   _scalar_data_errorr(   r5   r$   r   
no_defaultrx   r8   r!   r3   _from_sequence_not_strict)r>   r0   r2   r1   rs   closedrg   ru   rv   r3   rx   r_   dtarrsubarrrC   rC   rD   r=   9  sJ   

	zDatetimeIndex.__new__c                 C  s    ddl m} | jdu o|| jS )z
        Return a boolean if we are only dates (and don't have a timezone)

        Returns
        -------
        bool
        r   is_dates_onlyN)pandas.io.formats.formatr   r1   _values)r[   r   rC   rC   rD   _is_dates_onlyw  s   	zDatetimeIndex._is_dates_onlyc                 C  s    | j | jd}tt| |fd fS )N)r0   r_   )r]   r_   rE   re   )r[   r?   rC   rC   rD   
__reduce__  s   zDatetimeIndex.__reduce__r   c                 C  s   | j dur	t|S t|S )zF
        Can we compare values of the given dtype to our own?
        N)r1   r    r   )r[   r3   rC   rC   rD   _is_comparable_dtype  s   
z"DatetimeIndex._is_comparable_dtypec                   s$   ddl m} || jd  fddS )Nr   )get_format_datetime64r   c                   s   d |  dS )N'rC   )x	formatterrC   rD   <lambda>  s    z/DatetimeIndex._formatter_func.<locals>.<lambda>)r   r   r   )r[   r   rC   r   rD   _formatter_func  s   zDatetimeIndex._formatter_funcc                   sX   | j d urt| j st| j sdS |j d ur&t|j s&t|j s&dS t |S )NF)r1   r   is_utcis_fixed_offsetsuper_can_range_setop)r[   other	__class__rC   rD   r     s   



zDatetimeIndex._can_range_setopc              	   C  s   t jdtt d | }|D ]C}t|tst||}qt|ts0zt|}W n	 ty/   Y nw |	|\}}t
| rJt
|rJ||rJ||}qt||}qt| g|R  d }|j|kre||S |S )zQ
        A bit of a hack to accelerate unioning a collection of indexes.
        zfDatetimeIndex.union_many is deprecated and will be removed in a future version. Use obj.union instead.
stacklevelr   )r:   warnFutureWarningr   r5   r6   r&   union	TypeError_maybe_utc_convertlen_can_fast_union_fast_unionr'   r_   rename)r[   othersthisr   res_namerC   rC   rD   
union_many  s0   



zDatetimeIndex.union_manyr   tuple[DatetimeIndex, Index]c                 C  sV   | }t |tr'| jd u |jd u A rtdt| j|js'| d}|d}||fS )Nz0Cannot join tz-naive with tz-aware DatetimeIndexUTC)r5   r6   r1   r   r   
tz_comparerG   )r[   r   r   rC   rC   rD   r     s   


z DatetimeIndex._maybe_utc_convertnpt.NDArray[np.int64]c                 C  s   | j  }| j j}t|}|| }|tjjkr|d }n#|tjjkr%|}n|tjjkr0|d }n|tj	jkr;|d }nt
|d|| j< |S )z}
        Return the number of microseconds since midnight.

        Returns
        -------
        ndarray[int64_t]
        i  @B )r]   _local_timestamps_resor   r   	NPY_FR_nsvalue	NPY_FR_us	NPY_FR_msNPY_FR_sNotImplementedError_isnan)r[   valuesresoppdfracmicrosrC   rC   rD   _get_time_micros  s   




zDatetimeIndex._get_time_microsc                 C  s   ddl m} |du r|  }|du r| j}|tjur0|r&tjdtt	 d ntjdtt	 d nd}|r@| j
dur@| jdd}n| jd	 }||||d
S )a  
        Create a Series with both index and values equal to the index keys.

        Useful with map for returning an indexer based on an index.

        Parameters
        ----------
        keep_tz : optional, defaults True
            Return the data keeping the timezone.

            If keep_tz is True:

              If the timezone is not set, the resulting
              Series will have a datetime64[ns] dtype.

              Otherwise the Series will have an datetime64[ns, tz] dtype; the
              tz will be preserved.

            If keep_tz is False:

              Series will have a datetime64[ns] dtype. TZ aware
              objects will have the tz removed.

            .. versionchanged:: 1.0.0
                The default value is now True.  In a future version,
                this keyword will be removed entirely.  Stop passing the
                argument to obtain the future behavior and silence the warning.

        index : Index, optional
            Index of resulting Series. If None, defaults to original index.
        name : str, optional
            Name of resulting Series. If None, defaults to name of original
            index.

        Returns
        -------
        Series
        r   )SeriesNzThe 'keep_tz' keyword in DatetimeIndex.to_series is deprecated and will be removed in a future version. You can stop passing 'keep_tz' to silence this warning.r   zSpecifying 'keep_tz=False' is deprecated and this option will be removed in a future release. If you want to remove the timezone information, you can do 'idx.tz_convert(None)' before calling 'to_series'.T)deepzM8[ns])r   r_   )pandasr   _viewr_   r   rz   r:   r   r   r   r1   rx   r   view)r[   keep_tzr   r_   r   r   rC   rC   rD   	to_series  s,   '

zDatetimeIndex.to_seriesSc                 C  s   t |}| j }t| D ]*\}}|}||s3||}||}t|| t|| k r1|}n|}|||< qtj	|| j
dS )zy
        Snap time stamps to nearest occurring frequency.

        Returns
        -------
        DatetimeIndex
        rd   )r   r]   rx   	enumerateis_on_offsetrollbackrollforwardabsr6   r8   r_   )r[   r2   r@   ivst0t1rC   rC   rD   snapP  s   	




zDatetimeIndex.snapr   r   parsedr   c                 C  sl   t ||jd}|j|j}}||j}||j}|jdur(| jdu r(td| |}| |}||fS )aI  
        Calculate datetime bounds for parsed time string and its resolution.

        Parameters
        ----------
        reso : str
            Resolution provided by parsed string.
        parsed : datetime
            Datetime from parsed string.

        Returns
        -------
        lower, upper: pd.Timestamp
        )r2   NzSThe index must be timezone aware when indexing with a date string with a UTC offset)	r   attr_abbrev
start_timeend_timerF   r   r1   
ValueError_maybe_cast_for_get_loc)r[   r   r   perstartendrC   rC   rD   _parsed_string_to_boundsm  s   



z&DatetimeIndex._parsed_string_to_boundsone_wayNonec                 C  sX   z	| j | W d S  ty+   | jd u rd}n|rY d S d}tj|tt d Y d S w )NzIndexing a timezone-naive DatetimeIndex with a timezone-aware datetime is deprecated and will raise KeyError in a future version.  Use a timezone-naive object instead.zIndexing a timezone-aware DatetimeIndex with a timezone-naive datetime is deprecated and will raise KeyError in a future version. Use a timezone-aware object instead.r   )r]   _assert_tzawareness_compatr   r1   r:   r   r   r   )r[   rA   r   msgrC   rC   rD   _deprecate_mismatched_indexing  s   
z,DatetimeIndex._deprecate_mismatched_indexingc              
   C  sx  |  | |}t|| jrt}t|| jjr!| | | |}nt|t	rvz	| 
|\}}W n ty@ } zt||d}~ww | j|dd | |rpz| ||W S  tyo } z|du ret||W Y d}~nd}~ww | |}n+t|trtdt| j dt|j t|tr|durtd| |S t|z	t| |||W S  ty } zt||d}~ww )zm
        Get integer location for requested label

        Returns
        -------
        loc : int
        NT)r   zCannot index z with z:cannot yet lookup inexact labels when key is a time object)_check_indexing_errorr#   r3   r   r5   r]   _recognized_scalarsr   r   str_parse_with_resor   KeyError_can_partial_date_slice_partial_date_slicer   r   re   __name__r   r   indexer_at_timer&   get_loc)r[   rA   rJ   	toleranceorig_keyr   r   errrC   rC   rD   r     sT   









zDatetimeIndex.get_locr   c              
   C  sf   zt |}W n ty } zt|ts t||d }~ww |jd u r+|| j}|S || j}|S rW   )	r   r   r5   r   r   r   rF   r1   rG   )r[   rA   r   rC   rC   rD   r     s   


z%DatetimeIndex._maybe_cast_for_get_locsider   c                   sF   t |trt |tst| }t j|||d}| | | |S )Nkind)	r5   r   r   r   rP   r   _maybe_cast_slice_boundr   r   )r[   labelr   r   r   rC   rD   r     s
   

z%DatetimeIndex._maybe_cast_slice_boundc                 C  sD  |  |dd t|tr#t|tr#|dur|dkrtd| ||S t|ts-t|tr1tddd }||s@||s@| jrJtj| ||||d	S t	
d
}t	
d
}|durf| |d}|| k}|| k}|dur|| |d}	| |	k|@ }|	| k|B }| stjdtt d | d dd| }
t|
t| krtdS |
S )a  
        Return indexer for specified label slice.
        Index.slice_indexer, customized to handle time slicing.

        In addition to functionality provided by Index.slice_indexer, does the
        following:

        - if both `start` and `end` are instances of `datetime.time`, it
          invokes `indexer_between_time`
        - if `start` and `end` are both either string or None perform
          value-based selection in non-monotonic cases.

        r   slice_indexerN   z)Must have step size of 1 with time slicesz'Cannot mix time and non-time slice keysc                 S  s   | d uo	t | t S rW   )r5   r   )pointrC   rC   rD   check_str_or_none  s   z6DatetimeIndex.slice_indexer.<locals>.check_str_or_noner   TleftrightzValue based partial slicing on non-monotonic DatetimeIndexes with non-existing keys is deprecated and will raise a KeyError in a future Version.r   r   )_deprecated_argr5   r   r   indexer_between_timer   is_monotonic_increasingr&   r   nparrayr   anyr:   r   r   r   nonzeror   slice)r[   r   r   stepr   r   maskdeprecation_maskstart_casted
end_castedindexerrC   rC   rD   r     sF   

zDatetimeIndex.slice_indexerc                 C  s   dS )N
datetime64rC   rZ   rC   rC   rD   inferred_typeG  s   zDatetimeIndex.inferred_typeasofnpt.NDArray[np.intp]c                 C  sx   |rt dt|trddlm} || }|jr,| jdu r#td| 	|j
 }n| 
 }t|}||k d S )av  
        Return index locations of values at particular time of day.

        Parameters
        ----------
        time : datetime.time or str
            Time passed in either as object (datetime.time) or as string in
            appropriate format ("%H:%M", "%H%M", "%I:%M%p", "%I%M%p",
            "%H:%M:%S", "%H%M%S", "%I:%M:%S%p", "%I%M%S%p").

        Returns
        -------
        np.ndarray[np.intp]

        See Also
        --------
        indexer_between_time : Get index locations of values between particular
            times of day.
        DataFrame.at_time : Select values at particular time of day.
        z 'asof' argument is not supportedr   )parseNzIndex must be timezone aware.)r   r5   r   dateutil.parserr  r   r   r1   r   rG   r   _time_to_microsr   )r[   r   r  r  time_microsr   rC   rC   rD   r   M  s   

zDatetimeIndex.indexer_at_timeinclude_startinclude_endc                 C  s   t |}t |}|  }t|}t|}|r|rtj }}	n|r'tj}tj}	n|r0tj}tj}	ntj }}	||kr=tj}
ntj}
|
||||	||}| d S )a  
        Return index locations of values between particular times of day.

        Parameters
        ----------
        start_time, end_time : datetime.time, str
            Time passed either as object (datetime.time) or as string in
            appropriate format ("%H:%M", "%H%M", "%I:%M%p", "%I%M%p",
            "%H:%M:%S", "%H%M%S", "%I:%M:%S%p","%I%M%S%p").
        include_start : bool, default True
        include_end : bool, default True

        Returns
        -------
        np.ndarray[np.intp]

        See Also
        --------
        indexer_at_time : Get index locations of values at particular time of day.
        DataFrame.between_time : Select values between particular times of day.
        r   )	r+   r   r  operatorleltand_or_r   )r[   r   r   r  r	  r  start_micros
end_microslopropjoin_opr   rC   rC   rD   r   s  s&   
z"DatetimeIndex.indexer_between_time)rU   rV   )rU   r&   )rU   r6   )rf   rf   rW   )rU   r.   )rU   r/   )rU   r-   )rU   r,   )r2   rr   rs   rt   ru   rt   rv   rt   r3   rw   rx   rt   r_   r	   rU   r6   )rU   rt   )r3   r   rU   rt   )r   r&   rU   r   )rU   r   )r   )r   r   r   r   )F)r   rt   rU   r   )NN)rU   r   )r   r   )rU   r   )r  rt   rU   r  )TT)r  rt   r	  rt   rU   r  ),r   
__module____qualname____doc___typr$   	_data_cls!_supports_partial_string_indexingpropertyr\   __annotations__r   rH   rG   rF   rk   rm   rn   ro   r   rz   r=   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r)   r   r   r  r   r   __classcell__rC   rC   r   rD   r6   q   sx   
 q	>

	
%
N
#

:D'r6   Frs   rt   r_   r	   r|   /Literal['left', 'right'] | None | lib.NoDefault	inclusiveIntervalClosedType | NonerU   c	              
   K  s   |dur|t jurtd|t jur-tjdtt d |du r"d}n|dv r)|}n
td|du r3d}|du r@t|| |r@d}t	j
d| ||||||d	|	}
tj|
|d
S )a	  
    Return a fixed frequency DatetimeIndex.

    Returns the range of equally spaced time points (where the difference between any
    two adjacent points is specified by the given frequency) such that they all
    satisfy `start <[=] x <[=] end`, where the first one and the last one are, resp.,
    the first and last time points in that range that fall on the boundary of ``freq``
    (if given as a frequency string) or that are valid for ``freq`` (if given as a
    :class:`pandas.tseries.offsets.DateOffset`). (If exactly one of ``start``,
    ``end``, or ``freq`` is *not* specified, this missing parameter can be computed
    given ``periods``, the number of timesteps in the range. See the note below.)

    Parameters
    ----------
    start : str or datetime-like, optional
        Left bound for generating dates.
    end : str or datetime-like, optional
        Right bound for generating dates.
    periods : int, optional
        Number of periods to generate.
    freq : str or DateOffset, default 'D'
        Frequency strings can have multiples, e.g. '5H'. See
        :ref:`here <timeseries.offset_aliases>` for a list of
        frequency aliases.
    tz : str or tzinfo, optional
        Time zone name for returning localized DatetimeIndex, for example
        'Asia/Hong_Kong'. By default, the resulting DatetimeIndex is
        timezone-naive.
    normalize : bool, default False
        Normalize start/end dates to midnight before generating date range.
    name : str, default None
        Name of the resulting DatetimeIndex.
    closed : {None, 'left', 'right'}, optional
        Make the interval closed with respect to the given frequency to
        the 'left', 'right', or both sides (None, the default).

        .. deprecated:: 1.4.0
           Argument `closed` has been deprecated to standardize boundary inputs.
           Use `inclusive` instead, to set each bound as closed or open.
    inclusive : {"both", "neither", "left", "right"}, default "both"
        Include boundaries; Whether to set each bound as closed or open.

        .. versionadded:: 1.4.0
    **kwargs
        For compatibility. Has no effect on the result.

    Returns
    -------
    rng : DatetimeIndex

    See Also
    --------
    DatetimeIndex : An immutable container for datetimes.
    timedelta_range : Return a fixed frequency TimedeltaIndex.
    period_range : Return a fixed frequency PeriodIndex.
    interval_range : Return a fixed frequency IntervalIndex.

    Notes
    -----
    Of the four parameters ``start``, ``end``, ``periods``, and ``freq``,
    exactly three must be specified. If ``freq`` is omitted, the resulting
    ``DatetimeIndex`` will have ``periods`` linearly spaced elements between
    ``start`` and ``end`` (closed on both sides).

    To learn more about the frequency strings, please see `this link
    <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`__.

    Examples
    --------
    **Specifying the values**

    The next four examples generate the same `DatetimeIndex`, but vary
    the combination of `start`, `end` and `periods`.

    Specify `start` and `end`, with the default daily frequency.

    >>> pd.date_range(start='1/1/2018', end='1/08/2018')
    DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
                   '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'],
                  dtype='datetime64[ns]', freq='D')

    Specify `start` and `periods`, the number of periods (days).

    >>> pd.date_range(start='1/1/2018', periods=8)
    DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
                   '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'],
                  dtype='datetime64[ns]', freq='D')

    Specify `end` and `periods`, the number of periods (days).

    >>> pd.date_range(end='1/1/2018', periods=8)
    DatetimeIndex(['2017-12-25', '2017-12-26', '2017-12-27', '2017-12-28',
                   '2017-12-29', '2017-12-30', '2017-12-31', '2018-01-01'],
                  dtype='datetime64[ns]', freq='D')

    Specify `start`, `end`, and `periods`; the frequency is generated
    automatically (linearly spaced).

    >>> pd.date_range(start='2018-04-24', end='2018-04-27', periods=3)
    DatetimeIndex(['2018-04-24 00:00:00', '2018-04-25 12:00:00',
                   '2018-04-27 00:00:00'],
                  dtype='datetime64[ns]', freq=None)

    **Other Parameters**

    Changed the `freq` (frequency) to ``'M'`` (month end frequency).

    >>> pd.date_range(start='1/1/2018', periods=5, freq='M')
    DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31', '2018-04-30',
                   '2018-05-31'],
                  dtype='datetime64[ns]', freq='M')

    Multiples are allowed

    >>> pd.date_range(start='1/1/2018', periods=5, freq='3M')
    DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31',
                   '2019-01-31'],
                  dtype='datetime64[ns]', freq='3M')

    `freq` can also be specified as an Offset object.

    >>> pd.date_range(start='1/1/2018', periods=5, freq=pd.offsets.MonthEnd(3))
    DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31',
                   '2019-01-31'],
                  dtype='datetime64[ns]', freq='3M')

    Specify `tz` to set the timezone.

    >>> pd.date_range(start='1/1/2018', periods=5, tz='Asia/Tokyo')
    DatetimeIndex(['2018-01-01 00:00:00+09:00', '2018-01-02 00:00:00+09:00',
                   '2018-01-03 00:00:00+09:00', '2018-01-04 00:00:00+09:00',
                   '2018-01-05 00:00:00+09:00'],
                  dtype='datetime64[ns, Asia/Tokyo]', freq='D')

    `inclusive` controls whether to include `start` and `end` that are on the
    boundary. The default, "both", includes boundary points on either end.

    >>> pd.date_range(start='2017-01-01', end='2017-01-04', inclusive="both")
    DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03', '2017-01-04'],
                  dtype='datetime64[ns]', freq='D')

    Use ``inclusive='left'`` to exclude `end` if it falls on the boundary.

    >>> pd.date_range(start='2017-01-01', end='2017-01-04', inclusive='left')
    DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03'],
                  dtype='datetime64[ns]', freq='D')

    Use ``inclusive='right'`` to exclude `start` if it falls on the boundary, and
    similarly ``inclusive='neither'`` will exclude both `start` and `end`.

    >>> pd.date_range(start='2017-01-01', end='2017-01-04', inclusive='right')
    DatetimeIndex(['2017-01-02', '2017-01-03', '2017-01-04'],
                  dtype='datetime64[ns]', freq='D')
    NzPDeprecated argument `closed` cannot be passedif argument `inclusive` is not Nonez8Argument `closed` is deprecated in favor of `inclusive`.r   both)r   r   z:Argument `closed` has to be either 'left', 'right' or NoneD)r   r   periodsr2   r1   rs   r  rd   rC   )r   rz   r   r:   r   r   r   comany_noner$   _generate_ranger6   r8   )r   r   r"  r2   r1   rs   r_   r|   r  kwargsr}   rC   rC   rD   
date_range  sD    '

r'  Br"  
int | None(IntervalLeftRight | lib.NoDefault | Nonec                 K  s   |du r
d}t |t|tr;|dr;z|pd}t| ||d}W n% tt fy: } z
d| }t||d}~ww |s?|rHd| }t|td	| |||||||	|
d	|S )
a/
  
    Return a fixed frequency DatetimeIndex with business day as the default.

    Parameters
    ----------
    start : str or datetime-like, default None
        Left bound for generating dates.
    end : str or datetime-like, default None
        Right bound for generating dates.
    periods : int, default None
        Number of periods to generate.
    freq : str or DateOffset, default 'B' (business daily)
        Frequency strings can have multiples, e.g. '5H'.
    tz : str or None
        Time zone name for returning localized DatetimeIndex, for example
        Asia/Beijing.
    normalize : bool, default False
        Normalize start/end dates to midnight before generating date range.
    name : str, default None
        Name of the resulting DatetimeIndex.
    weekmask : str or None, default None
        Weekmask of valid business days, passed to ``numpy.busdaycalendar``,
        only used when custom frequency strings are passed.  The default
        value None is equivalent to 'Mon Tue Wed Thu Fri'.
    holidays : list-like or None, default None
        Dates to exclude from the set of valid business days, passed to
        ``numpy.busdaycalendar``, only used when custom frequency strings
        are passed.
    closed : str, default None
        Make the interval closed with respect to the given frequency to
        the 'left', 'right', or both sides (None).

        .. deprecated:: 1.4.0
           Argument `closed` has been deprecated to standardize boundary inputs.
           Use `inclusive` instead, to set each bound as closed or open.
    inclusive : {"both", "neither", "left", "right"}, default "both"
        Include boundaries; Whether to set each bound as closed or open.

        .. versionadded:: 1.4.0
    **kwargs
        For compatibility. Has no effect on the result.

    Returns
    -------
    DatetimeIndex

    Notes
    -----
    Of the four parameters: ``start``, ``end``, ``periods``, and ``freq``,
    exactly three must be specified.  Specifying ``freq`` is a requirement
    for ``bdate_range``.  Use ``date_range`` if specifying ``freq`` is not
    desired.

    To learn more about the frequency strings, please see `this link
    <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`__.

    Examples
    --------
    Note how the two weekend days are skipped in the result.

    >>> pd.bdate_range(start='1/1/2018', end='1/08/2018')
    DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
               '2018-01-05', '2018-01-08'],
              dtype='datetime64[ns]', freq='B')
    Nz>freq must be specified for bdate_range; use date_range insteadCzMon Tue Wed Thu Fri)holidaysweekmaskz!invalid custom frequency string: zZa custom frequency string is required when holidays or weekmask are passed, got frequency )	r   r   r"  r2   r1   rs   r_   r|   r  rC   )r   r5   r   
startswithr   r   r   r'  )r   r   r"  r2   r1   rs   r_   r-  r,  r|   r  r&  r   r   rC   rC   rD   bdate_ranger  s>   O


r/  time_objr   intc                 C  s,   | j d d d| j  | j }d| | j S )N<   r   )hourminutesecondmicrosecond)r0  secondsrC   rC   rD   r    s   r  )
rs   rt   r_   r	   r|   r  r  r  rU   r6   )r"  r)  rs   rt   r_   r	   r|   r*  r  r  rU   r6   )r0  r   rU   r1  )Q
__future__r   r   r   r   r   r   r
  typingr   r	   r
   r:   numpyr   pandas._libsr   r   r   r   rX   r   pandas._libs.tslibsr   r   r   r   r   pandas._libs.tslibs.dtypesr   pandas._libs.tslibs.offsetsr   pandas._typingr   r   r   r   r   pandas.util._decoratorsr   r   pandas.util._exceptionsr   pandas.core.dtypes.commonr   r    r!   r"   pandas.core.dtypes.missingr#   pandas.core.arrays.datetimesr$   r%   pandas.core.commoncorecommonr#  pandas.core.indexes.baser&   r'   r(    pandas.core.indexes.datetimeliker)   pandas.core.indexes.extensionr*   pandas.core.tools.timesr+   r   r,   r-   r.   r/   rE   
_field_ops_datetimelike_methods	_bool_opsr6   rz   r'  r/  r  rC   rC   rC   rD   <module>   s    !
      " No