gL ie0=dZddlmZddlmZddlmZmZmZmZm Z ddl m Z ddl Z ddl Z ddlmZmZddlmZmZddlZdd lmZddlZddlZdd lmZmZdd lmZddlm cm!Z"dd l#m$Z$m%Z%ddl&Z'dd l&m(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3ddl4m5Z6ddl7m8Z8ddl9m:Z:m;Z;ddlm?Z?m@Z@ ddlAZB[BdZCddlEZE eEjddFdZHdGdZIdFdZJejjgZMe=eje=dk\r%eMjejjejjddeSeMejjddjD]eZVeWe'jjeVZZejeZejeZejddejgd jD]xZVeWe'jjeVZZejeZejeZejd!d"ejejd#d$%&zd'jD]xZVeWe'jjeVZZejeZejeZejd(d)ejejd#d$%*zejd+dFd,Z`ejd+dFd-Zaejgd.d/0d1ZbebZcejd#d2gd30d4Zdejgd56d7Zeejgd56d8Zfejddg6d9Zgejgd:6d;Zhejgd<6d=Ziejgd>6d?Zjejgd>6d@ZkejddAdBdCdDdEejdFe"jdGHg6dIZnejdAdBdCdDdEejdFe"jdGHg6dJZoejddg6dKZpejgdL6dMZqejdNdOg6dPZreje6jdQ0dRZtetZuejdeje'jg6dSZxexZyeje6jdT0dUZ{e{Z|eje)e.g6dVZ}eje:e.gdWdXg0dYZ~e~Zeje:e.e'jggdZ0d[Zeje:e.e)e'jgd\0d]ZeZejdHd^ZejdId_Zejd`ZejdJdaZej dKdbZdcZddZidee:edfDcgc]}dg| c}ehdie:edfDcgc]}dg| c}dhdje1dkdfldme1dkdfdnodpe2dkdfdqrdse3dtdfdqudve-dfdwe:ejdfdwhdxe:ejdfdxhdye:ejdfdyhdze:ejdfdzhd{e:ejdfd{hd|e:ejdfd|hd}e:ejdfd}hd~e:ejdfd~hde:ejdfdhde:ejdfdhide:ddgd"zehde:ddgd"zehde:ejdfdhdejdfdhzzde:ejdfdhdejdfdhzzde(eddzde+j ej"ddfdde:gde;j$egdgddedede:gdde:ejdfdhde:ejdfdhde:ejdfdhde:ejdfj)edhde:e'jedfDcgc]}dg| c}dhZeCr7e:e'jedfDcgc]}dg| c}dhZeed<ejej/6dZeZejej5Dcgc]\}}e|e;r|c}}6dZeZejej5Dcgc]&\}}|j=ds|dvs e|e;s|(c}}6dZejdLdZejdLdZejdLdZdZej5Dcic]\}}d|de|c}}ZejdLdZe6jLDcic]:}|jNde.ededDcgc]}d| c}d|<c}}ZieeeZejej/6dZe6jVDcic]}|jNde.|c}ZieeeeZejej/6dZejdKdZejdKdZejdLdZeje*dd"e%dzdfe*dde%ddfe,dddfe,ddqdfe0dd«e$ddīfe/dŬƫdfg6dȄZeje6jf6dɄZeje jje8jle jne8jpe jre8jte jve8jxe jze8j|e j~e8je je8je je je je je je je je8je je8je je8jg6dʄZeje jje8jle jne8jpe jre8jte jve8jxe jze8j|e j~e8je je8jg6d˄Zgd̢ZejeѬ6d̈́ZddgZejeӬ6dЄZeezZejeլ6dфZeje je je je je je jg6d҄ZejgdӢ6dԄZejgdբ6dքZgdעZejeڬ6d؄ZejdلZejdMdڄZddddddddddeeededede j8e ed#e eddgZeE4eސjeEjdneEjdgeDcgc] }e| c}Ze"jeeejee0dZe"jeed#dejed#ded#d0dZeZddeee j8gZeE!ejeEjdeje6dZeZejgd6dZeZeje6j6dZejde'jfejde'jfe"jdHejdejfe"jdHdejfggd0dZejdejde"jdHg6dZejejdejfe"jdHejde'jfe"jdHg6dZejdejde"jdHg6dZejde'jfejde'jfe"jdHejdejfe"jdHdejfggd0dZejdejde"jdHg6dZeZeZeje6j6dZeje6j6dZejejdede'jfejde'jfe"jdHejdejfe"jdHdejfggd0dZeje6j6dZeje6j6dZejdNdZeje6j6dZeje6j6dZeje6j 6dZeje6j6dZ eje6j6dZ eje6j6dZ eje6j6dZeje6j 6dZeje6j$6d Zeje6j(6d Zeje6j$e6jz6d Zeje6j$e6jze6j.ze6j0z6d Zeje6j46d Zeje6j86dZeje6j<6dZeje6j@6dZ!eje6jD6dZ#eje6jH6dZ%didejdgfdide'jdgfdde'jdgfddejdgfdejejejgfdgfddejdgfddejdgfddejdgfdd#ejdgfdd#ejdgfde d#eje dgfddejdgfdde'jdgfd ejLd!ejejLd"gfdje0d#eje0d$gfd%ed&d#d#ejed'd#d#gfd(d)ejd*gfdsed#ejedgfd+ed#ejedgfdpe,d&e'je,d'gfde*dd#eje*ddgfgZ'ee'\Z(Z)eje'e(0d,Z*ejd-Z+ejgd.6d/Z,eje'jjZDcgc]K}e.eWe'j|e'jj^r|d0k7reWe'j|Mc}6d1Z0ejdd2g6d3Z1ejd4d5d6ejejejfeje'jdfeje'jdfe'je'je'jfg6dOd7Z2eje6jfe6jhe6jjg6d8Z6eje6jhe6jjg6d9Z7eje6jfe6jjg6d:Z8eje6jfe6jhg6d;Z9eje6jte6jhg6d<Z;eje6jxe6jjg6d=Z=ejdPd>Z>ejdPd?Z?ejdPd@Z@ejdPdAZAdBdCgZBeE#eBjeEjdBejeB6dQdDZCejdEZDy#eD$rdZCYwxYw#eEj$rdZEYwxYwcc}wcc}wcc}wcc}wcc}}wcc}}wcc}}wcc}wcc}}wcc}wcc}wcc}w(Ra 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)datedatetimetime timedeltatimezone)DecimalN) TYPE_CHECKINGCallable)tzlocaltzutc) strategies) FixedOffsetutc _get_option)DatetimeTZDtype IntervalDtype) CategoricalIndex DataFrameInterval IntervalIndexPeriod RangeIndexSeries Timedelta Timestamp date_range period_rangetimedelta_range)ops)Index MultiIndex)Version)HashableIteratorTFUTCc,|jdddy)N--no-strict-data-files store_falsez6Don't fail if a test is skipped for missing data file.)actionhelp) addoption)parsers U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pandas/conftest.pypytest_addoptionr1os   Estrc|jj|r2|jtjj d|yy)aIgnore 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. zignore:N)nameendswith add_markerpytestmarkfilterwarnings)itempathmessages r0ignore_doctest_warningr>ws= yy$  22WWI3FGH r2c|jdxs|jdd}gd}|r|D]}|D]\}}t|||yy)Nz--doctest-modulesz--doctest-cythonF)default))is_int64_dtypezis_int64_dtype is deprecated)is_interval_dtypezis_interval_dtype is deprecated)is_period_dtypezis_period_dtype is deprecated)is_datetime64tz_dtypez#is_datetime64tz_dtype is deprecated)is_categorical_dtypez"is_categorical_dtype is deprecated) is_sparsezis_sparse is deprecated)DataFrameGroupBy.fillnaz%DataFrameGroupBy.fillna is deprecated)NDFrame.replacezThe 'method' keyword)rHzSeries.replace without 'value')z NDFrame.clipz4Downcasting behavior in Series and DataFrame methods)z Series.idxminThe behavior of Series.idxmin)z Series.idxmaxThe behavior of Series.idxmax)zSeriesGroupBy.fillnaz"SeriesGroupBy.fillna is deprecated)zSeriesGroupBy.idxminrI)zSeriesGroupBy.idxmaxrJ)zmissing.mask_zero_div_zerozdivide 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)zResampler.fillnaz+DatetimeIndexResampler.fillna is deprecated)rGz3DataFrameGroupBy.fillna with 'method' is deprecated)rGz,DataFrame.fillna with 'method' is deprecated) read_parquetz1Passing a BlockManager to DataFrame is deprecated) getoptionr>)itemsconfig is_doctestignored_doctest_warningsr;r<r=s r0pytest_collection_modifyitemsrRsq!!"56&:J:JE;K;J - ^ rvs5a ARr2)paramsidsc|jS)z@ Fixture for returning the axis numbers of a DataFrame. paramrequests r0axisr~ ==r2rocdt|Srqrrrts r0rvrvsuT!WI5Fr2c|jS)zA Fixture for returning aliases of axis 1 of a DataFrame. rzr|s r0axis_1rrr2)TFN)rwc|jS)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). rzr|s r0observedr' ==r2c|jS)z6 Boolean 'ordered' parameter for Categorical. rzr|s r0orderedr4rr2c|jS)z% Boolean 'skipna' parameter. rzr|s r0skipnar<rr2)firstlastFc|jS)z[ Valid values for the 'keep' parameter used in .duplicated or .drop_duplicates rzr|s r0keeprD ==r2)bothneitherleftrightc|jS)zA Fixture for trying all interval 'inclusive' parameters. rzr|s r0inclusive_endpoints_fixturerMrr2)rrrrc|jS)z< Fixture for trying all interval closed parameters. rzr|s r0closedrUrr2c|jS)zS Secondary closed fixture to allow parametrizing over all pairs of closed. rzr|s r0 other_closedr]rr2gzipbz2zipxztarzstd zstandard)marksc|jS)zK Fixture for trying common compression types in compression tests. rzr|s r0 compressionre ==r2c|jS)zk Fixture for trying common compression types in compression tests excluding uncompressed case. rzr|s r0compression_onlyrwrr2c|jS)z, Fixture that an array is writable. rzr|s r0writablerrr2)innerouterrrc|jS)z: Fixture for trying all types of join operations. rzr|s r0 join_typerrr2nlargest nsmallestc|jS)z1 Fixture for trying all nselect methods. rzr|s r0nselect_methodrrr2c,t|jSNtype__name__rts r0rvrvsd1g6F6Fr2c|jS)z/ Fixture for each null type in pandas. rzr|s r0 nulls_fixturerrr2c|jS)zL Fixture for each null type in pandas, each null type exactly once. rzr|s r0unique_nulls_fixturerrr2c,t|jSrrrts r0rvrvsQ8H8Hr2c|jS)z- Fixture for each NaT type in numpy. rzr|s r0np_nat_fixturerrr2c|jS)z; Fixture to parametrize over DataFrame and Series. rzr|s r0frame_or_seriesrrr2rnseriesc|jS)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 rzr|s r0index_or_seriesrrr2)rnrarrayc|jS)zG Fixture to parametrize over Index, Series, and ExtensionArray rzr|s r0index_or_series_or_arrayrrr2c|jSr)rrts r0rvrvs 1::r2c|jS)z] Fixture to test behavior for Index, Series, DataFrame, and pandas Array classes rzr|s r0box_with_arrayrrr2c$Gddt}|S)z, Fixture for a dictionary subclass. ceZdZddZy)"dict_subclass..TestSubDictc6tj|g|i|yr)dict__init__)selfargskwargss r0rz+dict_subclass..TestSubDict.__init__s MM$ 0 0 0r2NreturnNone)r __module__ __qualname__rrlr2r0 TestSubDictrs 1r2r)r)rs r0 dict_subclassrs 1d1 r2c8Gddtj}|S)z8 Fixture for a non-mapping dictionary subclass. c*eZdZddZdZddZddZy) 5non_dict_mapping_subclass..TestNonDictMappingc||_yr)_data)runderlying_dicts r0rz>non_dict_mapping_subclass..TestNonDictMapping.__init__ s (DJr2c8|jj|Sr)r __getitem__)rkeys r0rzAnon_dict_mapping_subclass..TestNonDictMapping.__getitem__s::))#. .r2c6|jjSr)r__iter__rs r0rz>non_dict_mapping_subclass..TestNonDictMapping.__iter__s::&&( (r2c6|jjSr)r__len__rs r0rz=non_dict_mapping_subclass..TestNonDictMapping.__len__s::%%' 'r2Nr)rr')rint)rrrrrrrrlr2r0TestNonDictMappingr s ) / ) (r2r)rMapping)rs r0non_dict_mapping_subclassrs (S[[ ( r2c ttjjdj dt t dtddd}|jd d d gj}|jj|jjDcgc]}|jd c}|_ |jjgd d|Scc}w)z DataFrame with 3 level MultiIndex (year, month, day) covering first 100 business days from 2000-01-01 with random data )dABCD 2000-01-01rBperiodsfreq)rornc|jSr)yearrts r0rvzAmultiindex_year_month_day_dataframe_random_data..*s r2c|jSr)r_rts r0rvzAmultiindex_year_month_day_dataframe_random_data..*s 177r2c|jSr)dayrts r0rvzAmultiindex_year_month_day_dataframe_random_data..*s aeer2i8)rr_rT)inplace)rrdrandom default_rngstandard_normalr#listrgroupbysumrn set_levelslevelsastype set_names)tdfymdlevs r0/multiindex_year_month_day_dataframe_random_datars  a 00:d6l#s= C ++'):OL M Q Q SC $$#))BRBR%S3cjj&6%STCIII0$? J&Ts+C0c:tgdgdggdgdgddgS)z; 2-level MultiIndex, lexsorted, with string names. foobarbazquxonetwothree) rrrr[r[rrrr) rr[rrr[r[rrr[rrsecond)rcodesnames)r$rlr2r0%lexsorted_two_level_string_multiindexr1s+ ,.EF-/MN! r2c|}ttjjdj d|t gddS)z2DataFrame with 2 level MultiIndex with random datar) r)ArCexpr5rnro)rrdrrrr#)rrns r0 multiindex_dataframe_random_datar=s@ 2E  a 009oE2 r2ctgd}tddg}tjgd}tjgd}ddg}t||g||g|d S) zJ MultiIndex used to test the general functionality of this object r rr)rrr[rrr)rr[rr[rr[rrF)rrrverify_integrity)r#rdrr$) major_axis minor_axis major_codes minor_codes index_namess r0_create_multiindexr&Jsh 34Ju~&J((-.K((-.KH%K J'K(  r2c Ztjddgddgtdddggd  S) zB MultiIndex with a level that is a tzaware DatetimeIndex. r[rab20130101r US/Easternrtzr)r)r$ from_productrrlr2r0_create_mi_with_dt64tz_levelr/^s5  " " Q#sZ A,OP% r2objectrpandas_dtypestringrz 2020-01-01)rz datetime-tzz US/Pacificr,periodDrrz1 day)startrrrangeint8int16int32int64uint8uint16uint32uint64float32float64z bool-object bool-dtype complex64y? complex128 categoricalabcdintervale)numemptytuples)r r r )r[rrmi-with-dt64tz-levelmultirepeats)rrr[r[rr nullable_intInt64 nullable_uintUInt16nullable_floatFloat32 nullable_boolbooleanz string-pythonzstring[python]zstring[pyarrow]zstring-pyarrowcDt|jjS)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_dictr{copyr|s r0rnrns  & + + --r2cH|j}t|jS)z8 index fixture, but excluding MultiIndex cases. )r{rZr[)r}rs r0 index_flatr]s! --C   ! ! ##r2)ruintfloat)r8rLrPrCcPt|jjd}|jj}|jdvrA|j }d|dddz|d<d|dddz|d<t j |Sd|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. Tdeep)rMrNrOrrr[N)rZr{r[valuestolistr$ from_tuplesr)r}indvalss r0index_with_missingris. w}} % * * * 5C ::?? D}}CCzz|DGABK'QT"Xab\)R%%d++QRtCyr2c ttjdtjdzt t dDcgc]}d| c}dScc}w)zC Fixture for Series of floats with Index of unique strings r2g?i_rrnr5)rrdarangerBr#r8is r0 string_seriesrqsK  "BJJ'#-uRy1!r!X12  1s ActdDcgc]}d| }}ttdDcgc]}d| c}}t||dtScc}wcc}w)zI Fixture for Series of dtype object with Index of unique strings rkfoo_bar_objectsrnr5r3)r8r#rr0)rpdatarns r0 object_seriesrxsY !&b *1d1#J *D * uRy1!T!:1 2E $e)6 BB +1s A Acttjjdj dt ddddS)z9 Fixture for Series of floats with DatetimeIndex rrkrrrtsrm)rrdrrrrrlr2r0datetime_seriesr{s=  a 004r<  r2ct|}tjjdj |}t ||ddS)zHelper for the _series dictrr(F)rnr5r[)lenrdrrrr)rnsizerws r0_create_seriesrs; u:D 99  # 3 3D 9D $e#E ::r2z series-with-z-indexct|S)zE Fixture for tests on series with changing types of indices. )rrns r0series_with_simple_indexrs %  r2z-seriesrkzi-r(rvcHt|jjdS)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_objsr{r[r|s r0index_or_series_objr%s! ! / 4 4$ 4 ??r2cHt|jjdS)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_objsr{r[r|s r0index_or_series_memory_objr;s! ( 6 ; ; ; FFr2c ttjdtjt t dDcgc]}d| c}t t dScc}w)zj Fixture for DataFrame of ints with index of unique strings Columns are ['A', 'B', 'C', 'D'] rkrr2rkrsrr)rrdonesr<r#r8rros r0 int_framerHsO  rxx(r3AtA3Z34d6l# 3s A'c ttjjdj dt t dDcgc]}d| c}t tdScc}w)zm Fixture for DataFrame of floats with index of unique strings Columns are ['A', 'B', 'C', 'D']. rrrkrsrr)rrdrrrr#r8rros r0 float_framerVsZ  a 009r3AtA3Z34d6l# 3s A0cztdddtdddtdddtdddtdddtdddtdddtdddtdddtdddg }ttjj dj t ||S)zF Fixture for Series with a DatetimeIndex that has duplicates. ir[rrrrZr)rrrdrrrr})datess r0(rand_series_with_duplicate_datetimeindexrds q!q!q!q!q!q!q!q!q!q! E "))''*::3u:Fe TTr2)rrrg?g?z2012-01M)rz period[M]z 2012-02-01z period[D]z 2011-01-01r+)r-s)unitr-i)secondsztimedelta64[ns]c|jSrrzr|s r0ea_scalar_and_dtyper| ==r2c|jS)zD Fixture for dunder names for common arithmetic operations. rzr|s r0all_arithmetic_operatorsrrr2c|jS)zU Fixture for operator and roperator arithmetic, comparison, and logical ops. rzr|s r0all_binary_operatorsrD ==r2c|jS)z Fixture for operator and roperator arithmetic functions. Notes ----- This includes divmod and rdivmod, whereas all_arithmetic_operators does not. rzr|s r0all_arithmetic_functionsrs6 ==r2) countrmaxminmeanprodstdvarmediankurtskewsemc|jS)z. Fixture for numeric reduction names. rzr|s r0all_numeric_reductionsrrr2allanyc|jS)z. Fixture for boolean reduction names. rzr|s r0all_boolean_reductionsrrr2c|jS)z> Fixture for all (boolean + numeric) reduction names. rzr|s r0all_reductionsrrr2c|jS)z; Fixture for operator module comparison functions. rzr|s r0 comparison_opr rr2)__le____lt____ge____gt__c|jS)zm Fixture for dunder names for compare operations except == and != * >= * > * < * <= rzr|s r0compare_operators_no_eq_nerrr2)__and____rand____or____ror____xor____rxor__c|jS)zY Fixture for dunder names for common logical operations * | * & * ^ rzr|s r0all_logical_operatorsr) ==r2)cumsumcumprodcummincummaxc|jS)z0 Fixture for numeric accumulation names rzr|s r0all_numeric_accumulationsr:rr2c$|jdS)zR Returns the configuration for the test setting `--no-strict-data-files`. r*)rM) pytestconfigs r0strict_data_filesrEs  ! !": ;;r2ctjjtjjtdfd}|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. testsctjjg|}tjj|s*rt d|dt j d|d|S)NzCould not find file z' and --no-strict-data-files is not set.zCould not find .)osr<joinexists ValueErrorr8skip)rr< BASE_PATHrs r0decozdatapath..decobscww||I--ww~~d#  *4&0WX KK/$q1 2 r2)rr<rdirname__file__)rrrs` @r0datapathrMs2& RWW__X6@I Kr2z Asia/Tokyozdateutil/US/Pacificzdateutil/Asia/Singaporez+01:15z-02:15z UTC+01:15z UTC-02:15i,i)hoursrcr rc|jS)zD Fixture for trying timezones including default (None): {0} rzr|s r0tz_naive_fixturerrr2c|jS)z4 Fixture for trying explicit timezones: {0} rzr|s r0tz_aware_fixturerrr2rz dateutil/UTCc|jS)zQ Fixture to provide variants of UTC timezone strings and tzinfo objects. rzr|s r0 utc_fixturerrr2)rmsusnsc|jS)z& datetime64 units we support. rzr|s r0rrrr2c|jS)zR Parametrized fixture for string dtypes. * str * 'str' * 'U' rzr|s r0 string_dtyper ==r2pythonpyarrow)string=string[python]string=string[pyarrow]string=str[pyarrow]string=str[python]cL|j\}}tj||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) )r{re StringDtyper}storagena_values r0string_dtype_no_objectrs#0 GX >>'8 ,,r2c|jS)za Parametrized fixture for string dtypes. * 'string[python]' * 'string[pyarrow]' rzr|s r0nullable_string_dtyper ==r2c:tj|jS)zq Parametrized fixture for string dtypes backed by Pyarrow. * 'str[pyarrow]' * 'string[pyarrow]' )rerr{r|s r0pyarrow_string_dtypers >>7== ))r2c|jSzb Parametrized fixture for pd.options.mode.string_storage. * 'python' * 'pyarrow' rzr|s r0string_storager rr2c|jS)z Parametrized fixture for StringDtype storage and na_value. * 'python' + pd.NA * 'pyarrow' + pd.NA * 'pyarrow' + np.nan rzr|s r0string_dtype_argumentsrs, ==r2numpy_nullablec|jSrrzr|s r0 dtype_backendr5rr2c|jS)zK Parametrized fixture for bytes dtypes. * bytes * 'bytes' rzr|s r0 bytes_dtyperJ ==r2c|jS)zN Parametrized fixture for object dtypes. * object * 'object' rzr|s r0 object_dtyperUrr2)z string=objectrrrrct|jtjr |jS|j\}}t j ||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) ) isinstancer{rdr3rerrs r0any_string_dtyper `sA2'--*}}$MM~~gx00r2c|jS)z\ Parametrized fixture for datetime64 dtypes. * 'datetime64[ns]' * 'M8[ns]' rzr|s r0datetime64_dtyper rr2c|jS)z^ Parametrized fixture for timedelta64 dtypes. * 'timedelta64[ns]' * 'm8[ns]' rzr|s r0timedelta64_dtyper rr2c &tdddddddS)z- Fixture emits fixed Timestamp.now() ir[r\r )rr_rhourminuter microsecond)rrlr2r0 fixed_now_tsrs  1RR r2c|jS)z^ Parameterized fixture for float dtypes. * float * 'float32' * 'float64' rzr|s r0float_numpy_dtyperrr2c|jS)zR Parameterized fixture for float dtypes. * 'Float32' * 'Float64' rzr|s r0float_ea_dtyperrr2c|jS)z~ Parameterized fixture for float dtypes. * float * 'float32' * 'float64' * 'Float32' * 'Float64' rzr|s r0any_float_dtyperrr2c|jS)zg Parameterized fixture for complex dtypes. * complex * 'complex64' * 'complex128' rzr|s r0 complex_dtyperrr2c|jS)z Parameterized fixture for complex and numpy float dtypes. * complex * 'complex64' * 'complex128' * float * 'float32' * 'float64' rzr|s r0complex_or_float_dtypers ==r2c|jS)z| Parameterized fixture for signed integer dtypes. * int * 'int8' * 'int16' * 'int32' * 'int64' rzr|s r0any_signed_int_numpy_dtyper rr2c|jS)zx Parameterized fixture for unsigned integer dtypes. * 'uint8' * 'uint16' * 'uint32' * 'uint64' rzr|s r0any_unsigned_int_numpy_dtyper"rr2c|jS)z Parameterized fixture for any integer dtype. * int * 'int8' * 'uint8' * 'int16' * 'uint16' * 'int32' * 'uint32' * 'int64' * 'uint64' rzr|s r0any_int_numpy_dtyper$rr2c|jS)z Parameterized fixture for any nullable integer dtype. * 'UInt8' * 'Int8' * 'UInt16' * 'Int16' * 'UInt32' * 'Int32' * 'UInt64' * 'Int64' rzr|s r0any_int_ea_dtyper&rr2c|jS)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' rzr|s r0 any_int_dtyper( s. ==r2c|jS)z Parameterized fixture for any nullable integer dtype and any float ea dtypes. * 'UInt8' * 'Int8' * 'UInt16' * 'Int16' * 'UInt32' * 'Int32' * 'UInt64' * 'Int64' * 'Float32' * 'Float64' rzr|s r0any_numeric_ea_dtyper*:s" ==r2c|jS)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]' rzr|s r0any_numeric_ea_and_arrow_dtyper,Ps@ ==r2c|jS)z~ Parameterized fixture for any signed nullable integer dtype. * 'Int8' * 'Int16' * 'Int32' * 'Int64' rzr|s r0any_signed_int_ea_dtyper.srr2c|jS)z Parameterized fixture for any (purely) real numeric dtype. * int * 'int8' * 'uint8' * 'int16' * 'uint16' * 'int32' * 'uint32' * 'int64' * 'uint64' * float * 'float32' * 'float64' rzr|s r0any_real_numpy_dtyper0s$ ==r2c|jS)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. rzr|s r0any_real_numeric_dtyper2s( ==r2c|jS)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' rzr|s r0any_numpy_dtyper4rr2c|jS)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]' rzr|s r0any_real_nullable_dtyper6s: ==r2c|jS)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' rzr|s r0any_numeric_dtyper8s> ==r2cmixedbytesacz mixed-integerrg@floatingg?integerzmixed-integer-floatdecimal datetime64z 2013-01-01z 2018-01-01r*20180101riicomplexy??y@@rc^|j\}}tj|t}||fS)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 r2)r{rdrr0)r}inferred_dtyperds r0any_skipna_inferred_dtyperF2s0R%]]NF XXfF +F 6 !!r2ctjddddlm}ddlm}|}d|j _||S) zj Get an instance of IPython.InteractiveShell. Will raise a skip if IPython is not installed. IPythonz6.0.0) minversionr)InteractiveShell)Configz:memory:)rO)r8 importorskipIPython.core.interactiveshellrJtraitlets.configrKHistoryManager hist_file)rJrKr9s r0iprQes<  g6>(A!+A 1 %%r2)bsrcoocsccsrdiadoklilc^tjd}t||jdzS)z- Yields scipy sparse matrix classes. z scipy.sparse_matrix)r8rLgetattrr{)r}sparses r0spmatrixr]xs*   0F 67==94 55r2Tickc|jS)zN Fixture for Tick based datetime offsets available for a time series. rzr|s r0 tick_classesr`rr2c|Srrlrts r0rvrvsr2c|jS)zk Simple fixture for testing keys in sorting methods. Tests None (no key) and the identity key. rzr|s r0 sort_by_keyrcrr2)r NN)EgonVenkmanN)NCC1701Drfrfc|jS)zP A 3-tuple of names, the first two for operands, the last for a result. rzr|s r0rrs ==r2c|jS)zI Parametrize over __setitem__, loc.__setitem__, iloc.__setitem__ rzr|s r0 indexer_slirirr2c|jS)z< Parametrize over loc.__getitem__, iloc.__getitem__ rzr|s r0 indexer_lirkrr2c|jS)z8 Parametrize over __setitem__, iloc.__setitem__ rzr|s r0 indexer_sirmrr2c|jS)z7 Parametrize over __setitem__, loc.__setitem__ rzr|s r0 indexer_slrorr2c|jS)z: Parametrize over at.__setitem__, loc.__setitem__ rzr|s r0 indexer_alrqrr2c|jS)z< Parametrize over iat.__setitem__, iloc.__setitem__ rzr|s r0 indexer_ialrsrr2c"tdddk(S)z> Fixture to check if the array manager is being used. mode.data_managerTsilentrrrlr2r0using_array_managerrxs *4 8G CCr2crtjjjduxrt dddk(S)z7 Fixture to check if Copy-on-Write is enabled. Trurvblockreoptionsmode copy_on_writerrlr2r0using_copy_on_writers5 %%- E +D 9W Dr2cttjjjdk(xrt dddk(S)z? Fixture to check if Copy-on-Write is in warning mode. warnruTrvrzr{rlr2r0warn_copy_on_writers5 %%/ E +D 9W Dr2cNtjjjduS)z= Fixture to check if infer string option is enabled. T)rer|future infer_stringrlr2r0using_infer_stringrs ::   ) )T 11r2z Europe/Warsawzdateutil/Europe/Warsawc|jS)zE tzinfo for Europe/Warsaw using pytz, dateutil, or zoneinfo. rzr|s r0warsawrrr2cy)N)r pyarrow_numpyrlrlr2r0arrow_string_storagers 'r2r)r;z pytest.Itemr<r3r=r3rr)rz type[dict])rztype[abc.Mapping])rr$)rr)rr)rr3rzCallable[..., str])rr)rz#tuple[Hashable, Hashable, Hashable])rbool)rr3(E__doc__ __future__r collectionsrrrrrr r@r operatorrtypingr r dateutil.tzr r hypothesisrstnumpyrdr8pytzrrpandas._config.configrpandas.util._test_decoratorsutil_test_decoratorstdpandas.core.dtypes.dtypesrrpandasrerrrrrrrrrrr r!pandas._testing_testingtm pandas.corer"pandas.core.indexes.apir#r$pandas.util.versionr%collections.abcr&r'rpa has_pyarrow ImportErrorzoneinfoZoneInfoZoneInfoNotFoundErrorr1r>rR HealthChecktoo_slowhypothesis_health_checks __version__appenddiffering_executorssettingsregister_profiletuple load_profilesplitr5r[tseriesoffsetsclsregister_type_strategybuildsintegersbooleansfixturergrmr~ axis_framerrrrrrrrr{ skip_if_norrrrr NULL_OBJECTSrnulls_fixture2nanNaTrunique_nulls_fixture2NP_NAT_OBJECTSrnp_nat_fixture2rrindex_or_series2rrrbox_with_array2rrrrrr&r/r8r0rnrr from_breakslinspacerfrrrZidxkeysrnindex_fixture2rNrr] index_flat2 startswithrirqrxr{r_seriesrNARROW_NP_DTYPESr_narrow_seriesrrPYTHON_DATA_TYPES_typ_objects_seriesrrrrrrarithmetic_dunder_methodsraddraddsubrsubmulrmultruedivrtruedivfloordiv rfloordivmodrmodpowrpoweqneltlegtgeand_rand_xorrxoror_ror_rr_all_numeric_reductionsr_all_boolean_reductionsr_all_reductionsrrrr_all_numeric_accumulationsrrr TIMEZONESextendrs TIMEZONE_IDSparametrize_fixture_docr3rrtz_aware_fixture2_UTCSr utc_fixture2runit2 STRING_DTYPESrNArrrrrrstring_storage2string_dtype_arguments2 BYTES_DTYPESr OBJECT_DTYPESrr3r DATETIME64_DTYPESr TIMEDELTA64_DTYPESr rFLOAT_NUMPY_DTYPESrFLOAT_EA_DTYPESrALL_FLOAT_DTYPESrCOMPLEX_DTYPESrCOMPLEX_FLOAT_DTYPESrSIGNED_INT_NUMPY_DTYPESr UNSIGNED_INT_NUMPY_DTYPESr"ALL_INT_NUMPY_DTYPESr$ALL_INT_EA_DTYPESr&ALL_INT_DTYPESr(r*ALL_INT_PYARROW_DTYPES_STR_REPRFLOAT_PYARROW_DTYPES_STR_REPRr,SIGNED_INT_EA_DTYPESr.ALL_REAL_NUMPY_DTYPESr0ALL_REAL_DTYPESr2ALL_NUMPY_DTYPESr4ALL_REAL_NULLABLE_DTYPESr6ALL_NUMERIC_DTYPESr8rA_any_skipna_inferred_dtyperx_rFrQr]__all__ issubclassr^r`rcrsetitemlocilocrirkrmroatrqiatrsrxrrrwarsawsrr)rprvalueindex_idrnr3os0000000r0r#s&#  '  .))     (  KHeI$9        V=2==#=>    e}%&:;< K012r,FGHbffbff-./-r((.HIJ! 6*+,vWh,?@ A #vrxx06RSTvy"((;AUVW!  0"   (( eE#J7qwqc]7vF( eE#J7qwqc]7uE( <5(:lCLI (  l<3? ( w#F ( Z_( E)"))C. /( U9299S> 1( U9299S> 1( U9299S> 1( U9299S> 1( eIBIIcN(3( eIBIIcN(3( eIBIIcN(3( uYRYYs^95!("uYRYYs^95#($5$*&9%(&%u )6'(( #[)D9299S 3T,TT)(.% #\*TIBIIc4V-VV/(4#DL2$565(6) ))+"++a#*FG7(8 U2Y9(: $j$$S)> %JK;(<8:=(>  !?(@u'(A(BE)"))C.8C(DU9299S>:E(FeIBIIcN)006iHI(JUs4AGA3-4;O;O27u~~gu -        388:;G<G    UU. q "M'7$CD s# & i(IJ   $k2  3 '5 l| 4  6  3 !23   r3345                        5 <=<             $ %$   ./0!%../0*,CC'(         ?@ A  NG123<<J     G IN LL YQ   YR u-%  (   H  l + H  e $  "++AQ+ C -.yl34/C QR 012y},qr*:;<3% UWhll;  LL"""5)*u ./0  r''() 255 i'}r}}Y/GH i(  i0HI 266      -  - &mbmmI.FG     i(  i0HI i'}r}}Y/GH  *  * YmbmmI&>?     255 i'}r}}Y/GH i(  i0HI 266       YmbmmI&>?    !0r'(r''() 255 i'}r}}Y/GH i(  i0HI 266    1! 1$r++,-r,,-.r,,-.r))*+r**+ , r(()*r../ 0 r112 3 r334 5 r../0"r++, -  r(()*2r++b.@.@@AB*   (( ) && '   :r../ 0 r//01(r))*+,r**+!,!Hr2234>r,,-.FRVVS!" RUUC ! sBFFC ! tRVVT"# rvvrvvrvv&' bMsBFFA&' sBFFC !#rvvs#$BFFAQ,-RVVWQZ01rvvu%&ruue$%MBMM,/|9TUV)J':1FGH d4AT1a(8 9:()9Q<167 d1grvvtAw '( t bfffTl34(1a."&&(1a.9:36 ( )Q1s;,"<,"d&&$HI6J6##  gbjj!,bjjoo >1;  A k*+,!,    ruu    BFFBGG456()* BGG,-. BFF+,-rvv'(()*DD22 4 5  NN$8$$_56w ((k=K%%HJ87H5=0 " `  7(~ ,l s1Ax2=Ay Ay 0 Ay 7 Ay"- Ay' Ay, 'Ay, +Ay2 )Ay8('Az Ay> Az*Az C!AzlAAzx2Ax=x<Ax=yAyyAyy>Az