a
    OfӼ                  $   @  s6  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 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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.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z6 ddl7m8Z8 ddl9m:Z:m;Z; ddl<m=Z= er`ddl>m?Z?m@Z@ zddlAZBW n eCy   dZDY n0 [BdZDddlEZEzeEFd W n eEjGy   dZEY n0 ddddZHdddddddZIddddZJejKjLgZMe=ejNe=d kreMOejKjP ejQjRd!deSeMd" ejQTd! d#U D ]8ZVeWe'jXjYeVZZe[eZej\eZe]d$d%e^ d& qDd'U D ]DZVeWe'jXjYeVZZe[eZej\eZe]d(d)e^ ej]d*d+d,d- qd.U D ]DZVeWe'jXjYeVZZe[eZej\eZe]d/d0e^ ej]d*d+d,d1 qej_dd2ddd3d4Z`ej_dd2ddd5d6Zaej_g d7d8d9 d:d;d< ZbebZcej_d*d=gd>d9 d:d?d@ Zdej_g dAdBdCdD Zeej_g dAdBdEdF Zfej_ddgdBdGdH Zgej_g dIdBdJdK Zhej_g dLdBdMdN Ziej_g dOdBdPdQ Zjej_g dOdBdRdS Zkej_ddTdUdVdWdXejldYe"mdZd[gdBd\d] Znej_dTdUdVdWdXejldYe"mdZd[gdBd^d_ Zoej_ddgdBd`da Zpej_g dbdBdcdd Zqej_dedfgdBdgdh Zrej_e6jsdid9 d:djdk ZtetZuej_dejve'jwgdBdldm ZxexZyej_e6jzdnd9 d:dodp Z{e{Z|ej_e)e.gdBdqdr Z}ej_e:e.gdsdtgd:dudv Z~e~Zej_e:e.e'jgg dwd:dxdy Zej_e:e.e)e'jgdzd9 d:d{d| ZeZej_d}dd~dZej_ddddZej_dd Zej_ddddZej_ddddZdd Zdd Ze:dd edD e1ddde1dddde2dddde3dddde-de:eddde:eddde:eddde:eddde:eddde:eddde:eddde:eddde:eddde:eddde:ddgd) ede:ddgd) ede:ejddddejddd  e:ejddddejddd  e(edd e+ejdddde:g e;eg dg de e e:g de:eddde:eddde:eddde:ededde:e'jdd edD ddd ZeDrle:e'jdd edD ddZeed< ej_e dBdds ZeZej_dd e D dBdd ZeZej_dd e D dBdd Zej_ddddZej_ddddĄZej_ddddƄZddȄ Zddʄ e D Zej_dddd̄Zddʄ e6jD Zi eeeZej_e dBddτ Zddʄ e6jD Zi eeeeZej_e dBdd҄ Zej_ddddԄZej_ddddքZej_dddd؄Zej_e*dd)dٍe%ddڃfe*dddٍe%ddڃfe,dddߍdfe,dddߍdfe0ddde$dddfe/dddfgdBdd Zej_e6jdBdd Zej_eje8jeje8jeje8jeje8jeje8jeje8jeje8jejejejejejejeje8jeje8jeje8jgdBdd Zej_eje8jeje8jeje8jeje8jeje8jeje8jeje8jgdBdd Zg dZej_edBdd ZddgZej_edBdd Zee Zej_edBdd Zej_ejejejejejejgdBdd Zej_g ddBdd  Zej_g ddBdd Zg dZej_edBdd Zej_dd Zej_dd	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ZeEdure۠eEFdeEFdg dd eD Ze"ee݃ej_eed:dd Ze"eed*d ej_ed*d ed*d d:dd ZeZdd ee e	jgZeEdureOeEFd ej_edBd!d" ZeZej_g d#dBd$d% ZeZej_e6jdBd&d' Zej_dejlde"md(d[gdBd)d* Zej_d+ejld(e"md(d[ejld,e"md(d[gdBd-d. Zej_d/ejld(e"md(d[gdBd0d1 ZeZej_e6jdBd2d3 Zej_e6jdBd4d5 Zej_d6dejlde"md(d[ejld7e"md(d[gdBd8d9 Zej_e6jdBd:d; Zej_e6jdBd<d= Zej_d>dd?d@Zej_e6jdBdAdB Zej_e6jdBdCdD Zej_e6jdBdEdF Zej_e6jdBdGdH Zej_e6j dBdIdJ Zej_e6jdBdKdL Zej_e6jdBdMdN Zej_e6jdBdOdP Zej_e6jdBdQdR Z	ej_e6je6j dBdSdT Z
ej_e6je6j e6j e6j dBdUdV Zej_e6jdBdWdX Zej_e6jdBdYdZ Zej_e6jdBd[d\ Zej_e6jdBd]d^ Zej_e6jdBd_d` Zej_e6jdBdadb Zdcddejvdegfdcdde'jdegfdfdde'jwdegfdgdhejvdigfdjejvejvejvgfdjg fdkddejvdlgfdfddejvdmgfdndoejvdmgfdpd*ejvdlgfdqd*ejvdmgfdred*ejvedlgfddejvdgfdde'jdgfdsedtejvedugfdve0dwejve0dxgfdyedzd*d*ejved{d*d*gfd|d}ejvd~gfded*ejvedlgfded*ejvedlgfde,dze'jwe,d{gfde*dd*ejve*ddlgfgZee \ZZej_eed:dd Zej_dd Z ej_g ddBdd Z!ej_dd e'jYj"D dBdd Z#ej_ddd9 gdBdd Z$ej_dddejvejvejvfejve'jwdfejve'jdfe'je'je'jfgdBddddZ%ej_e6j&e6j'e6j(gdBdd Z)ej_e6j'e6j(gdBdd Z*ej_e6j&e6j(gdBdd Z+ej_e6j&e6j'gdBdd Z,ej_e6j-e6j'gdBdd Z.ej_e6j/e6j(gdBdd Z0ej_ddddZ1ej_ddddZ2ej_ddddZ3ej_ddddZ4ddgZ5eEdure5OeEFd ej_e5dBddddZ6e_ dd Z7d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)TYPE_CHECKINGCallable)tzlocaltzutc)
strategies)FixedOffsetutc_get_option)DatetimeTZDtypeIntervalDtype)CategoricalIndex	DataFrameIntervalIntervalIndexPeriod
RangeIndexSeries	Timedelta	Timestamp
date_rangeperiod_rangetimedelta_range)ops)Index
MultiIndex)Version)HashableIteratorFTUTCNonereturnc                 C  s   | j dddd d S )N--no-strict-data-filesstore_falsez6Don't fail if a test is skipped for missing data file.)actionhelp)Z	addoption)parser r0   H/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/conftest.pypytest_addoptiono   s
    r2   zpytest.Itemstr)itempathmessager*   c                 C  s(   | j |r$| tjd|  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endswithZ
add_markerpytestmarkfilterwarnings)r4   r5   r6   r0   r0   r1   ignore_doctest_warningw   s    r<   c                 C  sL   | dp|j ddd}g d}|rH| D ]}|D ]\}}t||| q0q(d S )Nz--doctest-modulesz--doctest-cythonF)default))Zis_int64_dtypezis_int64_dtype is deprecated)Zis_interval_dtypezis_interval_dtype is deprecated)Zis_period_dtypezis_period_dtype is deprecated)Zis_datetime64tz_dtypez#is_datetime64tz_dtype is deprecated)Zis_categorical_dtypez"is_categorical_dtype is deprecated)Z	is_sparsezis_sparse is deprecated)DataFrameGroupBy.fillnaz%DataFrameGroupBy.fillna is deprecated)NDFrame.replacezThe 'method' keyword)r?   zSeries.replace without 'value')zNDFrame.clipz4Downcasting behavior in Series and DataFrame methods)zSeries.idxminThe behavior of Series.idxmin)zSeries.idxmaxThe behavior of Series.idxmax)zSeriesGroupBy.fillnaz"SeriesGroupBy.fillna is deprecated)zSeriesGroupBy.idxminr@   )zSeriesGroupBy.idxmaxrA   )zmissing.mask_zero_div_zerozdivide by zero encountered)Zto_pydatetimez>The behavior of DatetimeProperties.to_pydatetime is deprecated)z pandas.core.generic.NDFrame.boolzY(Series|DataFrame).bool is now deprecated and will be removed in future version of pandas)z!pandas.core.generic.NDFrame.firstzqfirst is deprecated and will be removed in a future version. Please create a mask and filter using `.loc` instead)zResampler.fillnaz+DatetimeIndexResampler.fillna is deprecated)r>   z3DataFrameGroupBy.fillna with 'method' is deprecated)r>   z,DataFrame.fillna with 'method' is deprecated)Zread_parquetz1Passing a BlockManager to DataFrame is deprecated)	getoptionr<   )itemsconfigZ
is_doctestZignored_doctest_warningsr4   r5   r6   r0   r0   r1   pytest_collection_modifyitems   s    /rE   z6.83.2ci)deadlineZsuppress_health_checkz)MonthBegin MonthEnd BMonthBegin BMonthEndic   )n	normalizez%YearBegin YearEnd BYearBegin BYearEnd         )Z	min_valueZ	max_value)rI   rJ   monthz1QuarterBegin QuarterEnd BQuarterBegin BQuarterEndi   )rI   rJ   ZstartingMonth)Zautousec                 C  s   t | d< t| d< dS )z:
    Make `np` and `pd` names available for doctests.
    nppdN)rQ   rR   )Zdoctest_namespacer0   r0   r1   add_doctest_imports   s    rS   c                   C  s   t dd dS )z<
    Configure settings for all tests and test modules.
    Zchained_assignmentraiseN)rR   Z
set_optionr0   r0   r0   r1   configure_tests	  s    rU   )r   rM   indexcolumnsc                 C  s   dt |  S Nzaxis=reprxr0   r0   r1   <lambda>      r]   )paramsidsc                 C  s   | j S )z@
    Fixture for returning the axis numbers of a DataFrame.
    paramrequestr0   r0   r1   axis  s    re   rW   c                 C  s   dt |  S rX   rY   r[   r0   r0   r1   r]     r^   c                 C  s   | j S )zA
    Fixture for returning aliases of axis 1 of a DataFrame.
    ra   rc   r0   r0   r1   axis_1  s    rf   )TFN)r_   c                 C  s   | j S )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   r0   r0   r1   observed'  s    
rg   c                 C  s   | j S )z6
    Boolean 'ordered' parameter for Categorical.
    ra   rc   r0   r0   r1   ordered4  s    rh   c                 C  s   | j S )z%
    Boolean 'skipna' parameter.
    ra   rc   r0   r0   r1   skipna<  s    ri   )firstlastFc                 C  s   | j S )z[
    Valid values for the 'keep' parameter used in
    .duplicated or .drop_duplicates
    ra   rc   r0   r0   r1   keepD  s    rl   )bothneitherleftrightc                 C  s   | j S )zA
    Fixture for trying all interval 'inclusive' parameters.
    ra   rc   r0   r0   r1   inclusive_endpoints_fixtureM  s    rq   )ro   rp   rm   rn   c                 C  s   | j S )z<
    Fixture for trying all interval closed parameters.
    ra   rc   r0   r0   r1   closedU  s    rr   c                 C  s   | j S )zS
    Secondary closed fixture to allow parametrizing over all pairs of closed.
    ra   rc   r0   r0   r1   other_closed]  s    rs   gzipbz2zipxztarZzstdZ	zstandard)Zmarksc                 C  s   | j S )zK
    Fixture for trying common compression types in compression tests.
    ra   rc   r0   r0   r1   compressione  s    ry   c                 C  s   | j S )zk
    Fixture for trying common compression types in compression tests excluding
    uncompressed case.
    ra   rc   r0   r0   r1   compression_onlyw  s    rz   c                 C  s   | j S )z,
    Fixture that an array is writable.
    ra   rc   r0   r0   r1   writable  s    r{   )innerouterro   rp   c                 C  s   | j S )z:
    Fixture for trying all types of join operations.
    ra   rc   r0   r0   r1   	join_type  s    r~   nlargest	nsmallestc                 C  s   | j S )z1
    Fixture for trying all nselect methods.
    ra   rc   r0   r0   r1   nselect_method  s    r   c                 C  s
   t | jS Ntype__name__r[   r0   r0   r1   r]     r^   c                 C  s   | j S )z/
    Fixture for each null type in pandas.
    ra   rc   r0   r0   r1   nulls_fixture  s    r   c                 C  s   | j S )zL
    Fixture for each null type in pandas, each null type exactly once.
    ra   rc   r0   r0   r1   unique_nulls_fixture  s    r   c                 C  s
   t | jS r   r   r[   r0   r0   r1   r]     r^   c                 C  s   | j S )z-
    Fixture for each NaT type in numpy.
    ra   rc   r0   r0   r1   np_nat_fixture  s    r   c                 C  s   | j S )z;
    Fixture to parametrize over DataFrame and Series.
    ra   rc   r0   r0   r1   frame_or_series  s    r   rV   seriesc                 C  s   | j S )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   r0   r0   r1   index_or_series  s    
r   )rV   r   arrayc                 C  s   | j S )zG
    Fixture to parametrize over Index, Series, and ExtensionArray
    ra   rc   r0   r0   r1   index_or_series_or_array  s    r   c                 C  s   | j S r   )r   r[   r0   r0   r1   r]     r^   c                 C  s   | j S )z]
    Fixture to test behavior for Index, Series, DataFrame, and pandas Array
    classes
    ra   rc   r0   r0   r1   box_with_array  s    r   z
type[dict]c                  C  s   G dd dt } | S )z,
    Fixture for a dictionary subclass.
    c                   @  s   e Zd Zd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kwargsr0   r0   r1   r      s    z+dict_subclass.<locals>.TestSubDict.__init__N)r   
__module____qualname__r   r0   r0   r0   r1   TestSubDict  s   r   )r   )r   r0   r0   r1   dict_subclass  s    r   ztype[abc.Mapping]c                  C  s   G dd dt j} | S )z8
    Fixture for a non-mapping dictionary subclass.
    c                   @  s>   e Zd ZddddZdd Zdddd	Zd
dddZdS )z5non_dict_mapping_subclass.<locals>.TestNonDictMappingr(   r)   c                 S  s
   || _ d S r   )_data)r   Zunderlying_dictr0   r0   r1   r     s    z>non_dict_mapping_subclass.<locals>.TestNonDictMapping.__init__c                 S  s   | j |S r   )r   __getitem__)r   keyr0   r0   r1   r     s    zAnon_dict_mapping_subclass.<locals>.TestNonDictMapping.__getitem__r&   c                 S  s
   | j  S r   )r   __iter__r   r0   r0   r1   r     s    z>non_dict_mapping_subclass.<locals>.TestNonDictMapping.__iter__intc                 S  s
   | j  S r   )r   __len__r   r0   r0   r1   r     s    z=non_dict_mapping_subclass.<locals>.TestNonDictMapping.__len__N)r   r   r   r   r   r   r   r0   r0   r0   r1   TestNonDictMapping  s   r   )r   Mapping)r   r0   r0   r1   non_dict_mapping_subclass  s    r   c                  C  s   t tjddttdtdtdddd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      ABCDdtype
2000-01-01r   Bperiodsfreq)rW   rV   c                 S  s   | j S r   )yearr[   r0   r0   r1   r]   *  r^   zAmultiindex_year_month_day_dataframe_random_data.<locals>.<lambda>c                 S  s   | j S r   )rO   r[   r0   r0   r1   r]   *  r^   c                 S  s   | j S r   )dayr[   r0   r0   r1   r]   *  r^   c                 S  s   g | ]}| d qS )i8)astype).0Zlevr0   r0   r1   
<listcomp>,  r^   zCmultiindex_year_month_day_dataframe_random_data.<locals>.<listcomp>)r   rO   r   T)Zinplace)r   rQ   randomdefault_rngstandard_normalr"   listobjectr   groupbysumrV   Z
set_levelslevelsZ	set_names)ZtdfZymdr0   r0   r1   /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bazZquxonetwothree)
r   r   r   rM   rM   r   r      r   r   )
r   rM   r   r   rM   rM   r   r   rM   r   rj   second)r   codesnames)r#   r0   r0   r0   r1   %lexsorted_two_level_string_multiindex1  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 datar   )
   r   )Ar   Cexpr7   rV   rW   )r   rQ   r   r   r   r"   )r   rV   r0   r0   r1    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   rM   r   r   r   )r   rM   r   rM   r   rM   rj   r   F)r   r   r   Zverify_integrity)r"   rQ   r   r#   )Z
major_axisZ
minor_axisZmajor_codesZminor_codesZindex_namesr0   r0   r1   _create_multiindexJ  s    r   c                   C  s*   t jddgddgtddddgg d	d
S )zB
    MultiIndex with a level that is a tzaware DatetimeIndex.
    rM   r   ab20130101r   
US/Easternr   tzr   )r   )r#   Zfrom_productr   r0   r0   r0   r1   _create_mi_with_dt64tz_level^  s    r   c                 C  s   g | ]}d | qS Zpandas_r0   r   ir0   r0   r1   r   j  r^   r   r   z
2020-01-01)r   z
US/Pacificr   Dr   z1 day)startr   r   int8r   int16int32int64uint8uint16uint32uint64float32float64	complex64y              ?
complex128abcd   e   )num)r   r   r   )rM   r   r   )r   r   rM   rM   r   r   ZInt64ZUInt16ZFloat32booleanc                 C  s   g | ]}d | qS r   r0   r   r0   r0   r1   r     r^   zstring[python]) stringr   zdatetime-tzperiodr   ranger   r   r   r   r   r   r   r   r   r   zbool-object
bool-dtyper   r   Zcategoricalintervalemptytuplesmi-with-dt64tz-levelmultirepeatsZnullable_intZnullable_uintZnullable_floatZnullable_boolzstring-pythonc                 C  s   g | ]}d | qS r   r0   r   r0   r0   r1   r     r^   z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   r0   r0   r1   rV     s    c                 C  s   g | ]\}}t |ts|qS r0   )
isinstancer#   r   r   valuer0   r0   r1   r     s   c                 C  s   | j }t|  S )z8
    index fixture, but excluding MultiIndex cases.
    )rb   r   r   )rd   r   r0   r0   r1   
index_flat  s    	r   c                 C  s0   g | ](\}}| d s|dv st|ts|qS ))r   Zuintfloat)r   r   r   r   )
startswithr   r#   r   r0   r0   r1   r     s
   

c                 C  s   t | j jdd}|j }| jdv rh| }d|d dd  |d< d|d dd  |d< t|S d|d< d|d< t||S d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   rM   N)r   rb   r   valuestolistr#   from_tuplesr   )rd   indvalsr0   r0   r1   index_with_missing  s    


r  r   c                   C  s4   t tjdtjdd tdd tdD tdddS )zC
    Fixture for Series of floats with Index of unique strings
       r   g?c                 S  s   g | ]}d | qS )Zi_r0   r   r0   r0   r1   r     r^   z!string_series.<locals>.<listcomp>r   rV   r7   )r   rQ   aranger   r"   r   r   r0   r0   r0   r1   string_series  s
    r  c                  C  s<   dd t dD } tdd t dD td}t| |dtdS )zI
    Fixture for Series of dtype object with Index of unique strings
    c                 S  s   g | ]}d | qS Zfoo_r0   r   r0   r0   r1   r     r^   z!object_series.<locals>.<listcomp>r	  c                 S  s   g | ]}d | qS )Zbar_r0   r   r0   r0   r1   r     r^   r   objectsrV   r7   r   )r   r"   r   r   )datarV   r0   r0   r1   object_series  s    r  c                   C  s&   t tjddtddddddS )z9
    Fixture for Series of floats with DatetimeIndex
    r   r	  r   r   r   tsr
  )r   rQ   r   r   r   r   r0   r0   r0   r1   datetime_series  s
    r  c                 C  s*   t | }tjd|}t|| dddS )zHelper for the _series dictr   r   F)rV   r7   r   )lenrQ   r   r   r   r   )rV   sizer  r0   r0   r1   _create_series  s    r  c                 C  s"   i | ]\}}d | dt |qS )zseries-with-z-indexr  )r   Zindex_idrV   r0   r0   r1   
<dictcomp>  s   r  c                 C  s   t | S )zE
    Fixture for tests on series with changing types of indices.
    r  rV   r0   r0   r1   series_with_simple_index  s    r  c              	   C  s8   i | ]0}|j  d ttddd tdD d|dqS )-seriesr	  c                 S  s   g | ]}d | qS )zi-r0   r   r0   r0   r1   r     r^   z<dictcomp>.<listcomp>r   r  )r   r   r   r   r   r0   r0   r1   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   r0   r0   r1   index_or_series_obj$  s    r  c                 C  s   i | ]}|j  d t|qS )r  )r   r   r  r0   r0   r1   r  -  s   c                 C  s   t | j jddS )z
    Fixture for tests on indexes, series, series with a narrow dtype and
    series with empty objects type
    copy to avoid mutation, e.g. setting .name
    Tr   )_index_or_series_memory_objsrb   r   rc   r0   r0   r1   index_or_series_memory_obj:  s    r   c                   C  s<   t tjdtjdtdd tdD tdttdtddS )zj
    Fixture for DataFrame of ints with index of unique strings

    Columns are ['A', 'B', 'C', 'D']
    r	  r   r   c                 S  s   g | ]}d | qS r  r0   r   r0   r0   r1   r   P  r^   zint_frame.<locals>.<listcomp>r	  r   r   )r   rQ   Zonesr   r"   r   r   r   r0   r0   r0   r1   	int_frameG  s
    r"  c                   C  s6   t tjddtdd tdD ttddS )zm
    Fixture for DataFrame of floats with index of unique strings

    Columns are ['A', 'B', 'C', 'D'].
    r   r!  c                 S  s   g | ]}d | qS r  r0   r   r0   r0   r1   r   ^  r^   zfloat_frame.<locals>.<listcomp>r	  r   r   )r   rQ   r   r   r   r"   r   r   r0   r0   r0   r1   float_frameU  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dt| | dS )zF
    Fixture for Series with a DatetimeIndex that has duplicates.
    i  rM   r   r   r   rL   r  )r   r   rQ   r   r   r   r  )datesr0   r0   r1   (rand_series_with_duplicate_datetimeindexc  s    









r%  )ro   rp   rp   g?g      ?z2012-01M)r   z	period[M]z
2012-02-01z	period[D]z
2011-01-01r   )r   s)unitr   i  )secondsztimedelta64[ns]c                 C  s   | j S r   ra   rc   r0   r0   r1   ea_scalar_and_dtype{  s    r*  c                 C  s   | j S )zD
    Fixture for dunder names for common arithmetic operations.
    ra   rc   r0   r0   r1   all_arithmetic_operators  s    r+  c                 C  s   | j S )zU
    Fixture for operator and roperator arithmetic, comparison, and logical ops.
    ra   rc   r0   r0   r1   all_binary_operators  s    "r,  c                 C  s   | j S )z
    Fixture for operator and roperator arithmetic functions.

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

    * >=
    * >
    * <
    * <=
    ra   rc   r0   r0   r1   compare_operators_no_eq_ne  s    
r>  )__and____rand____or____ror____xor____rxor__c                 C  s   | j S )zY
    Fixture for dunder names for common logical operations

    * |
    * &
    * ^
    ra   rc   r0   r0   r1   all_logical_operators(  s    rE  )ZcumsumZcumprodZcumminZcummaxc                 C  s   | j S )z0
    Fixture for numeric accumulation names
    ra   rc   r0   r0   r1   all_numeric_accumulations9  s    rF  c                 C  s
   |  dS )zR
    Returns the configuration for the test setting `--no-strict-data-files`.
    r+   )rB   )Zpytestconfigr0   r0   r1   strict_data_filesD  s    rG  zCallable[..., str])rG  r*   c                   s(   t jt jtd  fdd}|S )aD  
    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 --no-strict-data-files option is not set.
    Ztestsc                    sJ   t jj g| R  }t j|sFr4td| dtd| d |S )NzCould not find file z' and --no-strict-data-files is not set.zCould not find .)osr5   joinexists
ValueErrorr9   skip)r   r5   Z	BASE_PATHrG  r0   r1   decoa  s    
zdatapath.<locals>.deco)rI  r5   rJ  dirname__file__)rG  rO  r0   rN  r1   datapathL  s    
rR  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 r0   rY   r   r0   r0   r1   r     r^   c                 C  s   | j S )zD
    Fixture for trying timezones including default (None): {0}
    ra   rc   r0   r0   r1   tz_naive_fixture  s    rT  c                 C  s   | j S )z4
    Fixture for trying explicit timezones: {0}
    ra   rc   r0   r0   r1   tz_aware_fixture  s    rU  r   zdateutil/UTCc                 C  s   | j S )zQ
    Fixture to provide variants of UTC timezone strings and tzinfo objects.
    ra   rc   r0   r0   r1   utc_fixture  s    rV  )r'  msusnsc                 C  s   | j S )z&
    datetime64 units we support.
    ra   rc   r0   r0   r1   r(    s    r(  c                 C  s   | j S )zR
    Parametrized fixture for string dtypes.

    * str
    * 'str'
    * 'U'
    ra   rc   r0   r0   r1   string_dtype  s    	rZ  pyarrowc                 C  s   | j S )za
    Parametrized fixture for string dtypes.

    * 'string[python]'
    * 'string[pyarrow]'
    ra   rc   r0   r0   r1   nullable_string_dtype  s    r\  pythonpyarrow_numpyc                 C  s   | j S )zx
    Parametrized fixture for pd.options.mode.string_storage.

    * 'python'
    * 'pyarrow'
    * 'pyarrow_numpy'
    ra   rc   r0   r0   r1   string_storage  s    r_  Znumpy_nullablec                 C  s   | j S )zb
    Parametrized fixture for pd.options.mode.string_storage.

    * 'python'
    * 'pyarrow'
    ra   rc   r0   r0   r1   dtype_backend  s    r`  c                 C  s   | j S )zK
    Parametrized fixture for bytes dtypes.

    * bytes
    * 'bytes'
    ra   rc   r0   r0   r1   bytes_dtype  s    ra  c                 C  s   | j S )zN
    Parametrized fixture for object dtypes.

    * object
    * 'object'
    ra   rc   r0   r0   r1   object_dtype  s    rb  r   zstring[pyarrow_numpy]c                 C  s   | j S )zo
    Parametrized fixture for string dtypes.
    * 'object'
    * 'string[python]'
    * 'string[pyarrow]'
    ra   rc   r0   r0   r1   any_string_dtype  s    rc  c                 C  s   | j S )z\
    Parametrized fixture for datetime64 dtypes.

    * 'datetime64[ns]'
    * 'M8[ns]'
    ra   rc   r0   r0   r1   datetime64_dtype-  s    rd  c                 C  s   | j S )z^
    Parametrized fixture for timedelta64 dtypes.

    * 'timedelta64[ns]'
    * 'm8[ns]'
    ra   rc   r0   r0   r1   timedelta64_dtype8  s    re  r   c                	   C  s   t ddddddddS )z-
    Fixture emits fixed Timestamp.now()
    i  rM   rN   r         )r   rO   r   hourminuter   microsecond)r   r0   r0   r0   r1   fixed_now_tsC  s    rk  c                 C  s   | j S )z^
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    ra   rc   r0   r0   r1   float_numpy_dtypeM  s    	rl  c                 C  s   | j S )zR
    Parameterized fixture for float dtypes.

    * 'Float32'
    * 'Float64'
    ra   rc   r0   r0   r1   float_ea_dtypeY  s    rm  c                 C  s   | j S )z~
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    * 'Float32'
    * 'Float64'
    ra   rc   r0   r0   r1   any_float_dtyped  s    rn  c                 C  s   | j S )zg
    Parameterized fixture for complex dtypes.

    * complex
    * 'complex64'
    * 'complex128'
    ra   rc   r0   r0   r1   complex_dtyper  s    	ro  c                 C  s   | j S )z|
    Parameterized fixture for signed integer dtypes.

    * int
    * 'int8'
    * 'int16'
    * 'int32'
    * 'int64'
    ra   rc   r0   r0   r1   any_signed_int_numpy_dtype~  s    rp  c                 C  s   | j S )zx
    Parameterized fixture for unsigned integer dtypes.

    * 'uint8'
    * 'uint16'
    * 'uint32'
    * 'uint64'
    ra   rc   r0   r0   r1   any_unsigned_int_numpy_dtype  s    
rq  c                 C  s   | j S )z
    Parameterized fixture for any integer dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    ra   rc   r0   r0   r1   any_int_numpy_dtype  s    rr  c                 C  s   | j S )z
    Parameterized fixture for any nullable integer dtype.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    ra   rc   r0   r0   r1   any_int_ea_dtype  s    rs  c                 C  s   | j S )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   r0   r0   r1   any_int_dtype  s    rt  c                 C  s   | j S )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   r0   r0   r1   any_numeric_ea_dtype  s    ru  c                 C  s   | j S )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   r0   r0   r1   any_numeric_ea_and_arrow_dtype  s     rv  c                 C  s   | j S )z~
    Parameterized fixture for any signed nullable integer dtype.

    * 'Int8'
    * 'Int16'
    * 'Int32'
    * 'Int64'
    ra   rc   r0   r0   r1   any_signed_int_ea_dtype  s    
rw  c                 C  s   | j S )z
    Parameterized fixture for any (purely) real numeric dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    ra   rc   r0   r0   r1   any_real_numpy_dtype  s    rx  c                 C  s   | j S )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   r0   r0   r1   any_real_numeric_dtype1  s    ry  c                 C  s   | j S )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   r0   r0   r1   any_numpy_dtypeH  s    "rz  c                 C  s   | j S )a  
    Parameterized fixture for all real dtypes that can hold NA.

    * float
    * 'float32'
    * 'float64'
    * 'Float32'
    * 'Float64'
    * 'UInt8'
    * 'UInt16'
    * 'UInt32'
    * 'UInt64'
    * 'Int8'
    * 'Int16'
    * 'Int32'
    * 'Int64'
    * 'uint8[pyarrow]'
    * 'uint16[pyarrow]'
    * 'uint32[pyarrow]'
    * 'uint64[pyarrow]'
    * 'int8[pyarrow]'
    * 'int16[pyarrow]'
    * 'int32[pyarrow]'
    * 'int64[pyarrow]'
    * 'float[pyarrow]'
    * 'double[pyarrow]'
    ra   rc   r0   r0   r1   any_real_nullable_dtypem  s    r{  c                 C  s   | j S )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   r0   r0   r1   any_numeric_dtype  s    r|  r   r   cmixedbytes   a   cr   zmixed-integerr   g       @Zfloatingg      ?integerzmixed-integer-floatdecimal
datetime64z
2013-01-01z
2018-01-01r   r   Z20180101r   i  i  complexy      ?      ?y       @       @r   r   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   rQ   r   r   )rd   Zinferred_dtyper  r0   r0   r1   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:)rD   )r9   importorskipZIPython.core.interactiveshellr  Ztraitlets.configr  ZHistoryManagerZ	hist_file)r  r  r}  r0   r0   r1   ip  s    r  )ZbsrZcooZcscZcsrZdiaZdokZlilc                 C  s   t d}t|| jd S )z-
    Yields scipy sparse matrix classes.
    zscipy.sparseZ_matrix)r9   r  getattrrb   )rd   sparser0   r0   r1   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  rR   offsetsr  )r   or0   r0   r1   r     s   c                 C  s   | j S )zN
    Fixture for Tick based datetime offsets available for a time series.
    ra   rc   r0   r0   r1   tick_classes  s    r  c                 C  s   | S r   r0   r[   r0   r0   r1   r]   ,  r^   c                 C  s   | j S )zk
    Simple fixture for testing keys in sorting methods.
    Tests None (no key) and the identity key.
    ra   rc   r0   r0   r1   sort_by_key,  s    r  )r   NN)ZEgonZVenkmanN)NCC1701Dr  r  z#tuple[Hashable, Hashable, Hashable]c                 C  s   | j S )zP
    A 3-tuple of names, the first two for operands, the last for a result.
    ra   rc   r0   r0   r1   r   5  s    r   c                 C  s   | j S )zI
    Parametrize over __setitem__, loc.__setitem__, iloc.__setitem__
    ra   rc   r0   r0   r1   indexer_sliH  s    r  c                 C  s   | j S )z<
    Parametrize over loc.__getitem__, iloc.__getitem__
    ra   rc   r0   r0   r1   
indexer_liP  s    r  c                 C  s   | j S )z8
    Parametrize over __setitem__, iloc.__setitem__
    ra   rc   r0   r0   r1   
indexer_siX  s    r  c                 C  s   | j S )z7
    Parametrize over __setitem__, loc.__setitem__
    ra   rc   r0   r0   r1   
indexer_sl`  s    r  c                 C  s   | j S )z:
    Parametrize over at.__setitem__, loc.__setitem__
    ra   rc   r0   r0   r1   
indexer_alh  s    r  c                 C  s   | j S )z<
    Parametrize over iat.__setitem__, iloc.__setitem__
    ra   rc   r0   r0   r1   indexer_ialp  s    r  boolc                   C  s   t ddddkS )z>
    Fixture to check if the array manager is being used.
    mode.data_managerTZsilentr   r   r0   r0   r0   r1   using_array_managerx  s    r  c                   C  s   t jjjdu otddddkS )z7
    Fixture to check if Copy-on-Write is enabled.
    Tr  r  blockrR   optionsmodeZcopy_on_writer   r0   r0   r0   r1   using_copy_on_write  s    r  c                   C  s   t jjjdkotddddkS )z?
    Fixture to check if Copy-on-Write is in warning mode.
    warnr  Tr  r  r  r0   r0   r0   r1   warn_copy_on_write  s    r  c                   C  s   t jjjdu S )z=
    Fixture to check if infer string option is enabled.
    T)rR   r  futureZinfer_stringr0   r0   r0   r1   using_infer_string  s    r  zEurope/Warsawzdateutil/Europe/Warsawc                 C  s   | j S )zE
    tzinfo for Europe/Warsaw using pytz, dateutil, or zoneinfo.
    ra   rc   r0   r0   r1   warsaw  s    r  c                   C  s   dS )N)r[  r^  r0   r0   r0   r0   r1   arrow_string_storage  s    r  (8  __doc__
__future__r   collectionsr   r   r   r   r   r   r  r	   operatorrI  typingr
   r   Zdateutil.tzr   r   Z
hypothesisr   stnumpyrQ   r9   Zpytzr   r   Zpandas._config.configr   Zpandas.util._test_decoratorsutilZ_test_decoratorstdZpandas.core.dtypes.dtypesr   r   ZpandasrR   r   r   r   r   r   r   r   r   r   r   r   r    Zpandas._testingZ_testingtmZpandas.corer!   Zpandas.core.indexes.apir"   r#   Zpandas.util.versionr$   collections.abcr%   r&   r[  paImportErrorZhas_pyarrowZzoneinfoZZoneInfoZZoneInfoNotFoundErrorr2   r<   rE   ZHealthCheckZtoo_slowZhypothesis_health_checks__version__appendZdiffering_executorssettingsZregister_profiletupleZload_profilesplitr7   r  Ztseriesr  clsZregister_type_strategyZbuildsZintegersZbooleansZfixturerS   rU   re   Z
axis_framerf   rg   rh   ri   rl   rq   rr   rs   rb   Z
skip_if_nory   rz   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   r   r  r   r  r   Zfrom_breaksZlinspacer  rv   r   r   idxkeysrV   Zindex_fixture2rC   r   Zindex_flat2r  r  r  r  r  Z_seriesr  ZNARROW_NP_DTYPESZ_narrow_seriesr  r  ZPYTHON_DATA_TYPESZ_typ_objects_seriesr  r   r"  r#  r%  r*  Zarithmetic_dunder_methodsr+  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_r,  r-  Z_all_numeric_reductionsr4  Z_all_boolean_reductionsr7  Z_all_reductionsr8  r9  r>  rE  Z_all_numeric_accumulationsrF  rG  rR  Z	TIMEZONESextendZTIMEZONE_IDSZparametrize_fixture_docr3   rT  rU  Ztz_aware_fixture2Z_UTCSrV  Zutc_fixture2r(  Zunit2ZSTRING_DTYPESrZ  r\  r_  r`  Zstring_storage2ZBYTES_DTYPESra  ZOBJECT_DTYPESrb  rc  ZDATETIME64_DTYPESrd  ZTIMEDELTA64_DTYPESre  rk  ZFLOAT_NUMPY_DTYPESrl  ZFLOAT_EA_DTYPESrm  ZALL_FLOAT_DTYPESrn  ZCOMPLEX_DTYPESro  ZSIGNED_INT_NUMPY_DTYPESrp  ZUNSIGNED_INT_NUMPY_DTYPESrq  ZALL_INT_NUMPY_DTYPESrr  ZALL_INT_EA_DTYPESrs  ZALL_INT_DTYPESrt  ru  ZALL_INT_PYARROW_DTYPES_STR_REPRZFLOAT_PYARROW_DTYPES_STR_REPRrv  ZSIGNED_INT_EA_DTYPESrw  ZALL_REAL_NUMPY_DTYPESrx  ZALL_REAL_DTYPESry  ZALL_NUMPY_DTYPESrz  ZALL_REAL_NULLABLE_DTYPESr{  ZALL_NUMERIC_DTYPESr|  ZNAr  Z_any_skipna_inferred_dtyper`   _r  r  r  __all__r  r  r   setitemlocZilocr  r  r  r  atr  Ziatr  r  r  r  r  Zwarsawsr  r  r0   r0   r0   r1   <module>   sB  8

	<






















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

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