o
    FfӼ                     @  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IteratorFTZ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.   /lib/python3.10/site-packages/pandas/conftest.pypytest_addoptiono   s
   
r0   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pytestZmarkfilterwarnings)r1   r3   r5   r.   r.   r/   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.idxmaxr?   )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_warningsr1   r3   r5   r.   r.   r/   pytest_collection_modifyitems   s   /rC   z6.83.2Zci)ZdeadlineZsuppress_health_checkz)MonthBegin MonthEnd BMonthBegin BMonthEndic   )n	normalizez%YearBegin YearEnd BYearBegin BYearEnd         )Z	min_valueZ	max_value)rE   rF   monthz1QuarterBegin QuarterEnd BQuarterBegin BQuarterEndi   )rE   rF   ZstartingMonth)Zautousec                 C  s   t | d< t| d< dS )z:
    Make `np` and `pd` names available for doctests.
    nppdN)rM   rN   )Zdoctest_namespacer.   r.   r/   add_doctest_imports   s   rO   c                   C  s   t dd dS )z<
    Configure settings for all tests and test modules.
    Zchained_assignmentraiseN)rN   Z
set_optionr.   r.   r.   r/   configure_tests	     rQ   )r   rI   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     rd   rT   c                 C  rU   rV   rW   rY   r.   r.   r/   r[     r\   c                 C  r_   )zA
    Fixture for returning aliases of axis 1 of a DataFrame.
    r`   rb   r.   r.   r/   axis_1  re   rf   )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).
    r`   rb   r.   r.   r/   observed'     
rg   c                 C  r_   )z6
    Boolean 'ordered' parameter for Categorical.
    r`   rb   r.   r.   r/   ordered4  re   ri   c                 C  r_   )z%
    Boolean 'skipna' parameter.
    r`   rb   r.   r.   r/   skipna<  re   rj   )firstZlastFc                 C  r_   )z[
    Valid values for the 'keep' parameter used in
    .duplicated or .drop_duplicates
    r`   rb   r.   r.   r/   keepD     rl   )bothneitherleftrightc                 C  r_   )zA
    Fixture for trying all interval 'inclusive' parameters.
    r`   rb   r.   r.   r/   inclusive_endpoints_fixtureM  re   rr   )rp   rq   rn   ro   c                 C  r_   )z<
    Fixture for trying all interval closed parameters.
    r`   rb   r.   r.   r/   closedU  re   rs   c                 C  r_   )zS
    Secondary closed fixture to allow parametrizing over all pairs of closed.
    r`   rb   r.   r.   r/   other_closed]  re   rt   gzipbz2zipxztarZzstdZ	zstandard)Zmarksc                 C  r_   )zK
    Fixture for trying common compression types in compression tests.
    r`   rb   r.   r.   r/   compressione     rz   c                 C  r_   )zk
    Fixture for trying common compression types in compression tests excluding
    uncompressed case.
    r`   rb   r.   r.   r/   compression_onlyw  r{   r|   c                 C  r_   )z,
    Fixture that an array is writable.
    r`   rb   r.   r.   r/   writable  re   r}   )innerZouterrp   rq   c                 C  r_   )z:
    Fixture for trying all types of join operations.
    r`   rb   r.   r.   r/   	join_type  re   r   nlargestZ	nsmallestc                 C  r_   )z1
    Fixture for trying all nselect methods.
    r`   rb   r.   r.   r/   nselect_method  re   r   c                 C  
   t | jS Ntype__name__rY   r.   r.   r/   r[        
 c                 C  r_   )z/
    Fixture for each null type in pandas.
    r`   rb   r.   r.   r/   nulls_fixture  re   r   c                 C  r_   )zL
    Fixture for each null type in pandas, each null type exactly once.
    r`   rb   r.   r.   r/   unique_nulls_fixture  re   r   c                 C  r   r   r   rY   r.   r.   r/   r[     r   c                 C  r_   )z-
    Fixture for each NaT type in numpy.
    r`   rb   r.   r.   r/   np_nat_fixture  re   r   c                 C  r_   )z;
    Fixture to parametrize over DataFrame and Series.
    r`   rb   r.   r.   r/   frame_or_series  re   r   rS   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
    r`   rb   r.   r.   r/   index_or_series  rh   r   )rS   r   arrayc                 C  r_   )zG
    Fixture to parametrize over Index, Series, and ExtensionArray
    r`   rb   r.   r.   r/   index_or_series_or_array  re   r   c                 C  r_   r   )r   rY   r.   r.   r/   r[         c                 C  r_   )z]
    Fixture to test behavior for Index, Series, DataFrame, and pandas Array
    classes
    r`   rb   r.   r.   r/   box_with_array  rm   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.   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   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.   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 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)rT   rS   c                 S  r_   r   )yearrY   r.   r.   r/   r[   *  r   zAmultiindex_year_month_day_dataframe_random_data.<locals>.<lambda>c                 S  r_   r   )rK   rY   r.   r.   r/   r[   *  r   c                 S  r_   r   )dayrY   r.   r.   r/   r[   *  r   c                 S  s   g | ]}| d qS )Zi8)astype).0Zlevr.   r.   r/   
<listcomp>,      zCmultiindex_year_month_day_dataframe_random_data.<locals>.<listcomp>)r   rK   r   T)Zinplace)r   rM   randomdefault_rngstandard_normalr"   listobjectr   groupbysumrS   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bazZquxonetwoZthree)
r   r   r   rI   rI   r   r      r   r   )
r   rI   r   r   rI   rI   r   r   rI   r   rk   second)r   codesnames)r#   r.   r.   r.   r/   %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   CZexpr6   rS   rT   )r   rM   r   r   r   r"   )r   rS   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   rI   r   r   r   )r   rI   r   rI   r   rI   rk   r   F)r   r   r   Zverify_integrity)r"   rM   r   r#   )Z
major_axisZ
minor_axisZmajor_codesZminor_codesZindex_namesr.   r.   r/   _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.
    rI   r   ab20130101r   
US/Easternr   tzr   )r   )r#   Zfrom_productr   r.   r.   r.   r/   _create_mi_with_dt64tz_level^  s   r   stringc                 C     g | ]}d | qS Zpandas_r.   r   ir.   r.   r/   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              ?
complex128Zabcd   e   )Znum)r   r   r   )rI   r   r   )r   r   rI   rI   r   r   ZInt64ZUInt16ZFloat32Zbooleanc                 C  r   r   r.   r   r.   r.   r/   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.   r/   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_dictra   copyrb   r.   r.   r/   rS     s   c                 C  s   g | ]\}}t |ts|qS r.   )
isinstancer#   r   r   valuer.   r.   r/   r     s
    c                 C  s   | j }t|  S )z8
    index fixture, but excluding MultiIndex cases.
    )ra   r   r   )rc   r   r.   r.   r/   
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.   r/   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Zdeep)r   r   r   r   r   rI   N)r   ra   r   valuestolistr#   from_tuplesr   )rc   ZindZvalsr.   r.   r/   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.   r/   r     r   z!string_series.<locals>.<listcomp>r   rS   r6   )r   rM   aranger   r"   r   r   r.   r.   r.   r/   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.   r/   r     r   z!object_series.<locals>.<listcomp>r  c                 S  r   )Zbar_r.   r   r.   r.   r/   r     r   r   ZobjectsrS   r6   r   )r   r"   r   r   )datarS   r.   r.   r/   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   rM   r   r   r   r   r.   r.   r.   r/   datetime_series  s
   r
  c                 C  s*   t | }tjd|}t|| dddS )zHelper for the _series dictr   r   F)rS   r6   r   )lenrM   r   r   r   r   )rS   sizer  r.   r.   r/   _create_series  s   r  c                 C  s"   i | ]\}}d | dt |qS )zseries-with-z-indexr  )r   Zindex_idrS   r.   r.   r/   
<dictcomp>  s    r  c                 C  s   t | S )zE
    Fixture for tests on series with changing types of indices.
    r  rS   r.   r.   r/   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.   r/   r     r   z<dictcomp>.<listcomp>r   r  )r   r   r   r   r   r.   r.   r/   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_objsra   r   rb   r.   r.   r/   index_or_series_obj$  s   r  c                 C  s   i | ]}|j  d t|qS )r  )r   r   r  r.   r.   r/   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_objsra   r   rb   r.   r.   r/   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.   r/   r   P  r   zint_frame.<locals>.<listcomp>r  r   r   )r   rM   Zonesr   r"   r   r   r   r.   r.   r.   r/   	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.   r/   r   ^  r   zfloat_frame.<locals>.<listcomp>r  r   r   )r   rM   r   r   r   r"   r   r   r.   r.   r.   r/   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  rI   r   r   r   rH   r  )r   r   rM   r   r   r   r  )Zdatesr.   r.   r/   (rand_series_with_duplicate_datetimeindexc  s   









r  )rp   rq   rq   g?g      ?z2012-01M)r   z	period[M]z
2012-02-01z	period[D]z
2011-01-01r   )r   s)unitr   i  )Zsecondsztimedelta64[ns]c                 C  r_   r   r`   rb   r.   r.   r/   ea_scalar_and_dtype{     r   c                 C  r_   )zD
    Fixture for dunder names for common arithmetic operations.
    r`   rb   r.   r.   r/   all_arithmetic_operators  re   r"  c                 C  r_   )zU
    Fixture for operator and roperator arithmetic, comparison, and logical ops.
    r`   rb   r.   r.   r/   all_binary_operators     "r#  c                 C  r_   )z
    Fixture for operator and roperator arithmetic functions.

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

    * >=
    * >
    * <
    * <=
    r`   rb   r.   r.   r/   compare_operators_no_eq_ne  rh   r4  )__and____rand____or____ror____xor____rxor__c                 C  r_   )zY
    Fixture for dunder names for common logical operations

    * |
    * &
    * ^
    r`   rb   r.   r.   r/   all_logical_operators(     r;  )ZcumsumZcumprodZcumminZcummaxc                 C  r_   )z0
    Fixture for numeric accumulation names
    r`   rb   r.   r.   r/   all_numeric_accumulations9  re   r=  c                 C  s
   |  dS )zR
    Returns the configuration for the test setting `--no-strict-data-files`.
    r)   )r@   )Zpytestconfigr.   r.   r/   strict_data_filesD  s   
r>  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.
    Z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 .)osr3   joinexists
ValueErrorr8   skip)r   r3   Z	BASE_PATHr>  r.   r/   decoa  s   
zdatapath.<locals>.deco)rA  r3   rB  dirname__file__)r>  rG  r.   rF  r/   datapathL  s   
rJ  z
Asia/Tokyozdateutil/US/Pacificzdateutil/Asia/Singaporez+01:15z-02:15z	UTC+01:15z	UTC-02:15i,  i)Zhoursr   r   r   c                 C  s   g | ]}t |qS r.   rW   r   r.   r.   r/   r     s    c                 C  r_   )zD
    Fixture for trying timezones including default (None): {0}
    r`   rb   r.   r.   r/   tz_naive_fixture  rm   rK  c                 C  r_   )z4
    Fixture for trying explicit timezones: {0}
    r`   rb   r.   r.   r/   tz_aware_fixture  rm   rL  r   zdateutil/UTCc                 C  r_   )zQ
    Fixture to provide variants of UTC timezone strings and tzinfo objects.
    r`   rb   r.   r.   r/   utc_fixture  re   rM  )r  msusnsc                 C  r_   )z&
    datetime64 units we support.
    r`   rb   r.   r.   r/   r    re   r  c                 C  r_   )zR
    Parametrized fixture for string dtypes.

    * str
    * 'str'
    * 'U'
    r`   rb   r.   r.   r/   string_dtype     	rQ  pyarrowc                 C  r_   )za
    Parametrized fixture for string dtypes.

    * 'string[python]'
    * 'string[pyarrow]'
    r`   rb   r.   r.   r/   nullable_string_dtype     rT  Zpythonpyarrow_numpyc                 C  r_   )zx
    Parametrized fixture for pd.options.mode.string_storage.

    * 'python'
    * 'pyarrow'
    * 'pyarrow_numpy'
    r`   rb   r.   r.   r/   string_storage  r{   rW  Znumpy_nullablec                 C  r_   )zb
    Parametrized fixture for pd.options.mode.string_storage.

    * 'python'
    * 'pyarrow'
    r`   rb   r.   r.   r/   dtype_backend  rU  rX  c                 C  r_   )zK
    Parametrized fixture for bytes dtypes.

    * bytes
    * 'bytes'
    r`   rb   r.   r.   r/   bytes_dtype     rY  c                 C  r_   )zN
    Parametrized fixture for object dtypes.

    * object
    * 'object'
    r`   rb   r.   r.   r/   object_dtype  rZ  r[  r   zstring[pyarrow_numpy]c                 C  r_   )zo
    Parametrized fixture for string dtypes.
    * 'object'
    * 'string[python]'
    * 'string[pyarrow]'
    r`   rb   r.   r.   r/   any_string_dtype  r{   r\  c                 C  r_   )z\
    Parametrized fixture for datetime64 dtypes.

    * 'datetime64[ns]'
    * 'M8[ns]'
    r`   rb   r.   r.   r/   datetime64_dtype-  rZ  r]  c                 C  r_   )z^
    Parametrized fixture for timedelta64 dtypes.

    * 'timedelta64[ns]'
    * 'm8[ns]'
    r`   rb   r.   r.   r/   timedelta64_dtype8  rZ  r^  r   c                	   C  s   t ddddddddS )z-
    Fixture emits fixed Timestamp.now()
    i  rI   rJ   r         )r   rK   r   ZhourZminuter   Zmicrosecond)r   r.   r.   r.   r/   fixed_now_tsC  s   ra  c                 C  r_   )z^
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    r`   rb   r.   r.   r/   float_numpy_dtypeM  rR  rb  c                 C  r_   )zR
    Parameterized fixture for float dtypes.

    * 'Float32'
    * 'Float64'
    r`   rb   r.   r.   r/   float_ea_dtypeY  rZ  rc  c                 C  r_   )z~
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    * 'Float32'
    * 'Float64'
    r`   rb   r.   r.   r/   any_float_dtyped  r<  rd  c                 C  r_   )zg
    Parameterized fixture for complex dtypes.

    * complex
    * 'complex64'
    * 'complex128'
    r`   rb   r.   r.   r/   complex_dtyper  rR  re  c                 C  r_   )z|
    Parameterized fixture for signed integer dtypes.

    * int
    * 'int8'
    * 'int16'
    * 'int32'
    * 'int64'
    r`   rb   r.   r.   r/   any_signed_int_numpy_dtype~  r<  rf  c                 C  r_   )zx
    Parameterized fixture for unsigned integer dtypes.

    * 'uint8'
    * 'uint16'
    * 'uint32'
    * 'uint64'
    r`   rb   r.   r.   r/   any_unsigned_int_numpy_dtype  rh   rg  c                 C  r_   )z
    Parameterized fixture for any integer dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    r`   rb   r.   r.   r/   any_int_numpy_dtype  r{   rh  c                 C  r_   )z
    Parameterized fixture for any nullable integer dtype.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    r`   rb   r.   r.   r/   any_int_ea_dtype  r!  ri  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'
    r`   rb   r.   r.   r/   any_int_dtype  s   rj  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'
    r`   rb   r.   r.   r/   any_numeric_ea_dtype  s   rk  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]'
    r`   rb   r.   r.   r/   any_numeric_ea_and_arrow_dtype  s    rl  c                 C  r_   )z~
    Parameterized fixture for any signed nullable integer dtype.

    * 'Int8'
    * 'Int16'
    * 'Int32'
    * 'Int64'
    r`   rb   r.   r.   r/   any_signed_int_ea_dtype  rh   rm  c                 C  r_   )z
    Parameterized fixture for any (purely) real numeric dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    r`   rb   r.   r.   r/   any_real_numpy_dtype  s   rn  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.
    r`   rb   r.   r.   r/   any_real_numeric_dtype1  s   ro  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'
    r`   rb   r.   r.   r/   any_numpy_dtypeH  r$  rp  c                 C  r_   )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]'
    r`   rb   r.   r.   r/   any_real_nullable_dtypem  s   rq  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'
    r`   rb   r.   r.   r/   any_numeric_dtype  s   rr  r   cZmixedbytes   a   cr   zmixed-integerr   g       @Zfloatingg      ?Z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   )ra   rM   r   r   )rc   Zinferred_dtyper   r.   r.   r/   any_skipna_inferred_dtype  s   
)rz  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   )r8   importorskipZIPython.core.interactiveshellr{  Ztraitlets.configr|  ZHistoryManagerZ	hist_file)r{  r|  rs  r.   r.   r/   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)r8   r}  getattrra   )rc   Zsparser.   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  rN   offsetsr  )r   or.   r.   r/   r     s    
c                 C  r_   )zN
    Fixture for Tick based datetime offsets available for a time series.
    r`   rb   r.   r.   r/   tick_classes  r<  r  c                 C  s   | S r   r.   rY   r.   r.   r/   r[   ,  s    c                 C  r_   )zk
    Simple fixture for testing keys in sorting methods.
    Tests None (no key) and the identity key.
    r`   rb   r.   r.   r/   sort_by_key,  rm   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.
    r`   rb   r.   r.   r/   r   5  s   r   c                 C  r_   )zI
    Parametrize over __setitem__, loc.__setitem__, iloc.__setitem__
    r`   rb   r.   r.   r/   indexer_sliH  re   r  c                 C  r_   )z<
    Parametrize over loc.__getitem__, iloc.__getitem__
    r`   rb   r.   r.   r/   
indexer_liP  re   r  c                 C  r_   )z8
    Parametrize over __setitem__, iloc.__setitem__
    r`   rb   r.   r.   r/   
indexer_siX  re   r  c                 C  r_   )z7
    Parametrize over __setitem__, loc.__setitem__
    r`   rb   r.   r.   r/   
indexer_sl`  re   r  c                 C  r_   )z:
    Parametrize over at.__setitem__, loc.__setitem__
    r`   rb   r.   r.   r/   
indexer_alh  re   r  c                 C  r_   )z<
    Parametrize over iat.__setitem__, iloc.__setitem__
    r`   rb   r.   r.   r/   indexer_ialp  re   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.   r/   using_array_managerx  rR   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rN   optionsmodeZcopy_on_writer   r.   r.   r.   r/   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.   r/   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)rN   r  ZfutureZinfer_stringr.   r.   r.   r/   using_infer_string  s   r  zEurope/Warsawzdateutil/Europe/Warsawc                 C  r_   )zE
    tzinfo for Europe/Warsaw using pytz, dateutil, or zoneinfo.
    r`   rb   r.   r.   r/   warsaw  re   r  c                   C  s   dS )N)rS  rV  r.   r.   r.   r.   r/   arrow_string_storage  s   r  r   )r1   r2   r3   r4   r5   r4   r'   r(   )r'   r   )r'   r   )r'   r#   )r'   r   )r'   r   )r>  r4   r'   r?  )r'   r   )r'   r  )r'   r  )r'   r4   (8  __doc__Z
__future__r   collectionsr   r   r   r   r   r   rw  r	   operatorrA  typingr
   r   Zdateutil.tzr   r   Z
hypothesisr   stZnumpyrM   r8   Zpytzr   r   Zpandas._config.configr   Zpandas.util._test_decoratorsutilZ_test_decoratorsZtdZpandas.core.dtypes.dtypesr   r   ZpandasrN   r   r   r   r   r   r   r   r   r   r   r   r    Zpandas._testingZ_testingZtmZpandas.corer!   Zpandas.core.indexes.apir"   r#   Zpandas.util.versionr$   Zcollections.abcr%   r&   rS  paImportErrorZhas_pyarrowZzoneinfoZZoneInfoZZoneInfoNotFoundErrorr0   r:   rC   ZHealthCheckZtoo_slowZhypothesis_health_checks__version__appendZdiffering_executorsZsettingsZregister_profiletupleZload_profilesplitr6   r  Ztseriesr  clsZregister_type_strategyZbuildsZintegersZbooleansZfixturerO   rQ   rd   Z
axis_framerf   rg   ri   rj   rl   rr   rs   rt   ra   Z
skip_if_norz   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   rw   r   r   idxkeysrS   Zindex_fixture2rA   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_reductionsr*  Z_all_boolean_reductionsr-  Z_all_reductionsr.  r/  r4  r;  Z_all_numeric_accumulationsr=  r>  rJ  Z	TIMEZONESextendZTIMEZONE_IDSZparametrize_fixture_docr4   rK  rL  Ztz_aware_fixture2Z_UTCSrM  Zutc_fixture2r  Zunit2ZSTRING_DTYPESrQ  rT  rW  rX  Zstring_storage2ZBYTES_DTYPESrY  ZOBJECT_DTYPESr[  r\  ZDATETIME64_DTYPESr]  ZTIMEDELTA64_DTYPESr^  ra  ZFLOAT_NUMPY_DTYPESrb  ZFLOAT_EA_DTYPESrc  ZALL_FLOAT_DTYPESrd  ZCOMPLEX_DTYPESre  ZSIGNED_INT_NUMPY_DTYPESrf  ZUNSIGNED_INT_NUMPY_DTYPESrg  ZALL_INT_NUMPY_DTYPESrh  ZALL_INT_EA_DTYPESri  ZALL_INT_DTYPESrj  rk  ZALL_INT_PYARROW_DTYPES_STR_REPRZFLOAT_PYARROW_DTYPES_STR_REPRrl  ZSIGNED_INT_EA_DTYPESrm  ZALL_REAL_NUMPY_DTYPESrn  ZALL_REAL_DTYPESro  ZALL_NUMPY_DTYPESrp  ZALL_REAL_NULLABLE_DTYPESrq  ZALL_NUMERIC_DTYPESrr  ZNArx  Z_any_skipna_inferred_dtyper^   _rz  r~  r  __all__r  r  r   setitemlocZilocr  r  r  r  Zatr  Ziatr  r  r  r  r  Zwarsawsr  r  r.   r.   r.   r/   <module>   sl   8

<






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






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