o
    
&zhe                     @  s  d Z ddlmZ ddlmZ ddlmZmZmZmZm	Z	 ddl
mZ ddlZddlZddlmZmZ 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 edde:dd edD d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i de:ddgd+ edde:ddgd+ edde:ejddddejddd  de:ejddddejddd  de(edd de+ejddddde:g de;eg dg dde de de:g dde:edddde:edddde:edddde:ededdde:e'jdd edD ddZeDrxe: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/dd dfgdDdd Zej_e6jdDdd Zej_eje8jeje8jeje8jeje8jeje8jeje8jeje8jejejejejejejeje8jeje8jeje8jgdDdd Zej_eje8jeje8jeje8jeje8jeje8jeje8jeje8jgdDdd	 Zg d
Zej_edDdd Zϐd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 d0d eD Ze"ee݃ej_eed<d1d2 Ze"eed,d ej_ed,d ed,d d<d3d4 ZeZd5d6ee e	jgZeEdureOeEFd ej_edDd7d8 ZeZej_g d9dDd:d; ZeZej_e6jdDd<d= Zej_d>e'jfejld?e'jfe"md?d]ejld?ejvfe"md?d]d>ejvfgg d@d<dAdB Zej_dejlde"md?d]gdDdCdD Zej_ejld?ejvfe"md?d]ejld?e'jfe"md?d]gdDdEdF Zej_d>ejld?e"md?d]gdDdGdH Zej_d>e'jfejld?e'jfe"md?d]ejld?ejvfe"md?d]d>ejvfgg d@d<dIdJ Zej_dKejld?e"md?d]gdDdLdM ZeZeZej_e6jdDdNdO Zej_e6jdDdPdQ Zej_edd>e'jfejld?e'jfe"md?d]ejld?ejvfe"md?d]d>ejvfgg dRd<dSdT Zej_e6jdDdUdV Zej_e6jdDdWdX Zej_dАdZd[Zej_e6jdDd\d] Zej_e6j dDd^d_ Zej_e6jdDd`da Zej_e6jdDdbdc Zej_e6jdDddde Zej_e6jdDdfdg Z	ej_e6j
dDdhdi Zej_e6jdDdjdk Zej_e6jdDdldm Zej_e6jdDdndo Zej_e6je6j  dDdpdq Zej_e6je6j  e6j e6j dDdrds Zej_e6jdDdtdu Zej_e6jdDdvdw Zej_e6jdDdxdy Zej_e6jdDdzd{ Zej_e6jdDd|d} Zej_e6j dDd~d Z!ddejvdgfdde'jdgfdde'jwdgfddejvdgfdejvejvejvgfdg fddejvdgfddejvdgfddejvdgfdd,ejvdgfdd,ejvdgfded,ejvedgfddejvdgfdde'jdgfde"dejve"dgfde0dejve0dgfdedd,d,ejvedd,d,gfddejvdgfded,ejvedgfded,ejvedgfde,de'jwe,dgfde*dd,ejve*dd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'jdfe'je'je'jfgdDdѐddZ,ej_e6j-e6j.e6j/gdDdd Z0ej_e6j.e6j/gdDdd Z1ej_e6j-e6j/gdDdd Z2ej_e6j-e6j.gdDdd Z3ej_e6j4e6j.gdDdd Z5ej_e6j6e6j/gdDdd Z7ej_dҐddZ8ej_dҐddZ9ej_dҐddZ:ej_dҐddZ;ddgZ<eEdure<OeEFd¡ ej_e<dDdӐdĐdńZ=e_ dƐdǄ Z>dS (  a  
This file is very long and growing, but it was decided to not split it yet, as
it's still manageable (2020-03-17, ~1.1k LoC). See gh-31989

Instead of splitting it was decided to define sections here:
- Configuration / Settings
- Autouse fixtures
- Common arguments
- Missing values & co.
- Classes
- Indices
- Series'
- DataFrames
- Operators & Operations
- Data sets/files
- Time zones
- Dtypes
- Misc
    )annotations)abc)datedatetimetime	timedeltatimezone)DecimalN)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)	addoption)parser r0   J/var/www/html/kangema/venv/lib/python3.10/site-packages/pandas/conftest.pypytest_addoptiono   s
   
r2   itempytest.Itempathstrmessagec                 C  s,   | j |r| tjd|  dS dS )a  Ignore doctest warning.

    Parameters
    ----------
    item : pytest.Item
        pytest test item.
    path : str
        Module path to Python object, e.g. "pandas.core.frame.DataFrame.append". A
        warning will be filtered when item.name ends with in given path. So it is
        sufficient to specify e.g. "DataFrame.append".
    message : str
        Message to be filtered.
    zignore:N)nameendswith
add_markerpytestmarkfilterwarnings)r3   r5   r7   r0   r0   r1   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))is_int64_dtypezis_int64_dtype is deprecated)is_interval_dtypezis_interval_dtype is deprecated)is_period_dtypezis_period_dtype is deprecated)is_datetime64tz_dtypez#is_datetime64tz_dtype is deprecated)is_categorical_dtypez"is_categorical_dtype is deprecated)	is_sparsezis_sparse is deprecated)DataFrameGroupBy.fillnaz%DataFrameGroupBy.fillna is deprecated)NDFrame.replacezThe 'method' keyword)rG   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.idxminrH   )zSeriesGroupBy.idxmaxrI   )zmissing.mask_zero_div_zerozdivide by zero encountered)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)rF   z3DataFrameGroupBy.fillna with 'method' is deprecated)rF   z,DataFrame.fillna with 'method' is deprecated)read_parquetz1Passing a BlockManager to DataFrame is deprecated)	getoptionr>   )itemsconfig
is_doctestignored_doctest_warningsr3   r5   r7   r0   r0   r1   pytest_collection_modifyitems   s   /rQ   z6.83.2ci)deadlinesuppress_health_checkz)MonthBegin MonthEnd BMonthBegin BMonthEndic   )n	normalizez%YearBegin YearEnd BYearBegin BYearEnd         )	min_value	max_value)rV   rW   monthz1QuarterBegin QuarterEnd BQuarterBegin BQuarterEndi   )rV   rW   startingMonth)autousec                 C  s   t | d< t| d< dS )z:
    Make `np` and `pd` names available for doctests.
    nppdN)rb   rc   )doctest_namespacer0   r0   r1   add_doctest_imports   s   re   c                   C  s   t dd dS )z<
    Configure settings for all tests and test modules.
    chained_assignmentraiseN)rc   
set_optionr0   r0   r0   r1   configure_tests	     ri   )r   rZ   indexcolumnsc                 C     dt |  S Nzaxis=reprxr0   r0   r1   <lambda>      rs   )paramsidsc                 C     | j S )z@
    Fixture for returning the axis numbers of a DataFrame.
    paramrequestr0   r0   r1   axis     r|   rl   c                 C  rm   rn   ro   rq   r0   r0   r1   rs     rt   c                 C  rw   )zA
    Fixture for returning aliases of axis 1 of a DataFrame.
    rx   rz   r0   r0   r1   axis_1  r}   r~   )TFN)ru   c                 C  rw   )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).
    rx   rz   r0   r0   r1   observed'     
r   c                 C  rw   )z6
    Boolean 'ordered' parameter for Categorical.
    rx   rz   r0   r0   r1   ordered4  r}   r   c                 C  rw   )z%
    Boolean 'skipna' parameter.
    rx   rz   r0   r0   r1   skipna<  r}   r   )firstlastFc                 C  rw   )z[
    Valid values for the 'keep' parameter used in
    .duplicated or .drop_duplicates
    rx   rz   r0   r0   r1   keepD     r   )bothneitherleftrightc                 C  rw   )zA
    Fixture for trying all interval 'inclusive' parameters.
    rx   rz   r0   r0   r1   inclusive_endpoints_fixtureM  r}   r   )r   r   r   r   c                 C  rw   )z<
    Fixture for trying all interval closed parameters.
    rx   rz   r0   r0   r1   closedU  r}   r   c                 C  rw   )zS
    Secondary closed fixture to allow parametrizing over all pairs of closed.
    rx   rz   r0   r0   r1   other_closed]  r}   r   gzipbz2zipxztarzstd	zstandard)marksc                 C  rw   )zK
    Fixture for trying common compression types in compression tests.
    rx   rz   r0   r0   r1   compressione     r   c                 C  rw   )zk
    Fixture for trying common compression types in compression tests excluding
    uncompressed case.
    rx   rz   r0   r0   r1   compression_onlyw  r   r   c                 C  rw   )z,
    Fixture that an array is writable.
    rx   rz   r0   r0   r1   writable  r}   r   )innerouterr   r   c                 C  rw   )z:
    Fixture for trying all types of join operations.
    rx   rz   r0   r0   r1   	join_type  r}   r   nlargest	nsmallestc                 C  rw   )z1
    Fixture for trying all nselect methods.
    rx   rz   r0   r0   r1   nselect_method  r}   r   c                 C  
   t | jS Ntype__name__rq   r0   r0   r1   rs        
 c                 C  rw   )z/
    Fixture for each null type in pandas.
    rx   rz   r0   r0   r1   nulls_fixture  r}   r   c                 C  rw   )zL
    Fixture for each null type in pandas, each null type exactly once.
    rx   rz   r0   r0   r1   unique_nulls_fixture  r}   r   c                 C  r   r   r   rq   r0   r0   r1   rs     r   c                 C  rw   )z-
    Fixture for each NaT type in numpy.
    rx   rz   r0   r0   r1   np_nat_fixture  r}   r   c                 C  rw   )z;
    Fixture to parametrize over DataFrame and Series.
    rx   rz   r0   r0   r1   frame_or_series  r}   r   rk   seriesc                 C  rw   )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
    rx   rz   r0   r0   r1   index_or_series  r   r   )rk   r   arrayc                 C  rw   )zG
    Fixture to parametrize over Index, Series, and ExtensionArray
    rx   rz   r0   r0   r1   index_or_series_or_array  r}   r   c                 C  rw   r   )r   rq   r0   r0   r1   rs         c                 C  rw   )z]
    Fixture to test behavior for Index, Series, DataFrame, and pandas Array
    classes
    rx   rz   r0   r0   r1   box_with_array  r   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kwargsr0   r0   r1   r      s   z+dict_subclass.<locals>.TestSubDict.__init__Nr(   r)   )r   
__module____qualname__r   r0   r0   r0   r1   TestSubDict  s    r   )r   )r   r0   r0   r1   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   underlying_dictr0   r0   r1   r        
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  
   | j  S r   )r   __iter__r   r0   r0   r1   r     r   z>non_dict_mapping_subclass.<locals>.TestNonDictMapping.__iter__intc                 S  r   r   )r   __len__r   r0   r0   r1   r     r   z=non_dict_mapping_subclass.<locals>.TestNonDictMapping.__len__Nr   )r(   r&   )r(   r   )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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
2000-01-01r   Bperiodsfreq)rl   rk   c                 S  rw   r   )yearrq   r0   r0   r1   rs   *  r   zAmultiindex_year_month_day_dataframe_random_data.<locals>.<lambda>c                 S  rw   r   )r^   rq   r0   r0   r1   rs   *  r   c                 S  rw   r   )dayrq   r0   r0   r1   rs   *  r   c                 S  s   g | ]}| d qS )i8)astype).0levr0   r0   r1   
<listcomp>,      zCmultiindex_year_month_day_dataframe_random_data.<locals>.<listcomp>)r   r^   r   T)inplace)r   rb   randomdefault_rngstandard_normalr"   listr   groupbysumrk   
set_levelslevels	set_names)tdf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bazquxonetwothree)
r   r   r   rZ   rZ   r   r      r   r   )
r   rZ   r   r   rZ   rZ   r   r   rZ   r   r   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r8   rk   rl   )r   rb   r   r   r   r"   )r   rk   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   rZ   r   r   r   )r   rZ   r   rZ   r   rZ   r   r   F)r   r   r   verify_integrity)r"   rb   r   r#   )
major_axis
minor_axismajor_codesminor_codes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.
    rZ   r   ab20130101r   
US/Easternr   tzr   )r   )r#   from_productr   r0   r0   r0   r1   _create_mi_with_dt64tz_level^  s   r
  objectc                 C     g | ]}d | qS pandas_r0   r   ir0   r0   r1   r   j  r   r   r   dtypestringc                 C  r  r  r0   r  r0   r0   r1   r   k  r   r   z
2020-01-01)r   zdatetime-tzz
US/Pacificr  periodDr   r   z1 day)startr   r   rangeint8int16int32int64uint8uint16uint32uint64float32float64zbool-object
bool-dtype	complex64y              ?
complex128categoricalabcd   intervale   )numemptytuples)r   r   r   )rZ   r   r   mi-with-dt64tz-levelmultirepeats)r   r   rZ   rZ   r   r   nullable_intInt64nullable_uintUInt16nullable_floatFloat32nullable_boolbooleanzstring-pythonc                 C  r  r  r0   r  r0   r0   r1   r     r   zstring[python]c                 C  r  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_dictry   copyrz   r0   r0   r1   rk     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.
    )ry   r8  r9  )r{   r   r0   r0   r1   
index_flat  s   	r=  c                 C  s0   g | ]\}}| d s|dv st|ts|qS ))r   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 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   rZ   N)r8  ry   r9  valuestolistr#   from_tuplesr   )r{   indvalsr0   r0   r1   index_with_missing  s   


rI  r   c                   C  s0   t tjdtjdd tdd tdD ddS )zC
    Fixture for Series of floats with Index of unique strings
       r  g?c                 S  r  )i_r0   r  r0   r0   r1   r     r   z!string_series.<locals>.<listcomp>r   rk   r8   )r   rb   aranger!  r"   r  r0   r0   r0   r1   string_series  s
   rN  c                  C  s8   dd t dD } tdd t dD }t| |dtdS )zI
    Fixture for Series of dtype object with Index of unique strings
    c                 S  r  foo_r0   r  r0   r0   r1   r     r   z!object_series.<locals>.<listcomp>rJ  c                 S  r  )bar_r0   r  r0   r0   r1   r     r   objectsrk   r8   r  )r  r"   r   r  )datark   r0   r0   r1   object_series  s   rU  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   rJ  r   r   r   tsrL  )r   rb   r   r   r   r   r0   r0   r0   r1   datetime_series  s
   rW  c                 C  s*   t | }tjd|}t|| dddS )zHelper for the _series dictr   r  F)rk   r8   r9  )lenrb   r   r   r   r   )rk   sizerT  r0   r0   r1   _create_series  s   rZ  c                 C  s"   i | ]\}}d | dt |qS )zseries-with-z-indexrZ  )r   index_idrk   r0   r0   r1   
<dictcomp>  s    r]  c                 C  s   t | S )zE
    Fixture for tests on series with changing types of indices.
    r[  rk   r0   r0   r1   series_with_simple_index  s   r_  c              	   C  s8   i | ]}|j  d ttddd tdD d|dqS )-seriesrJ  c                 S  r  )zi-r0   r  r0   r0   r1   r     r   z<dictcomp>.<listcomp>r  rS  )r   r   r  r   r  r0   r0   r1   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
    TrA  )_index_or_series_objsry   r9  rz   r0   r0   r1   index_or_series_obj%  s   rd  c                 C  s   i | ]}|j  d t|qS )r`  )r   r   ra  r0   r0   r1   r]  .  s    c                 C  rb  )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
    TrA  )_index_or_series_memory_objsry   r9  rz   r0   r0   r1   index_or_series_memory_obj;  s   rf  c                   C  s4   t tjdtjdtdd tdD ttddS )zj
    Fixture for DataFrame of ints with index of unique strings

    Columns are ['A', 'B', 'C', 'D']
    rJ  r   r  c                 S  r  rO  r0   r  r0   r0   r1   r   Q  r   zint_frame.<locals>.<listcomp>rJ  r   r   )r   rb   onesr  r"   r  r   r0   r0   r0   r1   	int_frameH  s
   
ri  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   rg  c                 S  r  rO  r0   r  r0   r0   r1   r   _  r   zfloat_frame.<locals>.<listcomp>rJ  r   r   )r   rb   r   r   r   r"   r  r   r0   r0   r0   r1   float_frameV  s
   
rj  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  rZ   r   r   r   rY   r^  )r   r   rb   r   r   r   rX  )datesr0   r0   r1   (rand_series_with_duplicate_datetimeindexd  s   









rl  )r   r   r   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  rw   r   rx   rz   r0   r0   r1   ea_scalar_and_dtype|     rq  c                 C  rw   )zD
    Fixture for dunder names for common arithmetic operations.
    rx   rz   r0   r0   r1   all_arithmetic_operators  r}   rs  c                 C  rw   )zU
    Fixture for operator and roperator arithmetic, comparison, and logical ops.
    rx   rz   r0   r0   r1   all_binary_operators     "rt  c                 C  rw   )z
    Fixture for operator and roperator arithmetic functions.

    Notes
    -----
    This includes divmod and rdivmod, whereas all_arithmetic_operators
    does not.
    rx   rz   r0   r0   r1   all_arithmetic_functions  s   rv  )countr   maxminmeanprodstdvarmediankurtskewsemc                 C  rw   )z.
    Fixture for numeric reduction names.
    rx   rz   r0   r0   r1   all_numeric_reductions  r}   r  allanyc                 C  rw   )z.
    Fixture for boolean reduction names.
    rx   rz   r0   r0   r1   all_boolean_reductions  r}   r  c                 C  rw   )z>
    Fixture for all (boolean + numeric) reduction names.
    rx   rz   r0   r0   r1   all_reductions  r}   r  c                 C  rw   )z;
    Fixture for operator module comparison functions.
    rx   rz   r0   r0   r1   comparison_op  rr  r  )__le____lt____ge____gt__c                 C  rw   )zm
    Fixture for dunder names for compare operations except == and !=

    * >=
    * >
    * <
    * <=
    rx   rz   r0   r0   r1   compare_operators_no_eq_ne  r   r  )__and____rand____or____ror____xor____rxor__c                 C  rw   )zY
    Fixture for dunder names for common logical operations

    * |
    * &
    * ^
    rx   rz   r0   r0   r1   all_logical_operators)     r  )cumsumcumprodcummincummaxc                 C  rw   )z0
    Fixture for numeric accumulation names
    rx   rz   r0   r0   r1   all_numeric_accumulations:  r}   r  c                 C  s
   |  dS )zR
    Returns the configuration for the test setting `--no-strict-data-files`.
    r*   )rL   )pytestconfigr0   r0   r1   strict_data_filesE  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.
    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 .)osr5   joinexists
ValueErrorr;   skip)r   r5   	BASE_PATHr  r0   r1   decob  s   
zdatapath.<locals>.deco)r  r5   r  dirname__file__)r  r  r0   r  r1   datapathM  s   
r  z
Asia/Tokyozdateutil/US/Pacificzdateutil/Asia/Singaporez+01:15z-02:15z	UTC+01:15z	UTC-02:15i,  i)hoursrC  r   r   c                 C  s   g | ]}t |qS r0   ro   r  r0   r0   r1   r     s    c                 C  rw   )zD
    Fixture for trying timezones including default (None): {0}
    rx   rz   r0   r0   r1   tz_naive_fixture  r   r  c                 C  rw   )z4
    Fixture for trying explicit timezones: {0}
    rx   rz   r0   r0   r1   tz_aware_fixture  r   r  r   zdateutil/UTCc                 C  rw   )zQ
    Fixture to provide variants of UTC timezone strings and tzinfo objects.
    rx   rz   r0   r0   r1   utc_fixture  r}   r  )rn  msusnsc                 C  rw   )z&
    datetime64 units we support.
    rx   rz   r0   r0   r1   ro    r}   ro  c                 C  rw   )zR
    Parametrized fixture for string dtypes.

    * str
    * 'str'
    * 'U'
    rx   rz   r0   r0   r1   string_dtype     	r  pythonpyarrow)string=string[python]string=string[pyarrow]string=str[pyarrow]string=str[python]c                 C  s   | j \}}t||S )z
    Parametrized fixture for string dtypes.
    * 'string[python]' (NA variant)
    * 'string[pyarrow]' (NA variant)
    * 'str' (NaN variant, with pyarrow)
    * 'str' (NaN variant, without pyarrow)
    )ry   rc   StringDtyper{   storagena_valuer0   r0   r1   string_dtype_no_object  s   
r  c                 C  rw   )za
    Parametrized fixture for string dtypes.

    * 'string[python]'
    * 'string[pyarrow]'
    rx   rz   r0   r0   r1   nullable_string_dtype     r  c                 C  s   t j| j S )zq
    Parametrized fixture for string dtypes backed by Pyarrow.

    * 'str[pyarrow]'
    * 'string[pyarrow]'
    )rc   r  ry   rz   r0   r0   r1   pyarrow_string_dtype  s   r  c                 C  rw   zb
    Parametrized fixture for pd.options.mode.string_storage.

    * 'python'
    * 'pyarrow'
    rx   rz   r0   r0   r1   string_storage  r  r  c                 C  rw   )z
    Parametrized fixture for StringDtype storage and na_value.

    * 'python' + pd.NA
    * 'pyarrow' + pd.NA
    * 'pyarrow' + np.nan
    rx   rz   r0   r0   r1   string_dtype_arguments  s   r  numpy_nullablec                 C  rw   r  rx   rz   r0   r0   r1   dtype_backend5  r  r  c                 C  rw   )zK
    Parametrized fixture for bytes dtypes.

    * bytes
    * 'bytes'
    rx   rz   r0   r0   r1   bytes_dtypeJ     r  c                 C  rw   )zN
    Parametrized fixture for object dtypes.

    * object
    * 'object'
    rx   rz   r0   r0   r1   object_dtypeU  r  r  )zstring=objectr  r  r  r  c                 C  s*   t | jtjr
| jS | j\}}t||S )z
    Parametrized fixture for string dtypes.
    * 'object'
    * 'string[python]' (NA variant)
    * 'string[pyarrow]' (NA variant)
    * 'str' (NaN variant, with pyarrow)
    * 'str' (NaN variant, without pyarrow)
    )r:  ry   rb   r  rc   r  r  r0   r0   r1   any_string_dtype`  s   
r  c                 C  rw   )z\
    Parametrized fixture for datetime64 dtypes.

    * 'datetime64[ns]'
    * 'M8[ns]'
    rx   rz   r0   r0   r1   datetime64_dtype  r  r  c                 C  rw   )z^
    Parametrized fixture for timedelta64 dtypes.

    * 'timedelta64[ns]'
    * 'm8[ns]'
    rx   rz   r0   r0   r1   timedelta64_dtype  r  r  r   c                	   C  s   t ddddddddS )z-
    Fixture emits fixed Timestamp.now()
    i  rZ   r[   r         )r   r^   r   hourminuter   microsecond)r   r0   r0   r0   r1   fixed_now_ts  s   r  c                 C  rw   )z^
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    rx   rz   r0   r0   r1   float_numpy_dtype  r  r  c                 C  rw   )zR
    Parameterized fixture for float dtypes.

    * 'Float32'
    * 'Float64'
    rx   rz   r0   r0   r1   float_ea_dtype  r  r  c                 C  rw   )z~
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    * 'Float32'
    * 'Float64'
    rx   rz   r0   r0   r1   any_float_dtype  r  r  c                 C  rw   )zg
    Parameterized fixture for complex dtypes.

    * complex
    * 'complex64'
    * 'complex128'
    rx   rz   r0   r0   r1   complex_dtype  r  r  c                 C  rw   )z
    Parameterized fixture for complex and numpy float dtypes.

    * complex
    * 'complex64'
    * 'complex128'
    * float
    * 'float32'
    * 'float64'
    rx   rz   r0   r0   r1   complex_or_float_dtype  s   r  c                 C  rw   )z|
    Parameterized fixture for signed integer dtypes.

    * int
    * 'int8'
    * 'int16'
    * 'int32'
    * 'int64'
    rx   rz   r0   r0   r1   any_signed_int_numpy_dtype  r  r  c                 C  rw   )zx
    Parameterized fixture for unsigned integer dtypes.

    * 'uint8'
    * 'uint16'
    * 'uint32'
    * 'uint64'
    rx   rz   r0   r0   r1   any_unsigned_int_numpy_dtype  r   r  c                 C  rw   )z
    Parameterized fixture for any integer dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    rx   rz   r0   r0   r1   any_int_numpy_dtype  r   r  c                 C  rw   )z
    Parameterized fixture for any nullable integer dtype.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    rx   rz   r0   r0   r1   any_int_ea_dtype  rr  r  c                 C  rw   )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'
    rx   rz   r0   r0   r1   any_int_dtype   s   r  c                 C  rw   )z
    Parameterized fixture for any nullable integer dtype and
    any float ea dtypes.

    * 'UInt8'
    * 'Int8'
    * 'UInt16'
    * 'Int16'
    * 'UInt32'
    * 'Int32'
    * 'UInt64'
    * 'Int64'
    * 'Float32'
    * 'Float64'
    rx   rz   r0   r0   r1   any_numeric_ea_dtype:  s   r  c                 C  rw   )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]'
    rx   rz   r0   r0   r1   any_numeric_ea_and_arrow_dtypeP  s    r  c                 C  rw   )z~
    Parameterized fixture for any signed nullable integer dtype.

    * 'Int8'
    * 'Int16'
    * 'Int32'
    * 'Int64'
    rx   rz   r0   r0   r1   any_signed_int_ea_dtypes  r   r  c                 C  rw   )z
    Parameterized fixture for any (purely) real numeric dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    rx   rz   r0   r0   r1   any_real_numpy_dtype  s   r  c                 C  rw   )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.
    rx   rz   r0   r0   r1   any_real_numeric_dtype  s   r  c                 C  rw   )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'
    rx   rz   r0   r0   r1   any_numpy_dtype  ru  r  c                 C  rw   )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]'
    rx   rz   r0   r0   r1   any_real_nullable_dtype  s   r  c                 C  rw   )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'
    rx   rz   r0   r0   r1   any_numeric_dtype  s   r  r  cmixedbytes   a   czmixed-integerr   g       @floatingg      ?integerzmixed-integer-floatdecimal
datetime64z
2013-01-01z
2018-01-01r  20180101r   i  i  complexy      ?      ?y       @       @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  )ry   rb   r   r  )r{   inferred_dtyperD  r0   r0   r1   any_skipna_inferred_dtype2  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.
    IPythonz6.0.0)
minversionr   )InteractiveShell)Configz:memory:)rN   )r;   importorskipIPython.core.interactiveshellr  traitlets.configr  HistoryManager	hist_file)r  r  r  r0   r0   r1   ipe  s   
r  )bsrcoocsccsrdiadoklilc                 C  s   t d}t|| jd S )z-
    Yields scipy sparse matrix classes.
    zscipy.sparse_matrix)r;   r  getattrry   )r{   sparser0   r0   r1   spmatrixx  s   
r  c                 C  s6   g | ]}t ttj|tjjr|d krttj|qS )Tick)
issubclassr  rc   offsetsr  )r   or0   r0   r1   r     s    
c                 C  rw   )zN
    Fixture for Tick based datetime offsets available for a time series.
    rx   rz   r0   r0   r1   tick_classes  r  r
  c                 C  s   | S r   r0   rq   r0   r0   r1   rs     s    c                 C  rw   )zk
    Simple fixture for testing keys in sorting methods.
    Tests None (no key) and the identity key.
    rx   rz   r0   r0   r1   sort_by_key  r   r  )r   NN)EgonVenkmanN)NCC1701Dr  r  #tuple[Hashable, Hashable, Hashable]c                 C  rw   )zP
    A 3-tuple of names, the first two for operands, the last for a result.
    rx   rz   r0   r0   r1   r     s   r   c                 C  rw   )zI
    Parametrize over __setitem__, loc.__setitem__, iloc.__setitem__
    rx   rz   r0   r0   r1   indexer_sli  r}   r  c                 C  rw   )z<
    Parametrize over loc.__getitem__, iloc.__getitem__
    rx   rz   r0   r0   r1   
indexer_li  r}   r  c                 C  rw   )z8
    Parametrize over __setitem__, iloc.__setitem__
    rx   rz   r0   r0   r1   
indexer_si  r}   r  c                 C  rw   )z7
    Parametrize over __setitem__, loc.__setitem__
    rx   rz   r0   r0   r1   
indexer_sl  r}   r  c                 C  rw   )z:
    Parametrize over at.__setitem__, loc.__setitem__
    rx   rz   r0   r0   r1   
indexer_al  r}   r  c                 C  rw   )z<
    Parametrize over iat.__setitem__, iloc.__setitem__
    rx   rz   r0   r0   r1   indexer_ial  r}   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silentr   r   r0   r0   r0   r1   using_array_manager  rj   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rc   optionsmodecopy_on_writer   r0   r0   r0   r1   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  r0   r0   r0   r1   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)rc   r  futureinfer_stringr0   r0   r0   r1   using_infer_string  s   r&  zEurope/Warsawzdateutil/Europe/Warsawc                 C  rw   )zE
    tzinfo for Europe/Warsaw using pytz, dateutil, or zoneinfo.
    rx   rz   r0   r0   r1   warsaw  r}   r'  c                   C  s   dS )N)r  pyarrow_numpyr0   r0   r0   r0   r1   arrow_string_storage  s   r)  r   )r3   r4   r5   r6   r7   r6   r(   r)   )r(   r   )r(   r   )r(   r#   )r(   r   )r(   r   )r  r6   r(   r  )r(   r   )r(   r  )r(   r  )r(   r6   (?  __doc__
__future__r   collectionsr   r   r   r   r   r   r  r	   operatorr  typingr
   r   dateutil.tzr   r   
hypothesisr   stnumpyrb   r;   pytzr   r   pandas._config.configr   pandas.util._test_decoratorsutil_test_decoratorstdpandas.core.dtypes.dtypesr   r   pandasrc   r   r   r   r   r   r   r   r   r   r   r   r    pandas._testing_testingtmpandas.corer!   pandas.core.indexes.apir"   r#   pandas.util.versionr$   collections.abcr%   r&   r  paImportErrorhas_pyarrowzoneinfoZoneInfoZoneInfoNotFoundErrorr2   r>   rQ   HealthChecktoo_slowhypothesis_health_checks__version__appenddiffering_executorssettingsregister_profiletupleload_profilesplitr8   r  tseriesr  clsregister_type_strategybuildsintegersbooleansfixturere   ri   r|   
axis_framer~   r   r   r   r   r   r   r   ry   
skip_if_nor   r   r   r   r   NULL_OBJECTSr   nulls_fixture2nanNaTr   unique_nulls_fixture2NP_NAT_OBJECTSr   np_nat_fixture2r   r   index_or_series2r   r   r   box_with_array2r   r   r   r   r   r  r
  r  r  rM  r  r   from_breakslinspacerF  r   r   r8  idxkeysrk   index_fixture2rM   r=  index_flat2rI  rN  rU  rW  rZ  _seriesr_  NARROW_NP_DTYPES_narrow_seriesrc  rd  PYTHON_DATA_TYPES_typ_objects_seriesre  rf  ri  rj  rl  rq  arithmetic_dunder_methodsrs  addraddsubrsubmulrmultruedivrtruedivfloordiv	rfloordivmodrmodpowrpoweqneltlegtgeand_rand_xorrxoror_ror_rt  rv  _all_numeric_reductionsr  _all_boolean_reductionsr  _all_reductionsr  r  r  r  _all_numeric_accumulationsr  r  r  	TIMEZONESextendTIMEZONE_IDSparametrize_fixture_docr6   r  r  tz_aware_fixture2_UTCSr  utc_fixture2ro  unit2STRING_DTYPESr  NAr  r  r  r  r  r  string_storage2string_dtype_arguments2BYTES_DTYPESr  OBJECT_DTYPESr  r  r  DATETIME64_DTYPESr  TIMEDELTA64_DTYPESr  r  FLOAT_NUMPY_DTYPESr  FLOAT_EA_DTYPESr  ALL_FLOAT_DTYPESr  COMPLEX_DTYPESr  COMPLEX_FLOAT_DTYPESr  SIGNED_INT_NUMPY_DTYPESr  UNSIGNED_INT_NUMPY_DTYPESr  ALL_INT_NUMPY_DTYPESr  ALL_INT_EA_DTYPESr  ALL_INT_DTYPESr  r  ALL_INT_PYARROW_DTYPES_STR_REPRFLOAT_PYARROW_DTYPES_STR_REPRr  SIGNED_INT_EA_DTYPESr  ALL_REAL_NUMPY_DTYPESr  ALL_REAL_DTYPESr  ALL_NUMPY_DTYPESr  ALL_REAL_NULLABLE_DTYPESr  ALL_NUMERIC_DTYPESr  r  _any_skipna_inferred_dtyperv   _r  r  r  __all__r
  r  r   setitemlocilocr  r  r  r  atr  iatr  r  r   r#  r&  warsawsr'  r)  r0   r0   r0   r1   <module>   s   8

<






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













	
 !"#$%) 

	
	



	







%








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