o
    թZhӼ                     @  s8  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rddl>m?Z?m@Z@ zddlAZBW n eCy   dZDY nw [BdZDddlEZEzeEFd W n eEjGy   dZEY nw dddZHdddZIdd d!ZJejKjLgZMe=ejNe=d"kreMOejKjP ejQjRd#deSeMd$ ejQTd# d%U D ]ZVeWe'jXjYeVZZe[eZej\eZe]d&d'e^ d( qd)U D ]"ZVeWe'jXjYeVZZe[eZej\eZe]d*d+e^ ej]d,d-d.d/ q:d0U D ]"ZVeWe'jXjYeVZZe[eZej\eZe]d1d2e^ ej]d,d-d.d3 qaej_dd4dd5d6Z`ej_dd4dd7d8Zaej_g d9d:d; d<d=d> ZbebZcej_d,d?gd@d; d<dAdB Zdej_g dCdDdEdF Zeej_g dCdDdGdH Zfej_ddgdDdIdJ Zgej_g dKdDdLdM Zhej_g dNdDdOdP Ziej_g dQdDdRdS Zjej_g dQdDdTdU Zkej_ddVdWdXdYdZejld[e"md\d]gdDd^d_ Znej_dVdWdXdYdZejld[e"md\d]gdDd`da Zoej_ddgdDdbdc Zpej_g dddDdedf Zqej_dgdhgdDdidj Zrej_e6jsdkd; d<dldm ZtetZuej_dejve'jwgdDdndo ZxexZyej_e6jzdpd; d<dqdr Z{e{Z|ej_e)e.gdDdsdt Z}ej_e:e.gdudvgd<dwdx Z~e~Zej_e:e.e'jgg dyd<dzd{ Zej_e:e.e)e'jgd|d; d<d}d~ ZeZej_dddZej_dddZej_dd Zej_dddZej_dddZdd Zdd Zi de:dd edD de1dddde1ddddde2ddddde3ddddde-dde:edddde:edddde:edddde:edddde:edddde:edddde:edddde:edddde:edddde:edddde: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rKe:e'jdd edD ddZeed< ej_e dDddu ZeZej_dd e D dDddń ZeZej_dd e D dDddȄ Zej_ddd˄Zej_ddd̈́Zej_dddτZddф Zddӄ e D Zej_dddՄZddӄ e6jD Zi eeeZej_e dDdd؄ Zddӄ e6jD Zi eeeeZej_e dDddۄ Zej_ddd݄Zej_ddd߄Zej_ddd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dDdd Zej_e6jdDdd Zej_eje8jeje8jeje8jeje8jeje8jeje8jeje8jejejejejejejeje8jeje8jeje8jgdDdd Zej_eje8jeje8jeje8jeje8jeje8jeje8jeje8jgdDdd Zg dZej_edDdd Zdd gZej_edDdd Zee Zej_edDdd Zej_ejejejejejejgdDdd Zej_g ddDdd	 Zej_g d
dDdd Zg dZej_edDdd Zej_dd Zej_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_edDd)d* ZeZej_g d+dDd,d- ZeZej_e6jdDd.d/ Zej_dejlde"md0d]gdDd1d2 Zej_d3ejld0e"md0d]ejld4e"md0d]gdDd5d6 Zej_d7ejld0e"md0d]gdDd8d9 ZeZej_e6jdDd:d; Zej_e6jdDd<d= Zej_d>dejlde"md0d]ejld?e"md0d]gdDd@dA Zej_e6jdDdBdC Zej_e6jdDdDdE Zej_ddGdHZej_e6jdDdIdJ Zej_e6jdDdKdL Zej_e6jdDdMdN Zej_e6jdDdOdP Zej_e6j dDdQdR Zej_e6jdDdSdT Zej_e6jdDdUdV Zej_e6jdDdWdX Zej_e6jdDdYdZ Z	ej_e6je6j dDd[d\ Z
ej_e6je6j e6j e6j dDd]d^ Zej_e6jdDd_d` Zej_e6jdDdadb Zej_e6jdDdcdd Zej_e6jdDdedf Zej_e6jdDdgdh Zej_e6jdDdidj Zddkejvdlgfddke'jdlgfdmdke'jwdlgfdndoejvdpgfdqejvejvejvgfdqg fdrdkejvdsgfdmdkejvdtgfdudvejvdtgfdwd,ejvdsgfdxd,ejvdtgfdyed,ejvedsgfddejvdgfdde'jdgfdzed{ejved|gfde0d}ejve0d~gfdedd,d,ejvedd,d,gfddejvdgfded,ejvedsgfded,ejvedsgfde,de'jwe,dgfde*dd,ejve*dds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dDdd Z!ej_dd e'jYj"D dDdd Z#ej_ddd; gdD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dDdddZ%ej_e6j&e6j'e6j(gdDdd Z)ej_e6j'e6j(gdDdd Z*ej_e6j&e6j(gdDdd Z+ej_e6j&e6j'gdDdd Z,ej_e6j-e6j'gdDdd Z.ej_e6j/e6j(gdDdd Z0ej_dddZ1ej_dddZ2ej_dddZ3ej_dddZ4ddgZ5eEdu
re5OeEFd ej_e5dD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returnNonec                 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 r/   F/var/www/html/lang_env/lib/python3.10/site-packages/pandas/conftest.pypytest_addoptiono   s
   
r1   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endswithZ
add_markerpytestmarkfilterwarnings)r2   r4   r6   r/   r/   r0   ignore_doctest_warningw   s   r<   c                 C  sP   | dp|j ddd}g d}|r$| D ]}|D ]
\}}t||| qqd S 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_warningsr2   r4   r6   r/   r/   r0   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_namespacer/   r/   r0   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_optionr/   r/   r/   r0   configure_tests	     rU   )r   rM   indexcolumnsc                 C     dt |  S Nzaxis=reprxr/   r/   r0   <lambda>      r_   )paramsidsc                 C     | j S )z@
    Fixture for returning the axis numbers of a DataFrame.
    paramrequestr/   r/   r0   axis     rh   rX   c                 C  rY   rZ   r[   r]   r/   r/   r0   r_     r`   c                 C  rc   )zA
    Fixture for returning aliases of axis 1 of a DataFrame.
    rd   rf   r/   r/   r0   axis_1  ri   rj   )TFN)ra   c                 C  rc   )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).
    rd   rf   r/   r/   r0   observed'     
rk   c                 C  rc   )z6
    Boolean 'ordered' parameter for Categorical.
    rd   rf   r/   r/   r0   ordered4  ri   rm   c                 C  rc   )z%
    Boolean 'skipna' parameter.
    rd   rf   r/   r/   r0   skipna<  ri   rn   )firstlastFc                 C  rc   )z[
    Valid values for the 'keep' parameter used in
    .duplicated or .drop_duplicates
    rd   rf   r/   r/   r0   keepD     rq   )bothneitherleftrightc                 C  rc   )zA
    Fixture for trying all interval 'inclusive' parameters.
    rd   rf   r/   r/   r0   inclusive_endpoints_fixtureM  ri   rw   )ru   rv   rs   rt   c                 C  rc   )z<
    Fixture for trying all interval closed parameters.
    rd   rf   r/   r/   r0   closedU  ri   rx   c                 C  rc   )zS
    Secondary closed fixture to allow parametrizing over all pairs of closed.
    rd   rf   r/   r/   r0   other_closed]  ri   ry   gzipbz2zipxztarZzstdZ	zstandard)Zmarksc                 C  rc   )zK
    Fixture for trying common compression types in compression tests.
    rd   rf   r/   r/   r0   compressione     r   c                 C  rc   )zk
    Fixture for trying common compression types in compression tests excluding
    uncompressed case.
    rd   rf   r/   r/   r0   compression_onlyw  r   r   c                 C  rc   )z,
    Fixture that an array is writable.
    rd   rf   r/   r/   r0   writable  ri   r   )innerouterru   rv   c                 C  rc   )z:
    Fixture for trying all types of join operations.
    rd   rf   r/   r/   r0   	join_type  ri   r   nlargest	nsmallestc                 C  rc   )z1
    Fixture for trying all nselect methods.
    rd   rf   r/   r/   r0   nselect_method  ri   r   c                 C  
   t | jS Ntype__name__r]   r/   r/   r0   r_        
 c                 C  rc   )z/
    Fixture for each null type in pandas.
    rd   rf   r/   r/   r0   nulls_fixture  ri   r   c                 C  rc   )zL
    Fixture for each null type in pandas, each null type exactly once.
    rd   rf   r/   r/   r0   unique_nulls_fixture  ri   r   c                 C  r   r   r   r]   r/   r/   r0   r_     r   c                 C  rc   )z-
    Fixture for each NaT type in numpy.
    rd   rf   r/   r/   r0   np_nat_fixture  ri   r   c                 C  rc   )z;
    Fixture to parametrize over DataFrame and Series.
    rd   rf   r/   r/   r0   frame_or_series  ri   r   rW   seriesc                 C  rc   )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
    rd   rf   r/   r/   r0   index_or_series  rl   r   )rW   r   arrayc                 C  rc   )zG
    Fixture to parametrize over Index, Series, and ExtensionArray
    rd   rf   r/   r/   r0   index_or_series_or_array  ri   r   c                 C  rc   r   )r   r]   r/   r/   r0   r_         c                 C  rc   )z]
    Fixture to test behavior for Index, Series, DataFrame, and pandas Array
    classes
    rd   rf   r/   r/   r0   box_with_array  rr   r   
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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/   r0   r      s   z+dict_subclass.<locals>.TestSubDict.__init__Nr(   r)   )r   
__module____qualname__r   r/   r/   r/   r0   TestSubDict  s    r   )r   )r   r/   r/   r0   dict_subclass  s   r   type[abc.Mapping]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/   r0   r        
z>non_dict_mapping_subclass.<locals>.TestNonDictMapping.__init__c                 S  s   | j |S r   )r   __getitem__)r   keyr/   r/   r0   r     s   zAnon_dict_mapping_subclass.<locals>.TestNonDictMapping.__getitem__r&   c                 S  
   | j  S r   )r   __iter__r   r/   r/   r0   r     r   z>non_dict_mapping_subclass.<locals>.TestNonDictMapping.__iter__intc                 S  r   r   )r   __len__r   r/   r/   r0   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/   r0   TestNonDictMapping  s
    

r   )r   Mapping)r   r/   r/   r0   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)rX   rW   c                 S  rc   r   )yearr]   r/   r/   r0   r_   *  r   zAmultiindex_year_month_day_dataframe_random_data.<locals>.<lambda>c                 S  rc   r   )rO   r]   r/   r/   r0   r_   *  r   c                 S  rc   r   )dayr]   r/   r/   r0   r_   *  r   c                 S  s   g | ]}| d qS )i8)astype).0Zlevr/   r/   r0   
<listcomp>,      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sumrW   Z
set_levelslevelsZ	set_names)ZtdfZymdr/   r/   r0   /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   ro   second)r   codesnames)r#   r/   r/   r/   r0   %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   rW   rX   )r   rQ   r   r   r   r"   )r   rW   r/   r/   r0    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   ro   r   F)r   r   r   Zverify_integrity)r"   rQ   r   r#   )Z
major_axisZ
minor_axisZmajor_codesZminor_codesZindex_namesr/   r/   r0   _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   r/   r/   r/   r0   _create_mi_with_dt64tz_level^  s   r   stringc                 C     g | ]}d | qS Zpandas_r/   r   ir/   r/   r0   r   j  r   r   r   r   z
2020-01-01)r   zdatetime-tzz
US/Pacificr   ZperiodDr   r   z1 day)startr   r   rangeZint8r   Zint16Zint32int64Zuint8Zuint16Zuint32Zuint64Zfloat32float64zbool-object	complex64y              ?
complex128abcd   e   )num)r   r   r   )rM   r   r   )r   r   rM   rM   r   r   ZInt64ZUInt16ZFloat32booleanc                 C  r   r   r/   r   r/   r/   r0   r     r   z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-pythonc                 C  r   r   r/   r   r/   r/   r0   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_dictre   copyrf   r/   r/   r0   rW     s   c                 C  s   g | ]\}}t |ts|qS r/   )
isinstancer#   r   r   valuer/   r/   r0   r     s
    c                 C  s   | j }t|  S )z8
    index fixture, but excluding MultiIndex cases.
    )re   r   r  )rg   r   r/   r/   r0   
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  r/   r/   r0   r     s    c                 C  s   t | j jdd}|j }| jdv r4| }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   rM   N)r   re   r  valuestolistr#   from_tuplesr   )rg   indvalsr/   r/   r0   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  r   )Zi_r/   r   r/   r/   r0   r     r   z!string_series.<locals>.<listcomp>r   rW   r7   )r   rQ   aranger   r"   r   r   r/   r/   r/   r0   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  r   Zfoo_r/   r   r/   r/   r0   r     r   z!object_series.<locals>.<listcomp>r  c                 S  r   )Zbar_r/   r   r/   r/   r0   r     r   r   objectsrW   r7   r   )r   r"   r   r   )datarW   r/   r/   r0   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   r/   r/   r/   r0   datetime_series  s
   r  c                 C  s*   t | }tjd|}t|| dddS )zHelper for the _series dictr   r   F)rW   r7   r  )lenrQ   r   r   r   r   )rW   sizer  r/   r/   r0   _create_series  s   r  c                 C  s"   i | ]\}}d | dt |qS )zseries-with-z-indexr  )r   Zindex_idrW   r/   r/   r0   
<dictcomp>  s    r   c                 C  s   t | S )zE
    Fixture for tests on series with changing types of indices.
    r  rW   r/   r/   r0   series_with_simple_index  s   r"  c              	   C  s8   i | ]}|j  d ttddd tdD d|dqS )-seriesr  c                 S  r   )zi-r/   r   r/   r/   r0   r     r   z<dictcomp>.<listcomp>r   r  )r   r   r   r   r   r/   r/   r0   r     s    c                 C     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_objsre   r  rf   r/   r/   r0   index_or_series_obj$  s   r'  c                 C  s   i | ]}|j  d t|qS )r#  )r   r   r$  r/   r/   r0   r   -  s    c                 C  r%  )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_objsre   r  rf   r/   r/   r0   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  r   r  r/   r   r/   r/   r0   r   P  r   zint_frame.<locals>.<listcomp>r  r   r   )r   rQ   Zonesr   r"   r   r   r   r/   r/   r/   r0   	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  r   r  r/   r   r/   r/   r0   r   ^  r   zfloat_frame.<locals>.<listcomp>r  r   r   )r   rQ   r   r   r   r"   r   r   r/   r/   r/   r0   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  )datesr/   r/   r0   (rand_series_with_duplicate_datetimeindexc  s   









r.  )ru   rv   rv   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  rc   r   rd   rf   r/   r/   r0   ea_scalar_and_dtype{     r3  c                 C  rc   )zD
    Fixture for dunder names for common arithmetic operations.
    rd   rf   r/   r/   r0   all_arithmetic_operators  ri   r5  c                 C  rc   )zU
    Fixture for operator and roperator arithmetic, comparison, and logical ops.
    rd   rf   r/   r/   r0   all_binary_operators     "r6  c                 C  rc   )z
    Fixture for operator and roperator arithmetic functions.

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

    * >=
    * >
    * <
    * <=
    rd   rf   r/   r/   r0   compare_operators_no_eq_ne  rl   rI  )__and____rand____or____ror____xor____rxor__c                 C  rc   )zY
    Fixture for dunder names for common logical operations

    * |
    * &
    * ^
    rd   rf   r/   r/   r0   all_logical_operators(     rP  )ZcumsumZcumprodZcumminZcummaxc                 C  rc   )z0
    Fixture for numeric accumulation names
    rd   rf   r/   r/   r0   all_numeric_accumulations9  ri   rR  c                 C  s
   |  dS )zR
    Returns the configuration for the test setting `--no-strict-data-files`.
    r*   )rB   )Zpytestconfigr/   r/   r0   strict_data_filesD  s   
rS  Callable[..., str]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.
    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 --no-strict-data-files is not set.zCould not find .)osr4   joinexists
ValueErrorr9   skip)r   r4   Z	BASE_PATHrS  r/   r0   decoa  s   
zdatapath.<locals>.deco)rW  r4   rX  dirname__file__)rS  r]  r/   r\  r0   datapathL  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/   r[   r   r/   r/   r0   r     s    c                 C  rc   )zD
    Fixture for trying timezones including default (None): {0}
    rd   rf   r/   r/   r0   tz_naive_fixture  rr   rb  c                 C  rc   )z4
    Fixture for trying explicit timezones: {0}
    rd   rf   r/   r/   r0   tz_aware_fixture  rr   rc  r   zdateutil/UTCc                 C  rc   )zQ
    Fixture to provide variants of UTC timezone strings and tzinfo objects.
    rd   rf   r/   r/   r0   utc_fixture  ri   rd  )r0  msusnsc                 C  rc   )z&
    datetime64 units we support.
    rd   rf   r/   r/   r0   r1    ri   r1  c                 C  rc   )zR
    Parametrized fixture for string dtypes.

    * str
    * 'str'
    * 'U'
    rd   rf   r/   r/   r0   string_dtype     	rh  pyarrowc                 C  rc   )za
    Parametrized fixture for string dtypes.

    * 'string[python]'
    * 'string[pyarrow]'
    rd   rf   r/   r/   r0   nullable_string_dtype     rk  pythonpyarrow_numpyc                 C  rc   )zx
    Parametrized fixture for pd.options.mode.string_storage.

    * 'python'
    * 'pyarrow'
    * 'pyarrow_numpy'
    rd   rf   r/   r/   r0   string_storage  r   ro  Znumpy_nullablec                 C  rc   )zb
    Parametrized fixture for pd.options.mode.string_storage.

    * 'python'
    * 'pyarrow'
    rd   rf   r/   r/   r0   dtype_backend  rl  rp  c                 C  rc   )zK
    Parametrized fixture for bytes dtypes.

    * bytes
    * 'bytes'
    rd   rf   r/   r/   r0   bytes_dtype     rq  c                 C  rc   )zN
    Parametrized fixture for object dtypes.

    * object
    * 'object'
    rd   rf   r/   r/   r0   object_dtype  rr  rs  r   zstring[pyarrow_numpy]c                 C  rc   )zo
    Parametrized fixture for string dtypes.
    * 'object'
    * 'string[python]'
    * 'string[pyarrow]'
    rd   rf   r/   r/   r0   any_string_dtype  r   rt  c                 C  rc   )z\
    Parametrized fixture for datetime64 dtypes.

    * 'datetime64[ns]'
    * 'M8[ns]'
    rd   rf   r/   r/   r0   datetime64_dtype-  rr  ru  c                 C  rc   )z^
    Parametrized fixture for timedelta64 dtypes.

    * 'timedelta64[ns]'
    * 'm8[ns]'
    rd   rf   r/   r/   r0   timedelta64_dtype8  rr  rv  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   r/   r/   r/   r0   fixed_now_tsC  s   r|  c                 C  rc   )z^
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    rd   rf   r/   r/   r0   float_numpy_dtypeM  ri  r}  c                 C  rc   )zR
    Parameterized fixture for float dtypes.

    * 'Float32'
    * 'Float64'
    rd   rf   r/   r/   r0   float_ea_dtypeY  rr  r~  c                 C  rc   )z~
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    * 'Float32'
    * 'Float64'
    rd   rf   r/   r/   r0   any_float_dtyped  rQ  r  c                 C  rc   )zg
    Parameterized fixture for complex dtypes.

    * complex
    * 'complex64'
    * 'complex128'
    rd   rf   r/   r/   r0   complex_dtyper  ri  r  c                 C  rc   )z|
    Parameterized fixture for signed integer dtypes.

    * int
    * 'int8'
    * 'int16'
    * 'int32'
    * 'int64'
    rd   rf   r/   r/   r0   any_signed_int_numpy_dtype~  rQ  r  c                 C  rc   )zx
    Parameterized fixture for unsigned integer dtypes.

    * 'uint8'
    * 'uint16'
    * 'uint32'
    * 'uint64'
    rd   rf   r/   r/   r0   any_unsigned_int_numpy_dtype  rl   r  c                 C  rc   )z
    Parameterized fixture for any integer dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    rd   rf   r/   r/   r0   any_int_numpy_dtype  r   r  c                 C  rc   )z
    Parameterized fixture for any nullable integer dtype.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    rd   rf   r/   r/   r0   any_int_ea_dtype  r4  r  c                 C  rc   )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'
    rd   rf   r/   r/   r0   any_int_dtype  s   r  c                 C  rc   )z
    Parameterized fixture for any nullable integer dtype and
    any float ea dtypes.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    * 'Float32'
    * 'Float64'
    rd   rf   r/   r/   r0   any_numeric_ea_dtype  s   r  c                 C  rc   )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]'
    rd   rf   r/   r/   r0   any_numeric_ea_and_arrow_dtype  s    r  c                 C  rc   )z~
    Parameterized fixture for any signed nullable integer dtype.

    * 'Int8'
    * 'Int16'
    * 'Int32'
    * 'Int64'
    rd   rf   r/   r/   r0   any_signed_int_ea_dtype  rl   r  c                 C  rc   )z
    Parameterized fixture for any (purely) real numeric dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    rd   rf   r/   r/   r0   any_real_numpy_dtype  s   r  c                 C  rc   )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.
    rd   rf   r/   r/   r0   any_real_numeric_dtype1  s   r  c                 C  rc   )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'
    rd   rf   r/   r/   r0   any_numpy_dtypeH  r7  r  c                 C  rc   )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]'
    rd   rf   r/   r/   r0   any_real_nullable_dtypem  s   r  c                 C  rc   )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'
    rd   rf   r/   r/   r0   any_numeric_dtype  s   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   Z20180101r   i  i  complexy      ?      ?y       @       @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   )re   rQ   r   r   )rg   Zinferred_dtyper  r/   r/   r0   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  r/   r/   r0   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  getattrre   )rg   sparser/   r/   r0   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   or/   r/   r0   r     s    
c                 C  rc   )zN
    Fixture for Tick based datetime offsets available for a time series.
    rd   rf   r/   r/   r0   tick_classes  rQ  r  c                 C  s   | S r   r/   r]   r/   r/   r0   r_   ,  s    c                 C  rc   )zk
    Simple fixture for testing keys in sorting methods.
    Tests None (no key) and the identity key.
    rd   rf   r/   r/   r0   sort_by_key,  rr   r  )r   NN)ZEgonZVenkmanN)NCC1701Dr  r  #tuple[Hashable, Hashable, Hashable]c                 C  rc   )zP
    A 3-tuple of names, the first two for operands, the last for a result.
    rd   rf   r/   r/   r0   r   5  s   r   c                 C  rc   )zI
    Parametrize over __setitem__, loc.__setitem__, iloc.__setitem__
    rd   rf   r/   r/   r0   indexer_sliH  ri   r  c                 C  rc   )z<
    Parametrize over loc.__getitem__, iloc.__getitem__
    rd   rf   r/   r/   r0   
indexer_liP  ri   r  c                 C  rc   )z8
    Parametrize over __setitem__, iloc.__setitem__
    rd   rf   r/   r/   r0   
indexer_siX  ri   r  c                 C  rc   )z7
    Parametrize over __setitem__, loc.__setitem__
    rd   rf   r/   r/   r0   
indexer_sl`  ri   r  c                 C  rc   )z:
    Parametrize over at.__setitem__, loc.__setitem__
    rd   rf   r/   r/   r0   
indexer_alh  ri   r  c                 C  rc   )z<
    Parametrize over iat.__setitem__, iloc.__setitem__
    rd   rf   r/   r/   r0   indexer_ialp  ri   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   r/   r/   r/   r0   using_array_managerx  rV   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   r/   r/   r/   r0   using_copy_on_write     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  r/   r/   r/   r0   warn_copy_on_write  r  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_stringr/   r/   r/   r0   using_infer_string  s   r  zEurope/Warsawzdateutil/Europe/Warsawc                 C  rc   )zE
    tzinfo for Europe/Warsaw using pytz, dateutil, or zoneinfo.
    rd   rf   r/   r/   r0   warsaw  ri   r  c                   C  s   dS )N)rj  rn  r/   r/   r/   r/   r0   arrow_string_storage  s   r  r   )r2   r3   r4   r5   r6   r5   r(   r)   )r(   r   )r(   r   )r(   r#   )r(   r   )r(   r   )rS  r5   r(   rT  )r(   r   )r(   r  )r(   r  )r(   r5   (8  __doc__
__future__r   collectionsr   r   r   r   r   r   r  r	   operatorrW  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&   rj  paImportErrorZhas_pyarrowZzoneinfoZZoneInfoZZoneInfoNotFoundErrorr1   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   rh   Z
axis_framerj   rk   rm   rn   rq   rw   rx   ry   re   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   r   r  r   r  r   Zfrom_breaksZlinspacer  r|   r   r   idxkeysrW   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.  r3  Zarithmetic_dunder_methodsr5  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_r6  r8  Z_all_numeric_reductionsr?  Z_all_boolean_reductionsrB  Z_all_reductionsrC  rD  rI  rP  Z_all_numeric_accumulationsrR  rS  r`  Z	TIMEZONESextendZTIMEZONE_IDSZparametrize_fixture_docr5   rb  rc  Ztz_aware_fixture2Z_UTCSrd  Zutc_fixture2r1  Zunit2ZSTRING_DTYPESrh  rk  ro  rp  Zstring_storage2ZBYTES_DTYPESrq  ZOBJECT_DTYPESrs  rt  ZDATETIME64_DTYPESru  ZTIMEDELTA64_DTYPESrv  r|  ZFLOAT_NUMPY_DTYPESr}  ZFLOAT_EA_DTYPESr~  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_REAL_NULLABLE_DTYPESr  ZALL_NUMERIC_DTYPESr  ZNAr  Z_any_skipna_inferred_dtyperb   _r  r  r  __all__r  r  r   setitemlocZilocr  r  r  r  atr  Ziatr  r  r  r  r  Zwarsawsr  r  r/   r/   r/   r0   <module>   sl   8

<






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






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