o
    d                     @  s  d 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 ddlZddlZddlmZmZmZ ddlmZmZ ddlZdd	lmZ ddlZddlZdd
lmZmZ ddlm  m Z! ddl"m#Z#m$Z$ ddl%Z&ddl%m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- ddl.m/Z0 ddl1m2Z2 ddl3m4Z4m5Z5 zddl6Z7W n e8y   dZ9Y nw [7dZ9dZ:e-j;rddl:Z:ze:<d W n e:j=y   dZ:Y nw dddZ>dddZ?dddZ@ejAjBddejCjDfd  ejAEd d!F D ]ZGeHe&jIjJeGZKeLeKejMeKeNd"d#eO d$ qd%F D ]"ZGeHe&jIjJeGZKeLeKejMeKeNd&d'eO ejNd(d)d*d+ qd,F D ]"ZGeHe&jIjJeGZKeLeKejMeKeNd-d.eO ejNd(d)d*d/ q2ejPdd0d1ZQejPdd2dd3d4ZRejPg d5d6d7 d8d9d: ZSeSZTejPd(d;gd<d7 d8d=d> ZUejPg d?d@dAdB ZVejPg d?d@dCdD ZWejPddgd@dEdF ZXejPg dGd@dHdI ZYejPg dJd@dKdL ZZejPg dMd@dNdO Z[ejPg dMd@dPdQ Z\ejPddRdSdTdUdVej]dWe!^dXdYgd@dZd[ Z_ejPdRdSdTdUdVej]dWe!^dXdYgd@d\d] Z`ejPddgd@d^d_ ZaejPg d`d@dadb ZbejPdcddgd@dedf ZcejPe0jddgd7 d8dhdi ZeeeZfejPdejge&jhgd@djdk ZieiZjejPe0jkdld7 d8dmdn ZlelZmejPe'e*gd@dodp ZnejPe4e*gdqdrgd8dsdt ZoeoZpejPe4e*e&jqgg dud8dvdw ZrejPe4e*e'e&jqgdxd7 d8dydz ZsesZtejPd{d| ZuejPd}d~ ZvejPdd ZwejPdddZxejPdddZydd Zzdd Z{i de0|dde0}dde0j}dddde0~dde0dde0dde0jdddde0jdddde0jdddde0jdddde0jdddde0jdddde0jdddde0jdddde0jdddde0jdddde0dee4ejddk e0jdddde0jdddde0de0de4g e5eg dg de{ ez e4g de4eddde4eddde4eddde4ededde4e&jqe0|ddddZe9re4e&jqe0|dddZeed< ejPe d@ddq ZeZejPdd e D d@dd ZeZejPdd e D d@dd ZejPdddZejPdddZejPdddZdd Zdd e D ZejPdddZejPdddĄZdd e0jD Zi eeeZejPe d@ddǄ ZejPdddɄZejPddd˄ZejPddd̈́ZejPdddτZejPdddфZejPe(dd'dҍe$ddӃfe(dddҍe$ddӃfe)ddd؍dfe)ddd؍dfe,ddde#ddfe+dddfgd@dd Zg dZejPed@dd ZejPeje2jeje2jeje2jeje2jeje2jeje2jeje2jejejejejejejeje2jeje2jeje2jgd@dd ZejPeje2jeje2jeje2jeje2jeje2jeje2jeje2jgd@dd Zg dZejPed@dd ZddgZejPed@dd Zee ZejPed@dd ZejPejejejejejejgd@dd ZejPg dd@dd ZejPg dd@dd Zg dZejPed@dd ZejPdd  ZejPdddZejPdddZdddސdddd	d
dde e ededede	je	ed(de	eddddgZe:dure֠e:<de:<dg dd eD Ze!ee؃ejPeed8dd Ze!eed(d ejPed(d ed(d d8dd ZeZݐddee e	jgZe:durZeޠe:<d ejPed@dd ZeZejPe0jd@dd ZejPdej]de!^ddYgd@dd  ZejPd!ej]de!^ddYgd@d"d# ZejPd$ej]de!^ddYgd@d%d& ZeZejPe0jd@d'd( ZejPe0jd@d)d* ZejPd+dej]de!^ddYgd@d,d- ZejPe0jd@d.d/ ZejPe0jd@d0d1 ZejPdd3d4ZejPe0jd@d5d6 ZejPe0jd@d7d8 ZejPe0jd@d9d: ZejPe0jd@d;d< ZejPe0jd@d=d> ZejPe0jd@d?d@ ZejPe0jd@dAdB ZejPe0j d@dCdD ZejPe0jd@dEdF ZejPe0j e0j d@dGdH ZejPe0j e0j e0j e0j d@dIdJ ZejPe0jd@dKdL Z	ejPe0j
d@dMdN ZejPe0jd@dOdP ZejPe0jd@dQdR ZejPe0jd@dSdT ZddUejgdVgfddUe&jdVgfdWdUe&jhdVgfdXdYejgdZgfd[ejgejgejggfd[g fd\dUejgd]gfdWdUejgd^gfd_d`ejgd^gfdad(ejgd]gfdbd(ejgd^gfdced(ejged]gfddejgdgfdde&jdgfddedeejgedfgfde,dgejge,dhgfdiedjd(d(ejgedkd(d(gfded(ejged]gfdled(ejged]gfde)dje&jhe)dkgfdme(dd(ejge(dd]gfgZee \ZZejPeed8dndo ZejPdpdq ZejPg drd@dsdt ZejPdud e&jJjD d@dvdw ZejPddxd7 gd@dydz ZeP d{d| ZejPd}d~dejgejgejgfejge&jhdfejge&jdfe&je&je&jfgd@dddZejPe0je0j e0j!gd@dd Z"ejPe0j e0j!gd@dd Z#ejPe0je0j!gd@dd Z$ejPe0je0j gd@dd Z%ejPe0j&e0j gd@dd Z'ejPe0j(e0j!gd@dd Z)ejPdddZ*ejPdddZ+ddgZ,e:du
r.e,e:<d ejPe,d@dddZ-dS (  a  
This file is very long and growing, but it was decided to not split it yet, as
it's still manageable (2020-03-17, ~1.1k LoC). See gh-31989

Instead of splitting it was decided to define sections here:
- Configuration / Settings
- Autouse fixtures
- Common arguments
- Missing values & co.
- Classes
- Indices
- Series'
- DataFrames
- Operators & Operations
- Data sets/files
- Time zones
- Dtypes
- Misc
    )annotations)abc)datedatetimetime	timedeltatimezone)DecimalN)CallableHashableIterator)tzlocaltzutc)
strategies)FixedOffsetutc)DatetimeTZDtypeIntervalDtype)	DataFrameIntervalPeriodSeries	Timedelta	Timestampcompat)ops)Index
MultiIndexFTUTCreturnNonec                 C  sd   | j dddd | j dddd | j dddd | j d	dd
d | j dddd | j dddd d S )N--skip-slow
store_truezskip slow tests)actionhelp--skip-networkzskip network tests	--skip-dbzskip db testsz--run-high-memoryzrun high memory tests--only-slowzrun only slow tests--strict-data-filesz0Fail if a test is skipped for missing data file.)Z	addoption)parser r*   C/app/.heroku/python/lib/python3.10/site-packages/pandas/conftest.pypytest_addoptionh   s   
r,   itempytest.Itempathstrmessagec                 C  s,   | j |r| tjd|  dS dS )a  Ignore doctest warning.

    Parameters
    ----------
    item : pytest.Item
        pytest test item.
    path : str
        Module path to Python object, e.g. "pandas.core.frame.DataFrame.append". A
        warning will be filtered when item.name ends with in given path. So it is
        sufficient to specify e.g. "DataFrame.append".
    message : str
        Message to be filtered.
    zignore:N)nameendswith
add_markerpytestmarkfilterwarnings)r-   r/   r1   r*   r*   r+   ignore_doctest_warningw   s   r8   c                 C  s,  | d}| d}| d}| d}tjjd|dftjjd|dftjjd|dfg}d	g}| D ]c}| d
s>|j dddrT|tjd |D ]
\}	}
t||	|
 qId|j	v r`|tjj
 |D ] \}}}}||jv r|r}|tjd|   n|| qb|rd|jvr|tjd q0d S )Nr!   r'   r%   r&   slownetworkz	--networkdb)zmissing.mask_zero_div_zerozdivide by zero encounteredz--doctest-modulesz--doctest-cythonF)defaultadd_doctest_importsz/frame/zskipping due to zskipping due to --only-slow)	getoptionr5   r6   r9   r:   r;   r4   Zusefixturesr8   ZnodeidZarraymanagerkeywordsskip)itemsconfigZ	skip_slowZ	only_slowZskip_networkZskip_dbmarksZignored_doctest_warningsr-   r/   r1   r6   ZkwdZskip_if_foundZarg_namer*   r*   r+   pytest_collection_modifyitems   s<   







rD   ci)deadlineZsuppress_health_checkz)MonthBegin MonthEnd BMonthBegin BMonthEndic   )n	normalizez%YearBegin YearEnd BYearBegin BYearEnd         )Z	min_valueZ	max_value)rH   rI   monthz1QuarterBegin QuarterEnd BQuarterBegin BQuarterEndi   )rH   rI   ZstartingMonthc                 C  s   t | d< t| d< dS )z:
    Make `np` and `pd` names available for doctests.
    nppdN)rP   rQ   )Zdoctest_namespacer*   r*   r+   r=      s   r=   )Zautousec                   C  s   t dd dS )z<
    Configure settings for all tests and test modules.
    Zchained_assignmentraiseN)rQ   Z
set_optionr*   r*   r*   r+   configure_tests   s   rS   )r   rL   indexcolumnsc                 C     dt |  S Nzaxis=reprxr*   r*   r+   <lambda>       r\   )paramsidsc                 C     | j S )z@
    Fixture for returning the axis numbers of a DataFrame.
    paramrequestr*   r*   r+   axis      re   rU   c                 C  rV   rW   rX   rZ   r*   r*   r+   r\     r]   c                 C  r`   )zA
    Fixture for returning aliases of axis 1 of a DataFrame.
    ra   rc   r*   r*   r+   axis_1  rf   rg   )TFN)r^   c                 C  r`   )a  
    Pass in the observed keyword to groupby for [True, False]
    This indicates whether categoricals should return values for
    values which are not in the grouper [False / None], or only values which
    appear in the grouper [True]. [None] is supported for future compatibility
    if we decide to change the default (and would need to warn if this
    parameter is not passed).
    ra   rc   r*   r*   r+   observed     
rh   c                 C  r`   )z6
    Boolean 'ordered' parameter for Categorical.
    ra   rc   r*   r*   r+   ordered   rf   rj   c                 C  r`   )z%
    Boolean 'skipna' parameter.
    ra   rc   r*   r*   r+   skipna(  rf   rk   )firstlastFc                 C  r`   )z[
    Valid values for the 'keep' parameter used in
    .duplicated or .drop_duplicates
    ra   rc   r*   r*   r+   keep0     rn   )bothneitherleftrightc                 C  r`   )zA
    Fixture for trying all interval 'inclusive' parameters.
    ra   rc   r*   r*   r+   inclusive_endpoints_fixture9  rf   rt   )rr   rs   rp   rq   c                 C  r`   )z<
    Fixture for trying all interval closed parameters.
    ra   rc   r*   r*   r+   closedA  rf   ru   c                 C  r`   )zS
    Secondary closed fixture to allow parametrizing over all pairs of closed.
    ra   rc   r*   r*   r+   other_closedI  rf   rv   gzipbz2zipxztarZzstdZ	zstandard)rC   c                 C  r`   )zK
    Fixture for trying common compression types in compression tests.
    ra   rc   r*   r*   r+   compressionQ     r|   c                 C  r`   )zk
    Fixture for trying common compression types in compression tests excluding
    uncompressed case.
    ra   rc   r*   r*   r+   compression_onlyc  r}   r~   c                 C  r`   )z,
    Fixture that an array is writable.
    ra   rc   r*   r*   r+   writableu  rf   r   )innerouterrr   rs   c                 C  r`   )z:
    Fixture for trying all types of join operations.
    ra   rc   r*   r*   r+   	join_type}  rf   r   nlargest	nsmallestc                 C  r`   )z1
    Fixture for trying all nselect methods.
    ra   rc   r*   r*   r+   nselect_method  rf   r   c                 C  
   t | jS Ntype__name__rZ   r*   r*   r+   r\        
 c                 C  r`   )z/
    Fixture for each null type in pandas.
    ra   rc   r*   r*   r+   nulls_fixture  rf   r   c                 C  r`   )zL
    Fixture for each null type in pandas, each null type exactly once.
    ra   rc   r*   r*   r+   unique_nulls_fixture  rf   r   c                 C  r   r   r   rZ   r*   r*   r+   r\     r   c                 C  r`   )z-
    Fixture for each NaT type in numpy.
    ra   rc   r*   r*   r+   np_nat_fixture  rf   r   c                 C  r`   )z;
    Fixture to parametrize over DataFrame and Series.
    ra   rc   r*   r*   r+   frame_or_series  rf   r   rT   seriesc                 C  r`   )z
    Fixture to parametrize over Index and Series, made necessary by a mypy
    bug, giving an error:

    List item 0 has incompatible type "Type[Series]"; expected "Type[PandasObject]"

    See GH#29725
    ra   rc   r*   r*   r+   index_or_series  ri   r   )rT   r   arrayc                 C  r`   )zG
    Fixture to parametrize over Index, Series, and ExtensionArray
    ra   rc   r*   r*   r+   index_or_series_or_array  rf   r   c                 C  r`   r   )r   rZ   r*   r*   r+   r\         c                 C  r`   )z]
    Fixture to test behavior for Index, Series, DataFrame, and pandas Array
    classes
    ra   rc   r*   r*   r+   box_with_array  ro   r   c                  C  s   G dd dt } | S )z,
    Fixture for a dictionary subclass.
    c                   @  s   e Zd ZdddZdS )z"dict_subclass.<locals>.TestSubDictr   r    c                 _  s   t j| g|R i | d S r   )dict__init__)selfargskwargsr*   r*   r+   r     s   z+dict_subclass.<locals>.TestSubDict.__init__Nr   r    )r   
__module____qualname__r   r*   r*   r*   r+   TestSubDict  s    r   )r   )r   r*   r*   r+   dict_subclass  s   r   c                  C  s   G dd dt j} | S )z8
    Fixture for a non-mapping dictionary subclass.
    c                   @  s2   e Zd ZdddZdd Zddd	ZdddZdS )z5non_dict_mapping_subclass.<locals>.TestNonDictMappingr   r    c                 S  s
   || _ d S r   )_data)r   Zunderlying_dictr*   r*   r+   r        
z>non_dict_mapping_subclass.<locals>.TestNonDictMapping.__init__c                 S  s   | j |S r   )r   __getitem__)r   keyr*   r*   r+   r     s   zAnon_dict_mapping_subclass.<locals>.TestNonDictMapping.__getitem__r   c                 S  
   | j  S r   )r   __iter__r   r*   r*   r+   r     r   z>non_dict_mapping_subclass.<locals>.TestNonDictMapping.__iter__intc                 S  r   r   )r   __len__r   r*   r*   r+   r     r   z=non_dict_mapping_subclass.<locals>.TestNonDictMapping.__len__Nr   )r   r   )r   r   )r   r   r   r   r   r   r   r*   r*   r*   r+   TestNonDictMapping  s
    

r   )r   Mapping)r   r*   r*   r+   non_dict_mapping_subclass  s   r   c                  C  s^   t d} | dd dd dd g }|jdd |jjD |_|jjg dd	d
 |S )z
    DataFrame with 3 level MultiIndex (year, month, day) covering
    first 100 business days from 2000-01-01 with random data
    d   c                 S  r`   r   )yearrZ   r*   r*   r+   r\     r   zAmultiindex_year_month_day_dataframe_random_data.<locals>.<lambda>c                 S  r`   r   )rN   rZ   r*   r*   r+   r\     r   c                 S  r`   r   )dayrZ   r*   r*   r+   r\     r   c                 S  s   g | ]}| d qS )i8)astype).0Zlevr*   r*   r+   
<listcomp>  s    zCmultiindex_year_month_day_dataframe_random_data.<locals>.<listcomp>)r   rN   r   T)Zinplace)tmZmakeTimeDataFramegroupbysumrT   Z
set_levelslevelsZ	set_names)ZtdfZymdr*   r*   r+   /multiindex_year_month_day_dataframe_random_data  s
   
 r   r   c                   C  s*   t g dg dgg dg dgddgdS )z;
    2-level MultiIndex, lexsorted, with string names.
    foobarbazquxonetwothree)
r   r   r   rL   rL      r      r   r   )
r   rL   r   r   rL   rL   r   r   rL   r   rl   second)r   codesnames)r   r*   r*   r*   r+   %lexsorted_two_level_string_multiindex  s
   r   r   c                 C  s(   | }t tjdd|tg ddddS )z2DataFrame with 2 level MultiIndex with random data
   r   )ABCexpr2   )rT   rU   )r   rP   randomrandnr   )r   rT   r*   r*   r+    multiindex_dataframe_random_data%  s   r   c                  C  sT   t g d} t ddg}tg d}tg d}ddg}t| |g||g|dd	S )
zJ
    MultiIndex used to test the general functionality of this object
    r   r   r   )r   r   rL   r   r   r   )r   rL   r   rL   r   rL   rl   r   F)r   r   r   Zverify_integrity)r   rP   r   r   )Z
major_axisZ
minor_axisZmajor_codesZminor_codesZindex_namesr*   r*   r+   _create_multiindex0  s   r   c                   C  s,   t jddgddgtjddddgg d	d
S )zB
    MultiIndex with a level that is a tzaware DatetimeIndex.
    rL   r   ab20130101r   
US/Eastern)Zperiodstzr   )r   )r   Zfrom_productrQ   Z
date_ranger*   r*   r*   r+   _create_mi_with_dt64tz_levelD  s   r   stringr   r   zdatetime-tzz
US/Pacific)r   Zperiodr   rangeZint8dtypeZint16int32int64Zuint8Zuint16Zuint32Zuint64float32Zfloat64zbool-objectr   	complex64
complex128)r   r   r   )rL   r   r   )r   r   rL   rL   r   r   ZInt64ZUInt16ZFloat32booleanzstring[python])
bool-dtyper   r   Zcategoricalintervalemptytuplesmi-with-dt64tz-levelmultirepeatsZnullable_intZnullable_uintZnullable_floatZnullable_boolzstring-pythonzstring[pyarrow]zstring-pyarrowc                 C  s   t | j  S )z
    Fixture for many "simple" kinds of indices.

    These indices are unlikely to cover corner cases, e.g.
        - no names
        - no NaTs/NaNs
        - no values near implementation bounds
        - ...
    )indices_dictrb   copyrc   r*   r*   r+   rT   v  s   c                 C  s   g | ]\}}t |ts|qS r*   )
isinstancer   r   r   valuer*   r*   r+   r     s
    r   c                 C  s   | j }t|  S )z8
    index fixture, but excluding MultiIndex cases.
    )rb   r   r   )rd   r   r*   r*   r+   
index_flat  s   	r   c                 C  sD   g | ]\}}| d s| ds| ds|dv st|ts|qS )r   Zuintfloat)r   r   r   r   )
startswithr   r   r   r*   r*   r+   r     s    	c                 C  s   t | j jdd}|j}| jdv r2| }d|d dd  |d< d|d dd  |d< t|S d|d< d|d< t||S )	z
    Fixture for indices with missing values.

    Integer-dtype and empty cases are excluded because they cannot hold missing
    values.

    MultiIndex is excluded because isna() is not defined for MultiIndex.
    Tdeep)r   r   r   r   r   rL   N)r   rb   r   valuestolistr   from_tuplesr   )rd   indvalsr*   r*   r+   index_with_missing  s   

r   r   c                  C     t  } d| _| S )zC
    Fixture for Series of floats with Index of unique strings
    r   )r   ZmakeStringSeriesr2   sr*   r*   r+   string_series     r   c                  C  r   )zI
    Fixture for Series of dtype object with Index of unique strings
    objects)r   ZmakeObjectSeriesr2   r   r*   r*   r+   object_series  r   r   c                  C  r   )z9
    Fixture for Series of floats with DatetimeIndex
    ts)r   ZmakeTimeSeriesr2   r   r*   r*   r+   datetime_series  r   r  c                 C  s$   t | }tj|}t|| dddS )zHelper for the _series dictr   F)rT   r2   r   )lenrP   r   r   r   )rT   sizedatar*   r*   r+   _create_series  s   r  c                 C  s"   i | ]\}}d | dt |qS )zseries-with-z-indexr  )r   Zindex_idrT   r*   r*   r+   
<dictcomp>  s    r  c                 C  s   t | S )zE
    Fixture for tests on series with changing types of indices.
    r  rT   r*   r*   r+   series_with_simple_index  s   r	  c                  C  sH   g dg dg} t |  }t|}tjd}t||d}tj|d< |S )z:
    Fixture with a Series with a 2-level MultiIndex.
    )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r      r  r   )ry   r   r   rP   r   r   r   NaN)Zarraysr   rT   r  Zserr*   r*   r+   series_with_multilevel_index  s   

r  c                 C  s$   i | ]}|j  d tjd|dqS )z-seriesr   )r2   r   )r   r   Zmake_rand_series)r   r   r*   r*   r+   r    s    c                 C  s   t | j jddS )z|
    Fixture for tests on indexes, series and series with a narrow dtype
    copy to avoid mutation, e.g. setting .name
    Tr   )_index_or_series_objsrb   r   rc   r*   r*   r+   index_or_series_obj  s   r  c                   C  s   t t dS )a6  
    Fixture for DataFrame of ints with index of unique strings

    Columns are ['A', 'B', 'C', 'D']

                A  B  C  D
    vpBeWjM651  1  0  1  0
    5JyxmrP1En -1  0  0  0
    qEDaoD49U2 -1  1  0  0
    m66TkTfsFe  0  0  0  0
    EHPaNzEUFm -1  0 -1  0
    fpRJCevQhi  2  0  0  0
    OlQvnmfi3Q  0  0 -2  0
    ...        .. .. .. ..
    uB1FPlz4uP  0  0  0  1
    EcSe6yNzCU  0  0 -1  0
    L50VudaiI8 -1  1 -2  0
    y3bpw4nwIp  0 -1  0  0
    H0RdLLwrCT  1  1  0  0
    rY82K0vMwm  0  0  0  0
    1OPIUjnkjk  2  0  0  0

    [30 rows x 4 columns]
    r   )r   r   getSeriesDatar   r*   r*   r*   r+   	int_frame  s   r  c                   C     t t S )a  
    Fixture for DataFrame of floats with DatetimeIndex

    Columns are ['A', 'B', 'C', 'D']

                       A         B         C         D
    2000-01-03 -1.122153  0.468535  0.122226  1.693711
    2000-01-04  0.189378  0.486100  0.007864 -1.216052
    2000-01-05  0.041401 -0.835752 -0.035279 -0.414357
    2000-01-06  0.430050  0.894352  0.090719  0.036939
    2000-01-07 -0.620982 -0.668211 -0.706153  1.466335
    2000-01-10 -0.752633  0.328434 -0.815325  0.699674
    2000-01-11 -2.236969  0.615737 -0.829076 -1.196106
    ...              ...       ...       ...       ...
    2000-02-03  1.642618 -0.579288  0.046005  1.385249
    2000-02-04 -0.544873 -1.160962 -0.284071 -1.418351
    2000-02-07 -2.656149 -0.601387  1.410148  0.444150
    2000-02-08 -1.201881 -1.289040  0.772992 -1.445300
    2000-02-09  1.377373  0.398619  1.008453 -0.928207
    2000-02-10  0.473194 -0.636677  0.984058  0.511519
    2000-02-11 -0.965556  0.408313 -1.312844 -0.381948

    [30 rows x 4 columns]
    )r   r   ZgetTimeSeriesDatar*   r*   r*   r+   datetime_frame:     r  c                   C  r  )a  
    Fixture for DataFrame of floats with index of unique strings

    Columns are ['A', 'B', 'C', 'D'].

                       A         B         C         D
    P7GACiRnxd -0.465578 -0.361863  0.886172 -0.053465
    qZKh6afn8n -0.466693 -0.373773  0.266873  1.673901
    tkp0r6Qble  0.148691 -0.059051  0.174817  1.598433
    wP70WOCtv8  0.133045 -0.581994 -0.992240  0.261651
    M2AeYQMnCz -1.207959 -0.185775  0.588206  0.563938
    QEPzyGDYDo -0.381843 -0.758281  0.502575 -0.565053
    r78Jwns6dn -0.653707  0.883127  0.682199  0.206159
    ...              ...       ...       ...       ...
    IHEGx9NO0T -0.277360  0.113021 -1.018314  0.196316
    lPMj8K27FA -1.313667 -0.604776 -1.305618 -0.863999
    qa66YMWQa5  1.110525  0.475310 -0.747865  0.032121
    yOa0ATsmcE -0.431457  0.067094  0.096567 -0.264962
    65znX3uRNG  1.528446  0.160416 -0.109635 -0.032987
    eCOBvKqf3e  0.235281  1.622222  0.781255  0.392871
    xSucinXxuV -1.263557  0.252799 -0.552247  0.400426

    [30 rows x 4 columns]
    )r   r   r  r*   r*   r*   r+   float_frameW  r  r  c                	   C  s>   t dddtjdgd ddtjdgd ddd	tdd
S )z
    Fixture for DataFrame of float/int/string columns with RangeIndex
    Columns are ['a', 'b', 'c', 'float32', 'int32'].
          ?r   r   r   r   r   rL   r   )r   r   cr   r   r  )r   rP   r   aranger*   r*   r*   r+   mixed_type_framet  s   r  c                  C  s   t dddt dddt dddt dddt dddt dddt dddt dddt dddt dddg
} ttjt| | dS )zF
    Fixture for Series with a DatetimeIndex that has duplicates.
    i  rL   r   r      rK   r  )r   r   rP   r   r   r  )datesr*   r*   r+   (rand_series_with_duplicate_datetimeindex  s   









r  )rr   rs   rs   g?g      ?z2012-01M)freqz	period[M]z
2012-02-01Dz	period[D]z
2011-01-01r   i  )secondsztimedelta64[ns]c                 C  r`   r   ra   rc   r*   r*   r+   ea_scalar_and_dtype     r   )__add____radd____sub____rsub____mul____rmul____floordiv____rfloordiv____truediv____rtruediv____pow____rpow____mod____rmod__c                 C  r`   )zD
    Fixture for dunder names for common arithmetic operations.
    ra   rc   r*   r*   r+   all_arithmetic_operators  rf   r0  c                 C  r`   )zU
    Fixture for operator and roperator arithmetic, comparison, and logical ops.
    ra   rc   r*   r*   r+   all_binary_operators     "r1  c                 C  r`   )z
    Fixture for operator and roperator arithmetic functions.

    Notes
    -----
    This includes divmod and rdivmod, whereas all_arithmetic_operators
    does not.
    ra   rc   r*   r*   r+   all_arithmetic_functions  s   r3  )countr   maxminmeanprodZstdvarZmedianZkurtZskewZsemc                 C  r`   )z.
    Fixture for numeric reduction names.
    ra   rc   r*   r*   r+   all_numeric_reductions  rf   r:  allanyc                 C  r`   )z.
    Fixture for boolean reduction names.
    ra   rc   r*   r*   r+   all_boolean_reductions*  rf   r=  c                 C  r`   )z>
    Fixture for all (boolean + numeric) reduction names.
    ra   rc   r*   r*   r+   all_reductions5  rf   r>  c                 C  r`   )z;
    Fixture for operator module comparison functions.
    ra   rc   r*   r*   r+   comparison_op=  r!  r?  )__le____lt____ge____gt__c                 C  r`   )zm
    Fixture for dunder names for compare operations except == and !=

    * >=
    * >
    * <
    * <=
    ra   rc   r*   r*   r+   compare_operators_no_eq_neN  ri   rD  )__and____rand____or____ror____xor____rxor__c                 C  r`   )zY
    Fixture for dunder names for common logical operations

    * |
    * &
    * ^
    ra   rc   r*   r*   r+   all_logical_operators[     rK  )ZcumsumZcumprodZcumminZcummaxc                 C  r`   )z0
    Fixture for numeric accumulation names
    ra   rc   r*   r*   r+   all_numeric_accumulationsl  rf   rM  c                 C  s
   |  dS )zO
    Returns the configuration for the test setting `--strict-data-files`.
    r(   )r>   )Zpytestconfigr*   r*   r+   strict_data_filesw  s   
rN  Callable[..., str]c                   s(   t jt jtd  fdd}|S )a=  
    Get the path to a data file.

    Parameters
    ----------
    path : str
        Path to the file, relative to ``pandas/tests/``

    Returns
    -------
    path including ``pandas/tests``.

    Raises
    ------
    ValueError
        If the path doesn't exist and the --strict-data-files option is set.
    testsc                    sJ   t jj g| R  }t j|s#rtd| dtd| d |S )NzCould not find file z  and --strict-data-files is set.zCould not find .)osr/   joinexists
ValueErrorr5   r@   )r   r/   Z	BASE_PATHrN  r*   r+   deco  s   
zdatapath.<locals>.deco)rR  r/   rS  dirname__file__)rN  rW  r*   rV  r+   datapath  s   
rZ  c                 C  s   t | ddddS )z*
    The iris dataset as a DataFrame.
    ior  csvziris.csv)rQ   Zread_csv)rZ  r*   r*   r+   iris  s   r]  z
Asia/Tokyozdateutil/US/Pacificzdateutil/Asia/Singaporez+01:15z-02:15z	UTC+01:15z	UTC-02:15i,  i)hoursr   r   r   c                 C  s   g | ]}t |qS r*   rX   )r   ir*   r*   r+   r     s    c                 C  r`   )zD
    Fixture for trying timezones including default (None): {0}
    ra   rc   r*   r*   r+   tz_naive_fixture  ro   r`  c                 C  r`   )z4
    Fixture for trying explicit timezones: {0}
    ra   rc   r*   r*   r+   tz_aware_fixture  ro   ra  r   zdateutil/UTCc                 C  r`   )zQ
    Fixture to provide variants of UTC timezone strings and tzinfo objects.
    ra   rc   r*   r*   r+   utc_fixture  rf   rb  c                 C  r`   )zR
    Parametrized fixture for string dtypes.

    * str
    * 'str'
    * 'U'
    ra   rc   r*   r*   r+   string_dtype     	rc  pyarrowc                 C  r`   )za
    Parametrized fixture for string dtypes.

    * 'string[python]'
    * 'string[pyarrow]'
    ra   rc   r*   r*   r+   nullable_string_dtype     rf  pythonc                 C  r`   zb
    Parametrized fixture for pd.options.mode.string_storage.

    * 'python'
    * 'pyarrow'
    ra   rc   r*   r*   r+   string_storage
  rg  rj  Znumpy_nullablec                 C  r`   ri  ra   rc   r*   r*   r+   dtype_backend  rg  rk  c                 C  r`   )zK
    Parametrized fixture for bytes dtypes.

    * bytes
    * 'bytes'
    ra   rc   r*   r*   r+   bytes_dtype.     rl  c                 C  r`   )zN
    Parametrized fixture for object dtypes.

    * object
    * 'object'
    ra   rc   r*   r*   r+   object_dtype9  rm  rn  objectc                 C  r`   )zo
    Parametrized fixture for string dtypes.
    * 'object'
    * 'string[python]'
    * 'string[pyarrow]'
    ra   rc   r*   r*   r+   any_string_dtypeD  r!  rp  c                 C  r`   )z\
    Parametrized fixture for datetime64 dtypes.

    * 'datetime64[ns]'
    * 'M8[ns]'
    ra   rc   r*   r*   r+   datetime64_dtypeU  rm  rq  c                 C  r`   )z^
    Parametrized fixture for timedelta64 dtypes.

    * 'timedelta64[ns]'
    * 'm8[ns]'
    ra   rc   r*   r*   r+   timedelta64_dtype`  rm  rr  r   c                	   C  s   t ddddddddS )z-
    Fixture emits fixed Timestamp.now()
    i  rL   rM   r        )r   rN   r   hourminuter   microsecond)r   r*   r*   r*   r+   fixed_now_tsk  s   rx  c                 C  r`   )z^
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    ra   rc   r*   r*   r+   float_numpy_dtypeu  rd  ry  c                 C  r`   )zR
    Parameterized fixture for float dtypes.

    * 'Float32'
    * 'Float64'
    ra   rc   r*   r*   r+   float_ea_dtype  rm  rz  c                 C  r`   )z~
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    * 'Float32'
    * 'Float64'
    ra   rc   r*   r*   r+   any_float_dtype  rL  r{  c                 C  r`   )zg
    Parameterized fixture for complex dtypes.

    * complex
    * 'complex64'
    * 'complex128'
    ra   rc   r*   r*   r+   complex_dtype  rd  r|  c                 C  r`   )z|
    Parameterized fixture for signed integer dtypes.

    * int
    * 'int8'
    * 'int16'
    * 'int32'
    * 'int64'
    ra   rc   r*   r*   r+   any_signed_int_numpy_dtype  rL  r}  c                 C  r`   )zx
    Parameterized fixture for unsigned integer dtypes.

    * 'uint8'
    * 'uint16'
    * 'uint32'
    * 'uint64'
    ra   rc   r*   r*   r+   any_unsigned_int_numpy_dtype  ri   r~  c                 C  r`   )z
    Parameterized fixture for any integer dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    ra   rc   r*   r*   r+   any_int_numpy_dtype  r}   r  c                 C  r`   )z
    Parameterized fixture for any nullable integer dtype.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    ra   rc   r*   r*   r+   any_int_ea_dtype  r!  r  c                 C  r`   )a.  
    Parameterized fixture for any nullable integer dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    ra   rc   r*   r*   r+   any_int_dtype  s   r  c                 C  r`   )z
    Parameterized fixture for any nullable integer dtype and
    any float ea dtypes.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    * 'Float32'
    * 'Float64'
    ra   rc   r*   r*   r+   any_numeric_ea_dtype  s   r  c                 C  r`   )a  
    Parameterized fixture for any nullable integer dtype and
    any float ea dtypes.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    * 'Float32'
    * 'Float64'
    * 'uint8[pyarrow]'
    * 'int8[pyarrow]'
    * 'uint16[pyarrow]'
    * 'int16[pyarrow]'
    * 'uint32[pyarrow]'
    * 'int32[pyarrow]'
    * 'uint64[pyarrow]'
    * 'int64[pyarrow]'
    * 'float32[pyarrow]'
    * 'float64[pyarrow]'
    ra   rc   r*   r*   r+   any_numeric_ea_and_arrow_dtype  s    r  c                 C  r`   )z~
    Parameterized fixture for any signed nullable integer dtype.

    * 'Int8'
    * 'Int16'
    * 'Int32'
    * 'Int64'
    ra   rc   r*   r*   r+   any_signed_int_ea_dtype7  ri   r  c                 C  r`   )z
    Parameterized fixture for any (purely) real numeric dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    ra   rc   r*   r*   r+   any_real_numpy_dtypeD  s   r  c                 C  r`   )a  
    Parameterized fixture for any (purely) real numeric dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'

    and associated ea dtypes.
    ra   rc   r*   r*   r+   any_real_numeric_dtypeY  s   r  c                 C  r`   )a  
    Parameterized fixture for all numpy dtypes.

    * bool
    * 'bool'
    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    * complex
    * 'complex64'
    * 'complex128'
    * str
    * 'str'
    * 'U'
    * bytes
    * 'bytes'
    * 'datetime64[ns]'
    * 'M8[ns]'
    * 'timedelta64[ns]'
    * 'm8[ns]'
    * object
    * 'object'
    ra   rc   r*   r*   r+   any_numpy_dtypep  r2  r  c                 C  r`   )a  
    Parameterized fixture for all numeric dtypes.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    * complex
    * 'complex64'
    * 'complex128'
    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    * 'Float32'
    * 'Float64'
    ra   rc   r*   r*   r+   any_numeric_dtype  s   r  r   r  mixedbytes   a   cr   zmixed-integerr   g       @Zfloatingr  integerzmixed-integer-floatdecimal
datetime64z
2013-01-01z
2018-01-01r   Z20180101r   i  i  r   r   c                 C  s    | j \}}tj|td}||fS )a  
    Fixture for all inferred dtypes from _libs.lib.infer_dtype

    The covered (inferred) types are:
    * 'string'
    * 'empty'
    * 'bytes'
    * 'mixed'
    * 'mixed-integer'
    * 'mixed-integer-float'
    * 'floating'
    * 'integer'
    * 'decimal'
    * 'boolean'
    * 'datetime64'
    * 'datetime'
    * 'date'
    * 'timedelta'
    * 'time'
    * 'period'
    * 'interval'

    Returns
    -------
    inferred_dtype : str
        The string for the inferred dtype from _libs.lib.infer_dtype
    values : np.ndarray
        An array of object dtype that will be inferred to have
        `inferred_dtype`

    Examples
    --------
    >>> from pandas._libs import lib
    >>>
    >>> def test_something(any_skipna_inferred_dtype):
    ...     inferred_dtype, values = any_skipna_inferred_dtype
    ...     # will pass
    ...     assert lib.infer_dtype(values, skipna=True) == inferred_dtype
    r   )rb   rP   r   ro  )rd   Zinferred_dtyper   r*   r*   r+   any_skipna_inferred_dtype  s   
)r  c                  C  s>   t jddd ddlm}  ddlm} | }d|j_| |dS )	zj
    Get an instance of IPython.InteractiveShell.

    Will raise a skip if IPython is not installed.
    ZIPythonz6.0.0)Z
minversionr   )InteractiveShell)Configz:memory:)rB   )r5   importorskipZIPython.core.interactiveshellr  Ztraitlets.configr  ZHistoryManagerZ	hist_file)r  r  r  r*   r*   r+   ip	  s   
r  )ZbsrZcooZcscZcsrZdiaZdokZlilc                 C  s   ddl m} t|| jd S )z-
    Yields scipy sparse matrix classes.
    r   )sparseZ_matrix)Zscipyr  getattrrb   )rd   r  r*   r*   r+   spmatrix  s   r  c                 C  s6   g | ]}t ttj|tjjr|d krttj|qS )Tick)
issubclassr  rQ   offsetsr  )r   or*   r*   r+   r   '  s    
c                 C  r`   )zN
    Fixture for Tick based datetime offsets available for a time series.
    ra   rc   r*   r*   r+   tick_classes&  rL  r  c                 C  s   | S r   r*   rZ   r*   r*   r+   r\   4  s    c                 C  r`   )zk
    Simple fixture for testing keys in sorting methods.
    Tests None (no key) and the identity key.
    ra   rc   r*   r*   r+   sort_by_key4  ro   r  c                  c  sz    t d ddlm}  ddlm} ddlm} G dd d|}| d|d	d
 | V  |dd  d |j	d< |j
  d S )Nfsspecr   )register_implementation)MemoryFileSystem)	_registryc                      s(   e Zd ZdZdgZd fddZ  ZS )z fsspectest.<locals>.TestMemoryFStestmemNr   r    c                   s(   | dd | jd< t jdi | d S )Ntestr   r*   )popr  superr   )r   r   	__class__r*   r+   r   H  s   z)fsspectest.<locals>.TestMemoryFS.__init__r   )r   r   r   protocolr  r   __classcell__r*   r*   r  r+   TestMemoryFSD  s    r  r  T)clobber)r5   r  r  r  Zfsspec.implementations.memoryr  Zfsspec.registryr  r  r  storeclear)r  r  registryr  r*   r*   r+   
fsspectest=  s   

r  )r   NN)ZEgonZVenkmanN)NCC1701Dr  r  #tuple[Hashable, Hashable, Hashable]c                 C  r`   )zP
    A 3-tuple of names, the first two for operands, the last for a result.
    ra   rc   r*   r*   r+   r   S  s   r   c                 C  r`   )zI
    Parametrize over __setitem__, loc.__setitem__, iloc.__setitem__
    ra   rc   r*   r*   r+   indexer_slif  rf   r  c                 C  r`   )z<
    Parametrize over loc.__getitem__, iloc.__getitem__
    ra   rc   r*   r*   r+   
indexer_lin  rf   r  c                 C  r`   )z8
    Parametrize over __setitem__, iloc.__setitem__
    ra   rc   r*   r*   r+   
indexer_siv  rf   r  c                 C  r`   )z7
    Parametrize over __setitem__, loc.__setitem__
    ra   rc   r*   r*   r+   
indexer_sl~  rf   r  c                 C  r`   )z:
    Parametrize over at.__setitem__, loc.__setitem__
    ra   rc   r*   r*   r+   
indexer_al  rf   r  c                 C  r`   )z<
    Parametrize over iat.__setitem__, iloc.__setitem__
    ra   rc   r*   r*   r+   indexer_ial  rf   r  boolc                   C  s   t jjjdkS )z>
    Fixture to check if the array manager is being used.
    r   )rQ   optionsmodedata_managerr*   r*   r*   r+   using_array_manager  s   r  c                   C  s   t jjjot jjjdkS )z7
    Fixture to check if Copy-on-Write is enabled.
    block)rQ   r  r  Zcopy_on_writer  r*   r*   r*   r+   using_copy_on_write  s   r  zEurope/Warsawzdateutil/Europe/Warsawc                 C  r`   )zE
    tzinfo for Europe/Warsaw using pytz, dateutil, or zoneinfo.
    ra   rc   r*   r*   r+   warsaw  rf   r  r   )r-   r.   r/   r0   r1   r0   r   r    )r   r   )r   r   )r   r   )rN  r0   r   rO  )r   r   )r   r  )r   r  )r   r0   (.  __doc__
__future__r   collectionsr   r   r   r   r   r   r  r	   operatorrR  typingr
   r   r   Zdateutil.tzr   r   Z
hypothesisr   stnumpyrP   r5   Zpytzr   r   Zpandas.util._test_decoratorsutilZ_test_decoratorstdZpandas.core.dtypes.dtypesr   r   ZpandasrQ   r   r   r   r   r   r   r   Zpandas._testingZ_testingr   Zpandas.corer   Zpandas.core.indexes.apir   r   re  paImportErrorZhas_pyarrowZzoneinfoZPY39ZZoneInfoZZoneInfoNotFoundErrorr,   r8   rD   settingsZregister_profileZHealthCheckZtoo_slowZload_profilesplitr2   r  Ztseriesr  clsZregister_type_strategyZbuildsZintegersZbooleansZfixturer=   rS   re   Z
axis_framerg   rh   rj   rk   rn   rt   ru   rv   rb   Z
skip_if_nor|   r~   r   r   r   ZNULL_OBJECTSr   Znulls_fixture2nanZNaTr   Zunique_nulls_fixture2ZNP_NAT_OBJECTSr   Znp_nat_fixture2r   r   Zindex_or_series2r   r   r   Zbox_with_array2r   r   r   r   r   r   r   ZmakeStringIndexZmakeDateIndexZmakePeriodIndexZmakeTimedeltaIndexZmakeRangeIndexZmakeIntIndexZmakeUIntIndexZmakeFloatIndexZmakeBoolIndexr   ro  r   r   ZmakeNumericIndexZmakeCategoricalIndexZmakeIntervalIndexr   ry   r  r  r   idxkeysrT   Zindex_fixture2rA   r   Zindex_flat2r   r   r   r  r  Z_seriesr	  r  ZNARROW_NP_DTYPESZ_narrow_seriesr  r  r  r  r  r  r  r   Z_all_arithmetic_operatorsr0  addZraddsubZrsubmulZrmultruedivZrtruedivfloordivZ	rfloordivmodZrmodpowZrpoweqneltlegtgeand_Zrand_xorZrxoror_Zror_r1  r3  Z_all_numeric_reductionsr:  Z_all_boolean_reductionsr=  Z_all_reductionsr>  r?  rD  rK  Z_all_numeric_accumulationsrM  rN  rZ  r]  Z	TIMEZONESextendZTIMEZONE_IDSZparametrize_fixture_docr0   r`  ra  Ztz_aware_fixture2Z_UTCSappendrb  Zutc_fixture2ZSTRING_DTYPESrc  rf  rj  rk  Zstring_storage2ZBYTES_DTYPESrl  ZOBJECT_DTYPESrn  rp  ZDATETIME64_DTYPESrq  ZTIMEDELTA64_DTYPESrr  rx  ZFLOAT_NUMPY_DTYPESry  ZFLOAT_EA_DTYPESrz  ZALL_FLOAT_DTYPESr{  ZCOMPLEX_DTYPESr|  ZSIGNED_INT_NUMPY_DTYPESr}  ZUNSIGNED_INT_NUMPY_DTYPESr~  ZALL_INT_NUMPY_DTYPESr  ZALL_INT_EA_DTYPESr  ZALL_INT_DTYPESr  r  ZALL_INT_PYARROW_DTYPES_STR_REPRZFLOAT_PYARROW_DTYPES_STR_REPRr  ZSIGNED_INT_EA_DTYPESr  ZALL_REAL_NUMPY_DTYPESr  ZALL_REAL_DTYPESr  ZALL_NUMPY_DTYPESr  ZALL_NUMERIC_DTYPESr  ZNAr  Z_any_skipna_inferred_dtyper_   _r  r  r  __all__r  r  r  r   setitemlocZilocr  r  r  r  atr  Ziatr  r  r  Zwarsawsr  r*   r*   r*   r+   <module>   s,   $	
1




































	

"

	
			



















!









	
$#$$2	
