Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/core/arrays/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/core/arrays/__pycache__/period.cpython-312.pyc

�

Mٜg4�����ddlmZddlmZddlZddlmZmZmZm	Z	m
Z
mZmZddl
Z
ddlZddlmZmZddlmZddlmZmZmZmZmZmZmZmZm Z m!Z!m"Z#m$Z$ddl%m&Z&m'Z'm(Z(dd	l)m*Z*dd
l+m,Z,m-Z-ddl.m/Z/m0Z0m1Z1m2Z2m3Z3ddl4m5Z5m6Z6dd
l7m8Z8ddl9m:Z:m;Z;ddl<m=Z=m>Z>ddl?m@Z@mAZAmBZBmCZCddlDmEZEddlFmGZHddlImJcmKZLer(ddlMmNZNddlOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWddlFmXZXmYZYddlZm[Z[e
de��Z\ddiZ]d&d'd�Z^Gd�deHj�e#j��Zad(d�Zb		d)							d*d�Zced+d��Zded,d ��Zd				d-d!�Zd	d&	d.d"�Zd/d0d#�Ze								d1	d2d$�Zfd3d%�Zgy)4�)�annotations)�	timedeltaN)�
TYPE_CHECKING�Any�Callable�Literal�TypeVar�cast�overload)�algos�lib)�
NDArrayBacked)�
BaseOffset�NaT�NaTType�	Timedelta�add_overflowsafe�astype_overflowsafe�dt64arr_to_periodarr�get_unit_from_dtype�iNaT�parsing�period�	to_offset)�	FreqGroup�PeriodDtypeBase�freq_to_period_freqstr)�isleapyear_arr)�Tick�
delta_to_tick)�DIFFERENT_FREQ�IncompatibleFrequency�Period�get_period_field_arr�period_asfreq_arr)�cache_readonly�doc)�find_stack_level)�
ensure_object�pandas_dtype)�DatetimeTZDtype�PeriodDtype)�ABCIndex�ABCPeriodIndex�	ABCSeries�ABCTimedeltaArray)�isna)�datetimelike)�Sequence)�AnyArrayLike�Dtype�
FillnaOptions�NpDtype�NumpySorter�NumpyValueArrayLike�Self�npt)�
DatetimeArray�TimedeltaArray)�ExtensionArray�BaseOffsetT)�bound�klass�PeriodArrayc�@���fd�}�|_||_t|�S)Nc�b��|jj}t�|j|�}|S�N)�dtype�_dtype_coder$�asi8)�self�base�result�names   ��D/usr/local/lib/python3.12/site-packages/pandas/core/arrays/period.py�fz_field_accessor.<locals>.fms)����z�z�%�%��%�d�D�I�I�t�<���
�)�__name__�__doc__�property)rL�	docstringrNs`  rM�_field_accessorrTls"����
�A�J��A�I��A�;�rOc���eZdZUdZdZdZeje�Z	e
fZd�ZdZ
edRd��ZgZded<d	gZded
<gd�Zded<gd
�Zded<eezezZded<gd�Zded<ded<	dS					dTd�Ze						dUd��Zeddd�					dVd��Zeddd�					dVd��ZedWdXd��Zed��ZedYd��Z				dZd�Zd[d�Z d\d �Z!e"d]d!��Z#ed^d"��Z$ed_d#��Z%	d`					dad$�Z&dWd%�Z'e(d&d'�Z)e(d(d)�Z*e(d*d+�Z+e(d,d-�Z,e(d.d/�Z-e(d0d1�Z.e(d2d3�Z/e/Z0e(d4d5�Z1e1Z2e2Z3e(d6d7�xZ4Z5e(d8d9�Z6e(d:�Z7e(d;d<�Z8e8Z9edbd=��Z:dcddd>�Z;ded?�Z<e=dfie>�d@d@dA���dgdhdB��Z?didjdC�Z@dDddE�			dkdF�ZAdldm�fdH�
ZB		dn							dodI�ZCdddGdJ�									dpdK�ZD	dq					dr�fdL�
ZE						dsdM�ZFdtdN�ZG�fdO�ZH				dudP�ZIdQ�ZJ�xZKS)vrBa�
    Pandas ExtensionArray for storing Period data.

    Users should use :func:`~pandas.array` to create new instances.

    Parameters
    ----------
    values : Union[PeriodArray, Series[period], ndarray[int], PeriodIndex]
        The data to store. These should be arrays that can be directly
        converted to ordinals without inference or copy (PeriodArray,
        ndarray[int64]), or a box around such an array (Series[period],
        PeriodIndex).
    dtype : PeriodDtype, optional
        A PeriodDtype instance from which to extract a `freq`. If both
        `freq` and `dtype` are specified, then the frequencies must match.
    freq : str or DateOffset
        The `freq` to use for the array. Mostly applicable when `values`
        is an ndarray of integers, when `freq` is required. When `values`
        is a PeriodArray (or box around), it's checked that ``values.freq``
        matches `freq`.
    copy : bool, default False
        Whether to copy the ordinals before storing.

    Attributes
    ----------
    None

    Methods
    -------
    None

    See Also
    --------
    Period: Represents a period of time.
    PeriodIndex : Immutable Index for period data.
    period_range: Create a fixed-frequency PeriodArray.
    array: Construct a pandas array.

    Notes
    -----
    There are two components to a PeriodArray

    - ordinals : integer ndarray
    - freq : pd.tseries.offsets.Offset

    The values are physically stored as a 1-D ndarray of integers. These are
    called "ordinals" and represent some kind of offset from a base.

    The `freq` indicates the span covered by each element of the array.
    All elements in the PeriodArray have the same `freq`.

    Examples
    --------
    >>> pd.arrays.PeriodArray(pd.PeriodIndex(['2023-01-01',
    ...                                       '2023-01-02'], freq='D'))
    <PeriodArray>
    ['2023-01-01', '2023-01-02']
    Length: 2, dtype: period[D]
    i��periodarrayc�"�t|t�SrE)�
isinstancer,)�xs rM�<lambda>zPeriodArray.<lambda>�s��Z�	�;�&rO)rc��tSrE)r#�rIs rM�_scalar_typezPeriodArray._scalar_type�s���
rOz	list[str]�
_other_ops�is_leap_year�	_bool_ops)�
start_time�end_time�freq�_object_ops)�year�month�day�hour�minute�second�
weekofyear�weekday�week�	dayofweek�day_of_week�	dayofyear�day_of_year�quarter�qyear�
days_in_month�daysinmonth�
_field_ops�_datetimelike_ops)�strftime�to_timestamp�asfreq�_datetimelike_methodsr,�_dtypeNFc��|�;tjdtt���t	||�}t|�}|�*t
|�}t|t
�std|�d���t|t�r,|j}t|t|��s'td��t|t�r|j}t|t|��r?|�%||jk7rt||j ��|j"|j}}|st%j&|d��}nt%j(|d|��}|�td	��t+t
|�}t-j.|||�y)
Nz}The 'freq' keyword in the PeriodArray constructor is deprecated and will be removed in a future version. Pass 'dtype' instead)�
stacklevelzInvalid dtype z for PeriodArrayzIncorrect dtype�int64�rF�rF�copyz-dtype is not specified and cannot be inferred)�warnings�warn�
FutureWarningr(�validate_dtype_freqr,r*rX�
ValueErrorr/�_values�type�	TypeErrorr.rF�raise_on_incompatiblerc�_ndarray�np�asarray�arrayr
r�__init__)rI�valuesrFrcr�s     rMr�zPeriodArray.__init__�sA�����M�M�P��+�-�	
�'�u�d�3�D���%�E��� ��'�E��e�[�1� �>�%��8H�!I�J�J��f�i�(��^�^�F��f�d�4�j�1�� 1�2�2�
���
/��^�^�F��f�d�4�j�)�� �U�f�l�l�%:�+�F�E�J�J�?�?�"�O�O�V�\�\�E�F���Z�Z��g�6�F��X�X�f�G�$�?�F��=��L�M�M��[�%�(�����t�V�U�3rOc�z�d}t|tj�r|jdk(sJ|��|||��S)Nz Should be numpy array of type i8�i8r�)rXr��ndarrayrF)�clsr�rF�
assertion_msgs    rM�_simple_newzPeriodArray._simple_new
s:��;�
��&�"�*�*�-�&�,�,�$�2F�U�
�U�F��6��'�'rOr�c��|�t|�}|rt|t�r
|j}nd}t||�r*t	|j
|�|r|j
�}|Stj|t��}|xstj|�}tj||�}t|�}|||��S)Nr�)
r*rXr,rcr�rFr�r�r��object�	libperiod�extract_freq�extract_ordinals)r��scalarsrFr�rc�periods�ordinalss       rM�_from_sequencezPeriodArray._from_sequences����� ��'�E��Z��{�3��:�:�D��D��g�s�#���
�
�t�4��!�,�,�.���N��*�*�W�F�3���6�y�-�-�g�6���-�-�g�t�<���D�!���8�5�)�)rOc�*�|j|||��S)Nr�)r�)r��stringsrFr�s    rM�_from_sequence_of_stringsz%PeriodArray._from_sequence_of_strings4s���!�!�'��T�!�B�BrOc��t|t�r t|j|j�}t|||�\}}t
|�}|||��S)a
        Construct a PeriodArray from a datetime64 array

        Parameters
        ----------
        data : ndarray[datetime64[ns], datetime64[ns, tz]]
        freq : str or Tick
        tz : tzinfo, optional

        Returns
        -------
        PeriodArray[freq]
        r�)rXrr�nrLrr,)r��datarc�tzrFs     rM�_from_datetime64zPeriodArray._from_datetime64:sK���d�J�'�)�$�&�&�$�)�)�<�D�)�$��b�9�
��d��D�!���4�u�%�%rOc��tj|�}|�tj|�}|�|�t	||||�\}}||fStd��)Nz/Not enough parameters to construct Period range)�dtl�validate_periodsr#�_maybe_convert_freq�_get_ordinal_ranger�)r��start�endr�rc�subarrs      rM�_generate_rangezPeriodArray._generate_rangeOs`���&�&�w�/�����-�-�d�3�D�����-�e�S�'�4�H�L�F�D��t�|���N�O�OrOc�^�tdd|i|��\}}t|�}|j||��S)Nrcr��)�_range_from_fieldsr,r�)r��fieldsrcr�rFs     rM�_from_fieldszPeriodArray._from_fields]s5��)�>�t�>�v�>�����D�!�����v�U��3�3rOc��|turtj|j�St	||j
�r0|j
|�tj|j�Std|�d���)Nz!'value' should be a Period. Got 'z
' instead.)	rr�r�_valuerXr]�_check_compatible_with�ordinalr��rI�values  rM�
_unbox_scalarzPeriodArray._unbox_scalarisd���C�<��8�8�E�L�L�)�)�
��t�0�0�
1��'�'��.��8�8�E�M�M�*�*��@���z�R�S�SrOc�0�t||j��S)N)rc)r#rcr�s  rM�_scalar_from_stringzPeriodArray._scalar_from_stringvs���e�$�)�)�,�,rOc�L�|tury|j|j�yrE)r�_require_matching_freqrc�rI�others  rMr�z"PeriodArray._check_compatible_with|s ���C�<��	
�#�#�E�J�J�/rOc��|jSrE)r|r\s rMrFzPeriodArray.dtype�s���{�{�rOc�.�|jjS)zC
        Return the frequency object for this PeriodArray.
        �rFrcr\s rMrczPeriodArray.freq�s��
�z�z���rOc�j�t|jj|jj�SrE)rrcr�rLr\s rM�freqstrzPeriodArray.freqstr�s��%�d�i�i�k�k�4�9�9�>�>�B�BrOc��|dk(r|jS|tk(r
|jStjt|�t��S)Nr�r�)rH�bool�_isnanr�r��listr�)rIrFr�s   rM�	__array__zPeriodArray.__array__�s?���D�=��9�9��
�d�]��K�K�<���x�x��T�
�&�1�1rOc��ddl}ddlm}|��|jj	|�r,|j|j|j�|��St||�r?|j|jk7r5td|j�d|j�d���td|�d	���||j�}|j|j|j�d
��}|jj||�S)z6
        Convert myself into a pyarrow Array.
        rN)�ArrowPeriodType)�maskr�zENot supported to convert PeriodArray to array with different 'freq' (z vs �)z)Not supported to convert PeriodArray to 'z' typer)�pyarrow�(pandas.core.arrays.arrow.extension_typesr��types�
is_integerr�r�r1rXr�rcr�r>�from_storage)rIr�r�r��period_type�
storage_arrays      rM�__arrow_array__zPeriodArray.__arrow_array__�s���	�L����}�}�'�'��-��}�}�T�]�]�����4�}�P�P��D�/�2��<�<�4�9�9�,�#�#�#'�<�<�.��T�Y�Y�K�q�B���
 �?��v�V�L���&�d�l�l�3���
�
�d�m�m�$�)�)�+�G�
�T�
��%�%�2�2�;�
�N�NrOrez�
        The year of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
        >>> idx.year
        Index([2023, 2024, 2025], dtype='int64')
        rfz�
        The month as January=1, December=12.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.month
        Index([1, 2, 3], dtype='int64')
        rgz�
        The days of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(['2020-01-31', '2020-02-28'], freq='D')
        >>> idx.day
        Index([31, 28], dtype='int64')
        rhz�
        The hour of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-01 10:00", "2023-01-01 11:00"], freq='h')
        >>> idx.hour
        Index([10, 11], dtype='int64')
        ria
        The minute of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-01 10:30:00",
        ...                       "2023-01-01 11:50:00"], freq='min')
        >>> idx.minute
        Index([30, 50], dtype='int64')
        rja	
        The second of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-01 10:00:30",
        ...                       "2023-01-01 10:00:31"], freq='s')
        >>> idx.second
        Index([30, 31], dtype='int64')
        rma
        The week ordinal of the year.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.week  # It can be written `weekofyear`
        Index([5, 9, 13], dtype='int64')
        roz�
        The day of the week with Monday=0, Sunday=6.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-01", "2023-01-02", "2023-01-03"], freq="D")
        >>> idx.weekday
        Index([6, 0, 1], dtype='int64')
        rqa�
        The ordinal day of the year.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-10", "2023-02-01", "2023-03-01"], freq="D")
        >>> idx.dayofyear
        Index([10, 32, 60], dtype='int64')

        >>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
        >>> idx
        PeriodIndex(['2023', '2024', '2025'], dtype='period[Y-DEC]')
        >>> idx.dayofyear
        Index([365, 366, 365], dtype='int64')
        rrz�
        The quarter of the date.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.quarter
        Index([1, 1, 1], dtype='int64')
        rsrta�
        The number of days in the month.

        Examples
        --------
        For Series:

        >>> period = pd.period_range('2020-1-1 00:00', '2020-3-1 00:00', freq='M')
        >>> s = pd.Series(period)
        >>> s
        0   2020-01
        1   2020-02
        2   2020-03
        dtype: period[M]
        >>> s.dt.days_in_month
        0    31
        1    29
        2    31
        dtype: int64

        For PeriodIndex:

        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.days_in_month   # It can be also entered as `daysinmonth`
        Index([31, 28, 31], dtype='int64')
        c�R�ttj|j��S)z�
        Logical indicating if the date belongs to a leap year.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
        >>> idx.is_leap_year
        array([False,  True, False])
        )rr�r�rer\s rMr_zPeriodArray.is_leap_yearbs���b�j�j����3�4�4rOc��ddlm}tj|�}|dk(}|rp|dk(s|jdk(r.tdd�tdd�z
}|j
d�	�|zStdd�}||jzj
d�	�|z
S|�5|jj�}t|d�}|j}|}n!tj|�}|j}|j||�	�}	tj|	j |�}
|j"|
�}|jj$dk(r�t'j(|j �}t+|�dk(rQ|d}
|
|j,j.k(r|j|_|S|
dk(r|jj2|_|S|j5d
�S)a�
        Cast to DatetimeArray/Index.

        Parameters
        ----------
        freq : str or DateOffset, optional
            Target frequency. The default is 'D' for week or longer,
            's' otherwise.
        how : {'s', 'e', 'start', 'end'}
            Whether to use the start or end of the time period being converted.

        Returns
        -------
        DatetimeArray/Index

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.to_timestamp()
        DatetimeIndex(['2023-01-01', '2023-02-01', '2023-03-01'],
        dtype='datetime64[ns]', freq='MS')
        r)r<�E�B��D�nsr�)�how�infer)�pandas.core.arraysr<r��validate_end_aliasrcrryr|�_get_to_timestamp_baser�_freqstrr#r��_period_dtype_coderz�periodarr_to_dt64arrrHr�rL�libalgos�
unique_deltas�lenrF�_n�_freqrJ�
_with_freq)rIrcr�r<r��adjust�	freq_coderFrJ�new_parr�new_data�dta�diffs�diffs              rMryzPeriodArray.to_timestampos���.	5��*�*�3�/���S�j����s�{�d�i�i�3�.�"�1�c�*�Y�q�$�-?�?���(�(�W�(�5��>�>�"�1�d�+���t�y�y�(�6�6�7�6�C�f�L�L��<����:�:�<�I�#�I�q�1�E��>�>�D��D��-�-�d�3�D��*�*�D��;�;�t��;�-���1�1�(�-�-��F��*�m�*�*�8�4���9�9�>�>�S� ��*�*�4�9�9�5�E��5�z�Q���Q�x���4�:�:�=�=�(� $�	�	�C�I��J��Q�Y� $�	�	���C�I��J��>�>�'�*�*rOc�D�tj||j��S)N)r�rc)r#�
_from_ordinalrc)rIrYs  rM�	_box_funczPeriodArray._box_func�s���#�#�A�D�I�I�>�>rO�PeriodIndex)r��
other_namec��tj|�}t|t�r!t	|d�rt|�j}tj|�}|jj}|j}|j}|dk(}|r||jjzdz
}n|}t||||�}|j rt"||j$<t|�}	t'|�||	��S)a�
        Convert the {klass} to the specified frequency `freq`.

        Equivalent to applying :meth:`pandas.Period.asfreq` with the given arguments
        to each :class:`~pandas.Period` in this {klass}.

        Parameters
        ----------
        freq : str
            A frequency.
        how : str {{'E', 'S'}}, default 'E'
            Whether the elements should be aligned to the end
            or start within pa period.

            * 'E', 'END', or 'FINISH' for end,
            * 'S', 'START', or 'BEGIN' for start.

            January 31st ('END') vs. January 1st ('START') for example.

        Returns
        -------
        {klass}
            The transformed {klass} with the new frequency.

        See Also
        --------
        {other}.asfreq: Convert each Period in a {other_name} to the given frequency.
        Period.asfreq : Convert a :class:`~pandas.Period` object to the given frequency.

        Examples
        --------
        >>> pidx = pd.period_range('2010-01-01', '2015-01-01', freq='Y')
        >>> pidx
        PeriodIndex(['2010', '2011', '2012', '2013', '2014', '2015'],
        dtype='period[Y-DEC]')

        >>> pidx.asfreq('M')
        PeriodIndex(['2010-12', '2011-12', '2012-12', '2013-12', '2014-12',
        '2015-12'], dtype='period[M]')

        >>> pidx.asfreq('M', how='S')
        PeriodIndex(['2010-01', '2011-01', '2012-01', '2013-01', '2014-01',
        '2015-01'], dtype='period[M]')
        r�r�r�r�)r�r�rXr�hasattrr,r�r#r�r|rGr�rHrFr�r%�_hasnarr�r�)
rIrcr��base1�base2rHr�r�r�rFs
          rMrzzPeriodArray.asfreq�s���\�*�*�3�/���d�J�'�G�D�:N�,O��t�$�-�-�D��)�)�$�/�����'�'���'�'���y�y���S�j����T�Z�Z�]�]�*�Q�.�G��G�$�W�e�U�C�@���;�;�$(�H�T�[�[�!��D�!���t�D�z�(�%�0�0rOc�*�|rtSdjS)Nz'{}')�str�format)rI�boxeds  rM�
_formatterzPeriodArray._formatter�s����J��}�}�rOr)�na_rep�date_formatc�n�tj|j|jj||�S)z3
        actually format my specific types
        )r��period_array_strftimerHrFrG)rIrr�kwargss    rM�_format_native_typesz PeriodArray._format_native_typess.���.�.��I�I�t�z�z�-�-�v�{�
�	
rOTc����t|�}||jk(r|s|S|j�St|t�r|j|j�Stj|d�st|t�rPt|dd�}tj|�}|j�j|�j|�St �|�E||��S)N�Mr��r�)r*r|r�rXr,rzrcr
�is_np_dtyper+�getattrr��
dtype_to_unitry�tz_localize�as_unit�super�astype)rIrFr�r��unit�	__class__s     �rMrzPeriodArray.astypes�����U�#���D�K�K������y�y�{�"��e�[�)��;�;�u�z�z�*�*��?�?�5�#�&�*�U�O�*L����d�+�B��$�$�U�+�D��$�$�&�2�2�2�6�>�>�t�D�D��w�~�e�$�~�/�/rOc��|j|�jd�}|jjd�}|j|||��S)N�M8[ns])�side�sorter)�_validate_setitem_value�viewr��searchsorted)rIr�rr�npvalue�m8arrs      rMrzPeriodArray.searchsorted$sM���.�.�u�5�:�:�8�D���
�
�"�"�8�,���!�!�'��V�!�D�DrO)�limit�
limit_arear�c��|jd�}|j||||��}|r%td|j|j��S|S)Nr)�methodr r!r�r:)r�_pad_or_backfillr
rF)rIr#r r!r�r�rKs       rMr$zPeriodArray._pad_or_backfill1sT���i�i��!���%�%���:�D�&�
��������D�J�J� 7�8�8��KrOc���|�A|jd�}|j||||��}|j|j�St�|�||||��S)Nr)r�r#r r�)r�fillnarFr)rIr�r#r r�r�rKrs       �rMr&zPeriodArray.fillnaDs]������)�)�H�%�C��Z�Z�e�F�%�d�Z�S�F��;�;�t�z�z�*�*��w�~�E�&��D�~�Q�QrOc��|tjtjfvsJ�|tjur|}t|jtj|d���}t|�||j��S)z�
        Add or subtract array of integers.

        Parameters
        ----------
        other : np.ndarray[int64] or int
        op : {operator.add, operator.sub}

        Returns
        -------
        result : PeriodArray
        r�r�)	�operator�add�subrrHr�r�r�rF)rIr��op�
res_valuess    rM�_addsub_int_array_or_scalarz'PeriodArray._addsub_int_array_or_scalarTsd���h�l�l�H�L�L�1�1�1�1�
������F�E�%�d�i�i����E��1N�O�
��t�D�z�*�D�J�J�7�7rOc��t|t�rJ�|j|d��|j|jt
j�S)NT)rJ)rXrr�r-r�r(r)r�s  rM�_add_offsetzPeriodArray._add_offsetis@���e�T�*�*�*��#�#�E��#�5��/�/�������F�FrOc���t|jt�st||��t	|�rt
�|�|�Stjt|�j�}|j|�S)z�
        Parameters
        ----------
        other : timedelta, Tick, np.timedelta64

        Returns
        -------
        PeriodArray
        )rXrcrr�r1r�_add_timedeltalike_scalarr�r�r�asm8�_add_timedelta_arraylike)rIr��tdrs   �rMr1z%PeriodArray._add_timedeltalike_scalarpsa����$�)�)�T�*�'��e�4�4���;��7�4�U�;�;�
�Z�Z�	�%�(�-�-�
.���,�,�R�0�0rOc���|jj�std|j����tjd|jj�d��}	ttj|�|dd��}t|jtj|jd���}t|�||j�	�S#t$r}td�|�d}~wwxYw)
z�
        Parameters
        ----------
        other : TimedeltaArray or ndarray[timedelta64]

        Returns
        -------
        PeriodArray
        z2Cannot add or subtract timedelta64[ns] dtype from �m8[�]F�rFr��round_okznCannot add/subtract timedelta-like from PeriodArray that is not an integer multiple of the PeriodArray's freq.Nr�r�)
rF�
_is_tick_liker�r��
_td64_unitrr�r�r"rrHrr�)rIr�rF�delta�errr,s      rMr3z$PeriodArray._add_timedelta_arraylike�s����z�z�'�'�)��D�T�Z�Z�L�Q��
����3�t�z�z�4�4�5�Q�7�8��
	�'��
�
�5�!��U�U��E�&�d�i�i����E�J�J�t�<L�1M�N�
��t�D�z�*�D�J�J�7�7���	�(�E���
��	�s�!"C�	C2�!C-�-C2c��|jj�sJ�tjd|jj�d��}t	|t
tjtf�r)tjt|�j�}ntj|�}	t||dd��}|jd�}tj |�S#t$r}t||�|�d}~wwxYw)a<
        Arithmetic operations with timedelta-like scalars or array `other`
        are only valid if `other` is an integer multiple of `self.freq`.
        If the operation is valid, find that integer multiple.  Otherwise,
        raise because the operation is invalid.

        Parameters
        ----------
        other : timedelta, np.timedelta64, Tick,
                ndarray[timedelta64], TimedeltaArray, TimedeltaIndex

        Returns
        -------
        multiple : int or ndarray[int64]

        Raises
        ------
        IncompatibleFrequency
        r6r7Fr8Nr�)rFr:r�r;rXr�timedelta64rr�rr2rr�r�rr
�item_from_zerodim)rIr�rFr4r<r=s      rM� _check_timedeltalike_freq_compatz,PeriodArray._check_timedeltalike_freq_compat�s���(�z�z�'�'�)�)�)����3�t�z�z�4�4�5�Q�7�8���e�i�����>�?����I�e�,�1�1�2�B����E�"�B�	>�'��%�e�e�T�E��
�
�4� ���$�$�U�+�+��	�	>�'��e�4�#�=��	>�s�.C#�#	C>�,
C9�9C>)�returnztype[Period])NNF)rF�Dtype | Noner�r�rB�None)r�znpt.NDArray[np.int64]rFr,rBr:)rFrCr�r�rBr:rE)rBr:)r��dictrBr:)r��Period | NaTTyperBznp.int64)r�rrBr#)r�zPeriod | NaTType | PeriodArrayrBrD)rBr,)rBr)rBr)NN)rFzNpDtype | Noner�zbool | NonerBz
np.ndarray)rBznpt.NDArray[np.bool_])Nr�)r�rrBr<)rBrFr�)Nr�)r�rrBr:)F)rr�)rzstr | floatrBznpt.NDArray[np.object_])T)r�r�)�leftN)r�z$NumpyValueArrayLike | ExtensionArrayrzLiteral['left', 'right']rzNumpySorter | NonerBznpt.NDArray[np.intp] | np.intp)
r#r6r �
int | Noner!z#Literal['inside', 'outside'] | Noner�r�rBr:)NNNT)r rHr�r�rBr:)r�znp.ndarray | intr+zCallable[[Any, Any], Any]rBr:)r�r)r�z,TimedeltaArray | npt.NDArray[np.timedelta64]rBr:)LrP�
__module__�__qualname__rQ�__array_priority__�_typr�rr�_internal_fill_valuer#�_recognized_scalars�_is_recognized_dtype�_infer_matchesrRr]r^�__annotations__r`rdrvrwr{r��classmethodr�r�r�r�r�r�r�r�r�r&rFrcr�r�r�rTrerfrgrhrirjrkrmrornrlrprqrrrsrtrur_ryr�r'�_shared_doc_kwargsrzrr
rrr$r&r-r/r1r3rA�
__classcell__)rs@rMrBrBys����:�z���D�#�2�8�8�D�>��!�)����!�N�
�����J�	��*�+�I�y�+�?�K��?��J�	��&$.��#;�i�#G��y�G�'M��9�M���KP�'4�)�'4�CG�'4�	
�'4�T�(�%�(��(�
�	(��(��
#��*��	*�
�*�
�
*��*�6�/3�%�C� ,�C�;?�C�	
�C��C�
�&��&�(�����4��4�T��T�
�T�-�0����������C��C�AE�	2�#�	2�2=�	2�	�	2�O�<��	��D�
��	�
�E��
�	��C���	��D���		��F���		��F�!��	��J��D�!��	��K��I��G�-��	���I��$��	��G�
�G�$�E�#��	��M�: �K�
�
5��
5�@+�H?�	�M��M�]�}�M�C1�N�C1�P�(-�$�
�$�
�	 �
�0�.*0�%)�	E�3�E�'�E�#�	E�

(�E�"!�:>��
����	�
8���
�
��(OS�R�.8�R�GK�R�	
�R� 8�%�8�+D�8�	
�8�*G�1�*#8�A�#8�	
�#8�J#,rOc��t|tjtf�s|�d}nwt|t�r!t|j|j�}nFt|tttf�r
|j}ntt|��j}t|jj|jj�}tj t#|�j$||��}t'|�S)a>
    Helper function to render a consistent error message when raising
    IncompatibleFrequency.

    Parameters
    ----------
    left : PeriodArray
    right : None, DateOffset, Period, ndarray, or timedelta-like

    Returns
    -------
    IncompatibleFrequency
        Exception to be raised by the caller.
    N)r��own_freq�
other_freq)rXr�r�r0rrr�rLr.rBr#r�r rrcr!rr�rPr")rG�rightrWrV�msgs     rMr�r��s��� �%�"�*�*�&7�8�9�U�]��
�	�E�:�	&�+�E�G�G�U�Z�Z�@�
�	�E�N�K��@�	A��]�]�
�"�9�U�#3�4�<�<�
�%�d�i�i�k�k�4�9�9�>�>�B�H�
�
�
���J���(�z��C�!��%�%rOc�N�t|dd�}tj|d�rtj	||�St|t�r1t|�}|�"||jk(r|S|j|�S|St|tjtttf�st|�}tj|�}|rt
|�}nd}|jj dk(rt#|�dkDrt%d��|jj dvrD|j'tj(d�	�}t+j,||�}t||�
�St/|�}|�t+j0|�}t
|�}tj3||�
�S)a�
    Construct a new PeriodArray from a sequence of Period scalars.

    Parameters
    ----------
    data : Sequence of Period objects
        A sequence of Period objects. These are required to all have
        the same ``freq.`` Missing values can be indicated by ``None``
        or ``pandas.NaT``.
    freq : str, Tick, or Offset
        The frequency of every element of the array. This can be specified
        to avoid inferring the `freq` from `data`.
    copy : bool, default False
        Whether to ensure a copy of the data is made.

    Returns
    -------
    PeriodArray

    See Also
    --------
    PeriodArray
    pandas.PeriodIndex

    Examples
    --------
    >>> period_array([pd.Period('2017', freq='Y'),
    ...               pd.Period('2018', freq='Y')])
    <PeriodArray>
    ['2017', '2018']
    Length: 2, dtype: period[Y-DEC]

    >>> period_array([pd.Period('2017', freq='Y'),
    ...               pd.Period('2018', freq='Y'),
    ...               pd.NaT])
    <PeriodArray>
    ['2017', '2018', 'NaT']
    Length: 3, dtype: period[Y-DEC]

    Integers that look like years are handled

    >>> period_array([2000, 2001, 2002], freq='D')
    <PeriodArray>
    ['2000-01-01', '2001-01-01', '2002-01-01']
    Length: 3, dtype: period[D]

    Datetime-like strings may also be passed

    >>> period_array(['2000-Q1', '2000-Q2', '2000-Q3', '2000-Q4'], freq='Q')
    <PeriodArray>
    ['2000Q1', '2000Q2', '2000Q3', '2000Q4']
    Length: 4, dtype: period[Q-DEC]
    rFNrrNrz9PeriodIndex does not allow floating point in construction�iuFr
r�)rr
rrBr�rXr,rcrzr�r�r��tupler/r�rF�kindr�r�rrr��
from_ordinalsr)r�r�)	r�rcr��
data_dtype�out�arrdatarF�arrr�s	         rM�period_arrayrc�sh��t��w��-�J�
���z�3�'��+�+�D�$�7�7��*�k�*��$������z���&��
��:�:�d�#�#��
��d�R�Z�Z��u�i�@�A��D�z���j�j���G���D�!�����}�}���S� �S��\�A�%5��S�T�T��}�}���T�!��n�n�R�X�X�E�n�2���*�*�3��5���8�5�1�1���!�D��|��%�%�d�+�����E��%�%�d�%�%�8�8rOc��yrEr�r�s  rMr�r�W���rOc��yrEr�r�s  rMr�r�\rerOc���|�
t|d��}|�Pt|�}t|t�st	d��|�|j
}|S||j
k7rt
d��|S)at
    If both a dtype and a freq are available, ensure they match.  If only
    dtype is available, extract the implied freq.

    Parameters
    ----------
    dtype : dtype
    freq : DateOffset or None

    Returns
    -------
    freq : DateOffset

    Raises
    ------
    ValueError : non-period dtype
    IncompatibleFrequency : mismatch between dtype and freq
    T��	is_periodzdtype must be PeriodDtypez&specified freq and dtype are different)rr*rXr,r�rcr"r�s  rMr�r�asr��*�����.�����U�#���%��-��8�9�9��<��:�:�D�
�K�	�U�Z�Z�
�'�(P�Q�Q��KrOc�X�t|jtj�r|jjdk7rt	d|j����|�\t|t
�r|j|j}}nUt|t�rE|j|jj}}n"t|t
tf�r|j}t|j�}tj|�}|j}t|jd�|||��|fS)a�
    Convert an datetime-like array to values Period ordinals.

    Parameters
    ----------
    data : Union[Series[datetime64[ns]], DatetimeIndex, ndarray[datetime64ns]]
    freq : Optional[Union[str, Tick]]
        Must match the `freq` on the `data` if `data` is a DatetimeIndex
        or Series.
    tz : Optional[tzinfo]

    Returns
    -------
    ordinals : ndarray[int64]
    freq : Tick
        The frequency extracted from the Series or DatetimeIndex if that's
        used.

    rz
Wrong dtype: r�)�reso)rXrFr�r]r�r-r�rcr/�dtrr#r�r��c_dt64arr_to_periodarrr)r�rcr�rkrJs     rMrr�s���,�d�j�j�"�(�(�+�t�z�z���#�/E��=�����5�6�6��|��d�H�%����t�y�y�$�D�
��i�
(����t�w�w�|�|�$�D�	�D�8�Y�/�	0��|�|���t�z�z�*�D��%�%�d�+�D��"�"�D�!�$�)�)�D�/�4��$�G��M�MrOc��tj|||�dk7rtd��|�t|d��}|j}|�t||�}|�t||�}t
|t
�}t
|t
�}|r&|r$|j|jk7rtd��|tus|turtd��|�5|r
|j}n|r
|j}ntd��|j}|��||z}|�Htj|j|z
|z|jdz|tj�	�}||fStj|j|j|z|tj�	�}||fStj|j|jdz|tj�	�}||fS)
N�zOOf the three parameters: start, end, and periods, exactly two must be specifiedTrhz!start and end must have same freqzstart and end must not be NaTz#Could not infer freq from start/endr�r�)
�com�count_not_noner�rr�r#rXrcrr��aranger�r)r�r�r�rc�mult�is_start_per�
is_end_perr�s        rMr�r��s���
���%��g�.�!�3��
,�
�	
�
�����.���v�v�����u�d�#��
���S�$����e�V�,�L��C��(�J��
�u�z�z�S�X�X�'=��<�=�=���|�s�c�z��8�9�9��|���:�:�D�
��8�8�D��B�C�C��v�v�����D�.���=��9�9����g�%��,�c�k�k�A�o�t�2�8�8��D���:��
�9�9��
�
�u�}�}�w�6��B�H�H��D���:���y�y�������a���R�X�X�N����:�rOc�4�|�d}|�d}|�d}|�d}g}|��|�(tdd��}tjj}	nJt|d��}t	j
|�}	|	tjjk7rt
d��|j}
t||�\}}t||�D]M\}}tj|||
�\}
}t	j|
|dddddd|	�	}|j|��Onrt|d��}t	j
|�}	t||||||�}t|�D]5\}}}}}}|jt	j||||||dd|	�	��7tj|tj ��|fS)Nrr��QTrhzbase must equal FR_QTRr�)rr�FR_QTRr�r��freq_to_dtype_code�AssertionErrorr��_make_field_arrays�zipr�quarter_to_myear�period_ordinal�appendr�r�r)rerfrrrgrhrirjrcr�rJr��y�q�
calendar_year�calendar_month�val�arrays�mth�d�h�mn�ss                      rMr�r��s����|���
�~���
�~���
�{����H����<��S�D�1�D��#�#�)�)�D��T�T�2�D��/�/��5�D��y�'�'�-�-�-�$�%=�>�>��,�,��*�4��9�
��g���g�&�D�A�q�,3�,D�,D�Q��7�,S�)�M�>��*�*��~�q�!�Q��1�a���C�
�O�O�C� �'����.���+�+�D�1��#�D�%��d�F�F�K��#&��<��A�s�A�q�"�a��O�O�I�4�4�Q��Q��2�q�!�Q�PT�U�V�$0��8�8�H�B�H�H�-�t�3�3rOc	�x�d}|D]Q}t|ttjtf�s�)|�t|�|k7rt
d��|��Gt|�}�S|D�cgc]R}t|tjttf�rtj|�ntj||���Tc}Scc}w)NzMismatched Period array lengths)	rXr�r�r�r/r�r�r��repeat)r��lengthrYs   rMr{r{s���
�F�
���a�$��
�
�I�6�7��!�c�!�f��&6� �!B�C�C��~��Q�����	��A��a�"�*�*�d�I�6�7�	�
�
�1�
�
�Y�Y�q�&�
!�	"��	���s�AB7rE)rLrrSz
str | None)rBr")NF)r�z,Sequence[Period | str | None] | AnyArrayLikerczstr | Tick | BaseOffset | Noner�r�rBrB)rcr?rBr?)rcztimedelta | str | NonerBr)rcz1BaseOffsetT | BaseOffset | timedelta | str | NonerBr?)rBz(tuple[npt.NDArray[np.int64], BaseOffset])r�)rs�int)NNNNNNNN)rBztuple[np.ndarray, BaseOffset])rBzlist[np.ndarray])h�
__future__r�datetimerr(�typingrrrrr	r
rr��numpyr��pandas._libsrr�r
�pandas._libs.arraysr�pandas._libs.tslibsrrrrrrrrmrrrrr�r�pandas._libs.tslibs.dtypesrrr�pandas._libs.tslibs.fieldsr�pandas._libs.tslibs.offsetsrr �pandas._libs.tslibs.periodr!r"r#r$r%�pandas.util._decoratorsr&r'�pandas.util._exceptionsr(�pandas.core.dtypes.commonr)r*�pandas.core.dtypes.dtypesr+r,�pandas.core.dtypes.genericr-r.r/r0�pandas.core.dtypes.missingr1r�r2r��pandas.core.common�core�commonrp�collections.abcr3�pandas._typingr4r5r6r7r8r9r:r;r<r=�pandas.core.arrays.baser>r?rSrT�DatelikeOps�PeriodMixinrBr�rcr�r�r�r{r�rOrM�<module>r�s���"���������.�
�
�
�
���
6�����5�����,�2� � ��(�	�	�	��7��m�:�6���]���
�T
,�#�/�/�9�#8�#8�T
,�n&�L,0��`9�
6�`9�
(�`9��`9��	`9�F
��
��
��
��"�B�"��"�L�%N�-�%N�P.�d
�
���	
���	
�.4�#�.4�brO

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists