
    Mh                   T   S r SSKJr  SSKrSSKJr  SSKJrJrJrJ	r	J
r
  SSKrSSKJr  SSKJr  SSKrSSKrSSKrSSKJr  SS	KJrJrJrJrJrJr  SSKrSSKrSS
KJr  SSK J!r!J"r"J#r#  SSK$J%r%  SSK&J'r(J)r)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0  SSK1J2r2  SSK3J4r4  SSK5J6r7  SSK8J9r9J:r:J;r;J<r<J=r=J>r>  SSK?J@r@JArAJBrBJCrC  SSKDJErEJFrF  SSKGJHrHJIrIJJrJ  SSKKJLrLJMrMJNrNJOrOJPrPJQrQJRrRJSrSJTrT  SSKUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\J]r]J^r^J_r_J`r`JaraJbrbJcrcJdrdJereJfrf  SSKgJhrh  SSKiJjrjJkrkJlrl  SSKmJnrnJoro  SSKpJqrqJrrsJtrtJuruJvrv  SSKwJxrx  SSKyJzrz  SS K{J|r|  SS!K}J~r~  SS"KJrJrJrJrJr  SS#KJr  SS$KJrJrJr  SS%KJrJr  SS&KJr  SS'KJrJrJrJrJrJr  SS(KJrJr  SS)KJrJr  SS*KJrJr  SS+KJrJrJrJrJrJrJrJrJrJr  SS,KJr  SS-KJr  SS.KJr  SS/KJr  SS0KJrJrJr  SS1KJr  SS2KJrJr  SS3KJrJrJr  SSKr\(       a  SSKrSS4KJr  SS5KJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  SS6KJr  SS7KJr  SS8KJr  SS9KJr  S:S;S<S=S>S?S@SA.rSBGr  " SC S;\\~5      rSFSD jGr      SGSE jGrg)Ha#  
DataFrame
---------
An efficient 2D container for potentially mixed-type time series or other
labeled data series.

Similar to its R counterpart, data.frame, except providing automatic data
alignment and a host of useful data manipulation methods having to do with the
labeling information
    )annotationsN)abc)HashableIterableIteratorMappingSequence)	signature)StringIO)dedent)TYPE_CHECKINGAnyCallableLiteralcastoverload)ma)
get_optionusing_copy_on_writewarn_copy_on_write)_get_option)algoslib
properties)
duplicated)is_range_indexer)PYPY)	REF_COUNT)import_optional_dependency)function)ChainedAssignmentErrorInvalidIndexError_chained_assignment_method_msg_chained_assignment_msg&_chained_assignment_warning_method_msg_chained_assignment_warning_msg)AppenderSubstitutiondeprecate_nonkeyword_argumentsdoc)find_stack_levelrewrite_warning)validate_ascendingvalidate_bool_kwargvalidate_percentile)	LossySetitemErrorcan_hold_element"construct_1d_arraylike_from_scalar"construct_2d_arraylike_from_scalarfind_common_typeinfer_dtype_from_scalarinvalidate_string_dtypesmaybe_box_nativemaybe_downcast_to_dtype)infer_dtype_from_objectis_1d_only_ea_dtypeis_array_likeis_bool_dtypeis_dataclassis_dict_likeis_floatis_float_dtypeis_hashable
is_integeris_integer_dtypeis_iteratoris_list_like	is_scalaris_sequenceneeds_i8_conversionpandas_dtype)concat_compat)
ArrowDtypeBaseMaskedDtypeExtensionDtype)isnanotna)
algorithmscommonnanopsops	roperator)CachedAccessor)reconstruct_and_relabel_result)take_2d_multi)OpsMixin)BaseMaskedArrayDatetimeArrayExtensionArrayPeriodArrayTimedeltaArray)SparseFrameAccessor)ensure_wrapped_if_datetimelikesanitize_arraysanitize_masked_array)NDFramemake_doc)check_key_length)DatetimeIndexIndexPeriodIndexdefault_indexensure_indexensure_index_from_sequences)
MultiIndexmaybe_droplevels)check_bool_indexercheck_dict_or_set_indexers)ArrayManagerBlockManager)
arrays_to_mgrdataclasses_to_dictsdict_to_mgr
mgr_to_mgrndarray_to_mgrnested_data_to_arraysrec_array_to_mgrreorder_arrays	to_arraystreat_as_nested)selectn)melt)Series)_shared_docs)get_group_indexlexsort_indexernargsort)
get_handle)consoleformat)INFO_DOCSTRINGDataFrameInfoframe_sub_kwargs)BlockValuesRefs)0AggFuncTypeAnyAllAnyArrayLike	ArrayLikeAxesAxisAxisIntColspaceArgTypeCompressionOptionsCorrelationMethodDropKeepDtypeDtypeObjFilePathFloatFormatTypeFormattersType	FrequencyFromDictOrientIgnoreRaiseIndexKeyFunc
IndexLabelJoinValidateLevelMergeHowMergeValidateMutableMappingTNaAction
NaPositionNsmallestNlargestKeepPythonFuncTypeQuantileInterpolation
ReadBufferReindexMethodRenamerScalarSelfSequenceNotStrSortKindStorageOptionsSuffixesToGbqIfexistToStataByteorderToTimestampHow
UpdateJoinValueKeyFuncWriteBuffer
XMLParsersnptDataFrameGroupBy	DataFrame)SingleDataManagerStylerzindex, columnsr   z{0 or 'index', 1 or 'columns'}zaxis : {0 or 'index', 1 or 'columns'}, default 0
        If 0 or 'index': apply function to each column.
        If 1 or 'columns': apply function to each row.zj
    inplace : bool, default False
        Whether to modify the DataFrame rather than creating a new one.a  
by : str or list of str
    Name or list of names to sort by.

    - if `axis` is 0 or `'index'` then `by` may contain index
      levels and/or column labels.
    - if `axis` is 1 or `'columns'` then `by` may contain column
      levels and/or index labels.a  
labels : array-like, optional
    New labels / index to conform the axis specified by 'axis' to.
index : array-like, optional
    New labels for the index. Preferably an Index object to avoid
    duplicating data.
columns : array-like, optional
    New labels for the columns. Preferably an Index object to avoid
    duplicating data.
axis : int or str, optional
    Axis to target. Can be either the axis name ('index', 'columns')
    or number (0, 1).)axesklassaxes_single_argaxisinplaceoptional_byoptional_reindexa  
Merge DataFrame or named Series objects with a database-style join.

A named Series object is treated as a DataFrame with a single named column.

The join is done on columns or indexes. If joining columns on
columns, the DataFrame indexes *will be ignored*. Otherwise if joining indexes
on indexes or indexes on a column or columns, the index will be passed on.
When performing a cross merge, no column specifications to merge on are
allowed.

.. warning::

    If both key columns contain rows where the key is a null value, those
    rows will be matched against each other. This is different from usual SQL
    join behaviour and can lead to unexpected results.

Parameters
----------%s
right : DataFrame or named Series
    Object to merge with.
how : {'left', 'right', 'outer', 'inner', 'cross'}, default 'inner'
    Type of merge to be performed.

    * left: use only keys from left frame, similar to a SQL left outer join;
      preserve key order.
    * right: use only keys from right frame, similar to a SQL right outer join;
      preserve key order.
    * outer: use union of keys from both frames, similar to a SQL full outer
      join; sort keys lexicographically.
    * inner: use intersection of keys from both frames, similar to a SQL inner
      join; preserve the order of the left keys.
    * cross: creates the cartesian product from both frames, preserves the order
      of the left keys.
on : label or list
    Column or index level names to join on. These must be found in both
    DataFrames. If `on` is None and not merging on indexes then this defaults
    to the intersection of the columns in both DataFrames.
left_on : label or list, or array-like
    Column or index level names to join on in the left DataFrame. Can also
    be an array or list of arrays of the length of the left DataFrame.
    These arrays are treated as if they are columns.
right_on : label or list, or array-like
    Column or index level names to join on in the right DataFrame. Can also
    be an array or list of arrays of the length of the right DataFrame.
    These arrays are treated as if they are columns.
left_index : bool, default False
    Use the index from the left DataFrame as the join key(s). If it is a
    MultiIndex, the number of keys in the other DataFrame (either the index
    or a number of columns) must match the number of levels.
right_index : bool, default False
    Use the index from the right DataFrame as the join key. Same caveats as
    left_index.
sort : bool, default False
    Sort the join keys lexicographically in the result DataFrame. If False,
    the order of the join keys depends on the join type (how keyword).
suffixes : list-like, default is ("_x", "_y")
    A length-2 sequence where each element is optionally a string
    indicating the suffix to add to overlapping column names in
    `left` and `right` respectively. Pass a value of `None` instead
    of a string to indicate that the column name from `left` or
    `right` should be left as-is, with no suffix. At least one of the
    values must not be None.
copy : bool, default True
    If False, avoid copy if possible.

    .. note::
        The `copy` keyword will change behavior in pandas 3.0.
        `Copy-on-Write
        <https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
        will be enabled by default, which means that all methods with a
        `copy` keyword will use a lazy copy mechanism to defer the copy and
        ignore the `copy` keyword. The `copy` keyword will be removed in a
        future version of pandas.

        You can already get the future behavior and improvements through
        enabling copy on write ``pd.options.mode.copy_on_write = True``
indicator : bool or str, default False
    If True, adds a column to the output DataFrame called "_merge" with
    information on the source of each row. The column can be given a different
    name by providing a string argument. The column will have a Categorical
    type with the value of "left_only" for observations whose merge key only
    appears in the left DataFrame, "right_only" for observations
    whose merge key only appears in the right DataFrame, and "both"
    if the observation's merge key is found in both DataFrames.

validate : str, optional
    If specified, checks if merge is of specified type.

    * "one_to_one" or "1:1": check if merge keys are unique in both
      left and right datasets.
    * "one_to_many" or "1:m": check if merge keys are unique in left
      dataset.
    * "many_to_one" or "m:1": check if merge keys are unique in right
      dataset.
    * "many_to_many" or "m:m": allowed, but does not result in checks.

Returns
-------
DataFrame
    A DataFrame of the two merged objects.

See Also
--------
merge_ordered : Merge with optional filling/interpolation.
merge_asof : Merge on nearest keys.
DataFrame.join : Similar method using indices.

Examples
--------
>>> df1 = pd.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'],
...                     'value': [1, 2, 3, 5]})
>>> df2 = pd.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'],
...                     'value': [5, 6, 7, 8]})
>>> df1
    lkey value
0   foo      1
1   bar      2
2   baz      3
3   foo      5
>>> df2
    rkey value
0   foo      5
1   bar      6
2   baz      7
3   foo      8

Merge df1 and df2 on the lkey and rkey columns. The value columns have
the default suffixes, _x and _y, appended.

>>> df1.merge(df2, left_on='lkey', right_on='rkey')
  lkey  value_x rkey  value_y
0  foo        1  foo        5
1  foo        1  foo        8
2  bar        2  bar        6
3  baz        3  baz        7
4  foo        5  foo        5
5  foo        5  foo        8

Merge DataFrames df1 and df2 with specified left and right suffixes
appended to any overlapping columns.

>>> df1.merge(df2, left_on='lkey', right_on='rkey',
...           suffixes=('_left', '_right'))
  lkey  value_left rkey  value_right
0  foo           1  foo            5
1  foo           1  foo            8
2  bar           2  bar            6
3  baz           3  baz            7
4  foo           5  foo            5
5  foo           5  foo            8

Merge DataFrames df1 and df2, but raise an exception if the DataFrames have
any overlapping columns.

>>> df1.merge(df2, left_on='lkey', right_on='rkey', suffixes=(False, False))
Traceback (most recent call last):
...
ValueError: columns overlap but no suffix specified:
    Index(['value'], dtype='object')

>>> df1 = pd.DataFrame({'a': ['foo', 'bar'], 'b': [1, 2]})
>>> df2 = pd.DataFrame({'a': ['foo', 'baz'], 'c': [3, 4]})
>>> df1
      a  b
0   foo  1
1   bar  2
>>> df2
      a  c
0   foo  3
1   baz  4

>>> df1.merge(df2, how='inner', on='a')
      a  b  c
0   foo  1  3

>>> df1.merge(df2, how='left', on='a')
      a  b  c
0   foo  1  3.0
1   bar  2  NaN

>>> df1 = pd.DataFrame({'left': ['foo', 'bar']})
>>> df2 = pd.DataFrame({'right': [7, 8]})
>>> df1
    left
0   foo
1   bar
>>> df2
    right
0   7
1   8

>>> df1.merge(df2, how='cross')
   left  right
0   foo      7
1   foo      8
2   bar      7
3   bar      8
c                  4  ^  \ rS rSr% SrSS1\R                  -  rSr\\	\
\R                  4rS1rS\S'   \R                   \" / 5      -  rS	\S
'   S\S'   Sr\GSS j5       rGSS jr\rS\S'   GSS jr     GS         GSS jjr GS     GSS jjrSS.   GSS jjrGSS jr\GSS j5       r\GSS j5       r\GSS j5       r\GSS  j5       r\GSS! j5       r GSS" jr!GSS# jr"GSS$ jr#GSS% jr$GSS& jr%\&                   GS                                       GSS) jj5       r'\&                  GS                                       GSS* jj5       r'\(" S+S,S(/S-S.9\)" S/S0S1S2S39\)" \*RV                  \*RX                  S49                   GS                                       GSS5 jj5       5       5       r'          GSS6 jr-\GSS7 j5       r.S8\/S9'   \0" \/S9   5      GSS: j5       r1GSS; jr2 GS     GSS< jjr3GSS= jr4\&GSS> j5       r5\&GSS? j5       r5GSS@ jr5\&GSSA j5       r6\&GSSB j5       r6GSSC jr6GSSD jr7\8   GS         GSSG jj5       r9SS\:Rv                  4       GSSH jjr<      GSSI jr=\& GSS'SJ.       GSSK jjj5       r>\&S'SJ.       GSSL jj5       r>\& GSS'S'SM.       GSSN jjj5       r>\&S'S'SM.       GSSO jj5       r>\(" S+S,SF/SPS.9SE\?S4       GSSQ jj5       r>\(" S+S,SR/SSS.9         GS                   GSST jj5       r@\8     GS     GSSU jj5       rA GS   GSSV jjrB\8  GS     GSSW jj5       rC\D" \/SX   \/SY   SZ-  S[9SSSSSSS\SS]SSS^.                         GSS_ jj5       rEGSS` jrF\(" S+S,S(/SaS.9\D" \R                  \HSb   \/SX   ScSd9    GS         GSSe jj5       5       rG\&      GS             GSSf jj5       rI\&     GS             GSSg jj5       rI\(" S+S,SZ/ShS.9\D" \/SX   Si9      GS             GSSj jj5       5       rI GSSkSSSl.         GSSm jjjrJ\&                      GS                                               GSSn jj5       rK\&                       GS                                               GSSo jj5       rK\(" S+S,S(/SpS.9\)" SSqSrSsS39\)" \*RV                  \*RX                  S49                       GS                                               GSSt jj5       5       5       rK\& GSS'S'S'S'S'S'S'S'S'S'S'S'S'S'S'Su.                                 GSSw jjj5       rL\&S'S'S'S'S'S'S'S'S'S'S'S'S'S'S'Su.                                 GSSx jj5       rL\(" S+S,Sv/SyS.9\D" \/SX   \/SY   Sv-  S[9                GS                                 GSSz jj5       5       rL\D" \M40 \ND6     GS           GSS{ jj5       rOGSGSS| jjrPSS}.GSS~ jjrQ\GSS j5       rRGSGSS jjrSGSS jrTGSS jrUGSS jrVS rWS rXS rYGSGSS jjrZGSS jr[GSS jr\GSS jr]S r^S r_S r`GSS jra  GS       GS S jjrb GS     GSS jjrcGSGSS jjrdGSS jre GS       GSS jjrfGSS jrgGSS jrhGSS jriGSS jrjGSS jrkGSS jrl\&S'S.GSS jj5       rm\&GS	S j5       rm\&S'S.GS
S jj5       rmSS.GS
S jjrm\&S'S.GSS jj5       rn\&GS	S j5       rnSS.GSS jjrnGSGSS jjro\:Rv                  4         GSS jjrpGSS jrqGSS jrr\S 5       rs      GSS jrt\0" S5      \)" \HSb   \HS   SSSS9\0" \R                  R                  5      SSS.     GSU 4S jjj5       5       5       ru\D" \R                  \HSb   \HS   S9 GSSSSSSS\R                  SSS.	             GSU 4S jjjj5       rv\& GSS'S'S'S'S'S.               GSS jjj5       rx\& GSS'S'S'S'S'S'S.               GSS jjj5       rx\& GSS'S'S'S'S'S'S.               GSS jjj5       rx GSSSSSSSS.               GSU 4S jjjjrx\& GSS'S'S'S'S'S'S.                 GSS jjj5       ry\& GSS'S'S'S'S'S'S'S.                 GSS jjj5       ry\& GSS'S'S'S'S'S'S'S.                 GSS jjj5       ry GSSSSSSSSS.                 GSU 4S jjjjryGSU 4S jjrz    GSS jr{\D" \R                  \HSb   S9SSS\:Rv                  S4           GSU 4S jjj5       r|\&S'S'S'S'S.         GSS jj5       r}\&S'S'S'S.         GSS jj5       r}SSSSS.         GS S jjr}\& GSS'S'S'S'S'SS.               GS!S jjj5       r~\& GSS'S'S'S'SS.               GS"S jjj5       r~\& GSS'S'S'S'S'SS.               GS#S jjj5       r~ GSSSSS\:Rv                  SS.               GS$S jjjr~\D" \R                  \HSb   S9GSS j5       r\D" \R                  \HSb   S9GSS j5       r\D" \GR                  \HSb   S9GSS j5       r\D" \GR                  \HSb   S9GSS j5       r\&S'S'S'S'S'S'S.             GS%S jj5       r\&S'S'S'S'S'S.             GS&S jj5       rS\:Rv                  \:Rv                  SSSS.             GS'S jjr\& GSS'S'S.         GS(S jjj5       r\& GSS'S'S'S.         GS)S jjj5       r\& GSS'S'S'S.         GS*S jjj5       r GSSSSS.         GS*S jjjr  GS+     GS,S jjr\&S'S'S'S'S'S'S'S.               GS-S jj5       r\&S'S'S'S'S'S'S.               GS.S jj5       rSSSSSSSS.                 GS/S jjr\&S'S'S'S'S'S'S'S'S.                   GS0S jj5       r\&S'S'S'S'S'S'S'S'S'S.	                   GS1S jj5       r\&S'S'S'S'S'S'S'S'S'S.	                   GS2S jj5       rSSSSSSSSSS.	                   GS3U 4S jjjr     GS4           GS5S jjr GS6       GS7S jjr GS6       GS7S jjr\D" \GR                  \HSb   \" S5      \" S5      S9GS8GS9S jj5       rGSGS:S jjrS rS r\r GS     GS;S jjrGSGS<S jjrGS=GS  jrGS>GS jr  GS     GS?GS jjrGS@GS jrSSSGS. GSAGS jjrGSGS jrGSBGS jrGSBGS jrSSGS	.GSAGS
 jjr\0" \GR:                  " GSS5      5      GSCGSDGS jj5       r\0" \GR:                  " GSS5      5      GSCGSDGS jj5       r\0" \GR:                  " GSS5      5      GSCGSDGS jj5       r\0" \GR:                  " GSS5      5      GSCGSDGS jj5       r\0" \GR:                  " GSS5      5      GSCGSDGS jj5       r\0" \GR:                  " GSS5      5      GSCGSDGS jj5       r\0" \GR:                  " GSS5      5       GS   GSDGS jj5       r\0" \GR:                  " GSS5      5       GS   GSDGS jj5       r\0" \GR:                  " GSS5      5       GS   GSDGS jj5       r\r\0" \GR:                  " GSS5      5       GS   GSDGS jj5       r\0" \GR:                  " GSS5      5       GS   GSDGS  jj5       r\r\0" \GR:                  " GS!S5      5       GS   GSDGS" jj5       r\0" \GR:                  " GS#S5      5       GS   GSDGS$ jj5       r\r\r\0" \GR:                  " GS%S5      5       GS   GSDGS& jj5       r\r\0" \GR:                  " GS'S5      5       GS   GSDGS( jj5       r\0" \GR:                  " GS)S5      5       GS   GSDGS* jj5       r\0" \GR:                  " GS+S5      5       GS   GSDGS, jj5       r\0" \GR:                  " GS-S5      5       GS   GSDGS. jj5       r\0" \GR:                  " GS/S5      5       GS   GSDGS0 jj5       r\0" \GR:                  " GS1S5      5       GS   GSDGS2 jj5       r\D" \/GS3   \" GS45      \HSb   S9    GSE           GSFU 4GS5 jjj5       r  GS       GSGGS6 jjrGSHGS7 jr    GSI       GSJGS8 jjr\0" \" GS95      5      \0" \/GS:   \H-  5      S\:Rv                  SSSS\:Rv                  S4               GSKGS; jj5       5       rGS<\/GS='   \)" S5      \0" \/GS=   5      \:Rv                  \:Rv                  GS>. GSGS? jj5       5       rGS@\/GSA'   \)" S5      \0" \/GSA   5      SSSGSBSSSGSC\:Rv                  S4
             GSLGSD jj5       5       rS\:Rv                  \:Rv                  S4       GSMGSE jjr GS     GSNGSF jjrGSOGSPGSG jjr\0" \/GSH   GSIGSHGSJ.-  5            GSQ       GSRGSK jj5       r\D" \GR                  S GSLS\" GSM5      GSN9GSSGSTGSO jj5       r GS       GSUGSP jjr\" GSQ5      r\" GSR5      r\D" \/GSS   \HSb   \HS   \\GST9GSVGSAGSU jj5       r\r\D" \/GSV   \HSb   \HS   GSW9 GS     GSWGSX jj5       r       GSX             GSYGSY jjr GS     GSZGSZ jjr GS     GS[GS[ jjr   GS\       GS]GS\ jjr      GS^               GS_GS] jjr\)" S5      \0" \GS^GS_9           GS`                         GSaGS` jj5       5       r GS   GSbGSa jjr   GSc       GSdGSb jjr   GSe       GSfGSc jjr    GSg           GShGSd jjrGSiGSjGSe jjrSSSSGSf.       GSkGSg jjrGSlGSh jr\D" \" GSiGS^GSj95      SSSGSk.       GSmGSl jj5       r\D" \" GSmGS^GSj95         GSn       GSmGSn jj5       r\D" \" GSoGS^GSj95         GSo     GSpU 4GSp jjj5       r\D" \" GSqGS^GSj95         GSo     GSpU 4GSr jjj5       r\D" \" GSsGS^GSj95          GSq       GSrU 4GSt jjj5       r\D" \" GSuGS^GSj95          GSq       GSrU 4GSv jjj5       r\D" \" GSBGS^GSj95         GSo     GSpU 4GSw jjj5       r\D" \" GSxGS^GSj95         GSo     GSpU 4GSy jjj5       r\D" \" GSzGS^GSj95          GSs       GStU 4GS{ jjj5       r\D" \" GS|GS^GSj95          GSs       GStU 4GS} jjj5       r\D" \" GS~GS^GSj95          GSs       GStU 4GS jjj5       r\D" \" GSGS^GSj95         GSo     GSpU 4GS jjj5       r\D" \" GSGS^GSj95         GSo     GSpU 4GS jjj5       r\r\r\D" \" GSGS^GSj95      GSGSuGS jj5       r\D" \" GSGS^GSj95      GSGSuGS jj5       r\D" \" GSGS^GSj95      GSGSuGS jj5       r\D" \" GSGS^5      5      GSGSuGS jj5       rGSvGSwGS jjr\D" \/GS   GSGS9 GSo       GSxGS jj5       r\D" \/GS   GSGS9 GSo       GSxGS jj5       rGSyGS jr GSn       GSzGS jjr\&     GS           GS{GS jj5       r\&    GS|           GS}GS jj5       r\&     GS           GS~GS jj5       r     GS           GS~GS jjr    GS         GSGS jjr GS       GSGS jjrGSGS jrSS/rGS\GS'   0 \GR                  ESSGS.ErGS\GS'   \" \5      rSrGS\GS'   SrGS\GS'   \GR                  " SGSGS9r\GR                  " S\" GS5      GS9r\" GS\GR                   GR                  5      Gr\GR                   GR                  Gr\GR                   GR
                  Gr\" SG\5      GrGS Gr	\GSGS j5       Gr
GSGrU =Gr$ (  r   i  a  
Two-dimensional, size-mutable, potentially heterogeneous tabular data.

Data structure also contains labeled axes (rows and columns).
Arithmetic operations align on both row and column labels. Can be
thought of as a dict-like container for Series objects. The primary
pandas data structure.

Parameters
----------
data : ndarray (structured or homogeneous), Iterable, dict, or DataFrame
    Dict can contain Series, arrays, constants, dataclass or list-like objects. If
    data is a dict, column order follows insertion-order. If a dict contains Series
    which have an index defined, it is aligned by its index. This alignment also
    occurs if data is a Series or a DataFrame itself. Alignment is done on
    Series/DataFrame inputs.

    If data is a list of dicts, column order follows insertion-order.

index : Index or array-like
    Index to use for resulting frame. Will default to RangeIndex if
    no indexing information part of input data and no index provided.
columns : Index or array-like
    Column labels to use for resulting frame when data does not have them,
    defaulting to RangeIndex(0, 1, 2, ..., n). If data contains column labels,
    will perform column selection instead.
dtype : dtype, default None
    Data type to force. Only a single dtype is allowed. If None, infer.
copy : bool or None, default None
    Copy data from inputs.
    For dict data, the default of None behaves like ``copy=True``.  For DataFrame
    or 2d ndarray input, the default of None behaves like ``copy=False``.
    If data is a dict containing one or more Series (possibly of different dtypes),
    ``copy=False`` will ensure that these inputs are not copied.

    .. versionchanged:: 1.3.0

See Also
--------
DataFrame.from_records : Constructor from tuples, also record arrays.
DataFrame.from_dict : From dicts of Series, arrays, or dicts.
read_csv : Read a comma-separated values (csv) file into DataFrame.
read_table : Read general delimited file into DataFrame.
read_clipboard : Read text from clipboard into DataFrame.

Notes
-----
Please reference the :ref:`User Guide <basics.dataframe>` for more information.

Examples
--------
Constructing DataFrame from a dictionary.

>>> d = {'col1': [1, 2], 'col2': [3, 4]}
>>> df = pd.DataFrame(data=d)
>>> df
   col1  col2
0     1     3
1     2     4

Notice that the inferred dtype is int64.

>>> df.dtypes
col1    int64
col2    int64
dtype: object

To enforce a single dtype:

>>> df = pd.DataFrame(data=d, dtype=np.int8)
>>> df.dtypes
col1    int8
col2    int8
dtype: object

Constructing DataFrame from a dictionary including Series:

>>> d = {'col1': [0, 1, 2, 3], 'col2': pd.Series([2, 3], index=[2, 3])}
>>> pd.DataFrame(data=d, index=[0, 1, 2, 3])
   col1  col2
0     0   NaN
1     1   NaN
2     2   2.0
3     3   3.0

Constructing DataFrame from numpy ndarray:

>>> df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
...                    columns=['a', 'b', 'c'])
>>> df2
   a  b  c
0  1  2  3
1  4  5  6
2  7  8  9

Constructing DataFrame from a numpy ndarray that has labeled columns:

>>> data = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)],
...                 dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")])
>>> df3 = pd.DataFrame(data, columns=['c', 'a'])
...
>>> df3
   c  a
0  3  1
1  6  4
2  9  7

Constructing DataFrame from dataclass:

>>> from dataclasses import make_dataclass
>>> Point = make_dataclass("Point", [("x", int), ("y", int)])
>>> pd.DataFrame([Point(0, 0), Point(0, 3), Point(2, 3)])
   x  y
0  0  0
1  0  3
2  2  3

Constructing DataFrame from Series/DataFrame:

>>> ser = pd.Series([1, 2, 3], index=["a", "b", "c"])
>>> df = pd.DataFrame(data=ser, index=["a", "c"])
>>> df
   0
a  1
c  3

>>> df1 = pd.DataFrame([1, 2, 3], index=["a", "b", "c"], columns=["x"])
>>> df2 = pd.DataFrame(data=df1, index=["a", "c"])
>>> df2
   x
a  1
c  3
columnsindex	dataframesparsezset[str]
_accessorszfrozenset[str]_hidden_attrszBlockManager | ArrayManager_mgri  c                    [         $ Nr   selfs    C/var/www/html/env/lib/python3.13/site-packages/pandas/core/frame.py_constructorDataFrame._constructor  s        c                    [         R                  XS9n[        U 5      [         L a  U$ [        U 5      R                  S:X  a  U R	                  U5      $ U R	                  U5      $ )Nr   GeoDataFrame)r   	_from_mgrtype__name__r   )r   mgrr   dfs       r   _constructor_from_mgrDataFrame._constructor_from_mgr  s`       0:" I$Z  N2 $$S))   $$r   zCallable[..., Series]_constructor_slicedr}   c                    [         R                  " X5      nS Ul        [        U 5      [        L a  U$ U R                  U5      $ r   )r}   r   _namer   r   r   )r   r   r   sers       r   _constructor_sliced_from_mgr&DataFrame._constructor_sliced_from_mgr  s?    s)	:" J '',,r   Nc           	     &   SnUb  U R                  U5      n[        U[        5      (       a$  UR                  nSnU(       d  UR	                  SS9n[        U[
        [        45      (       a  U(       dG  [        R                  " S[        U5      R                   S[        U 5      R                   S3[        SS9  [        5       (       a  UR	                  SS9nUc$  Uc!  Uc  U(       d  [        R                  " X5        g [        S	SS
9n[        U[         ["        [$        45      n['        USS 5      n	Un
[        U[(        5      (       a  [+        S5      e[        U[(        5      (       a  [+        S5      eUc  [        U[,        5      (       a  SnOrUS:X  a8  [        U[.        R0                  [$        45      (       a  UR2                  S:X  a  SnO4[        5       (       a#  [        U["        [        [         45      (       d  SnOSnUc6  Ub  UO
[5        S5      nUb  UO
[5        S5      nUb  UO[7        [8        5      n/ n[        U[
        [        45      (       a  U R;                  XUS.XES9nGO-[        U[,        5      (       a  [=        XX4XWS9nGO[        U[>        R@                  5      (       aF  SSK!J"n  [        XRF                  5      (       a  [I        S5      e[K        U5      n[M        UUUUUUS9nGO[        U[.        R0                  [         ["        [$        45      (       a  URN                  RP                  (       a*  [S        [.        R0                  U5      n[U        UUUUUUS9nGO2['        USS 5      b/  [        5       (       a  UOSn[=        URV                  U0UUUUUS9nGO[M        UUUUUUS9nGO[Y        U5      (       Ga  [        U[Z        R\                  5      (       d3  [_        US5      (       a  [.        R`                  " U5      nO[c        U5      n[e        U5      S:  a  [g        US   5      (       a  [i        U5      n[        U[.        R0                  5      (       d=  [k        U5      (       a-  Ub  [m        U5      n[o        UUUU5      u  pn[q        UUUUUS9nO[M        UUUUUUS9nO[=        0 UUb  UO
[5        S5      UUS9nOUb  Uc  [+        S5      e[m        U5      n[m        U5      nU(       d  [s        U5      u  pO[        U[t        5      (       aE  [w        [e        U5      5       Vs/ s H  n[y        U[e        U5      U5      PM     nn[q        UX2S US9nO9[{        U[e        U5      [e        U5      UU5      n[M        UUUURN                  SUS9n[}        XS9n[        R                  " X5        U
cV  U(       aN  U	[.        R~                  :X  a9  U R                  R                  S   U	:w  a  [        R                  " S[        SS9  g g g g g s  snf )NFTdeepz
Passing a z to zK is deprecated and will raise in a future version. Use public APIs instead.   
stacklevelmode.data_managersilentdtypezindex cannot be a setzcolumns cannot be a setarray   r   r   r   )r   r   copy)r   r   typ)mrecordsz]MaskedRecords are not supported. Pass {name: data[name] for name in data.dtype.names} insteadr   name)r   r   r   	__array__)r   r   z*DataFrame constructor not properly called!zDtype inference on a pandas object (Series, Index, ExtensionArray) is deprecated. The DataFrame constructor will keep the original dtype in the future. Call `infer_objects` on the result to get the old behavior.)C_validate_dtype
isinstancer   r   r   rp   ro   warningswarnr   r   DeprecationWarningr   rb   __init__r   r}   rf   r[   getattrset
ValueErrordictnpndarrayndimrh   rI   object	_init_mgrrs   r   MaskedArraynumpy.mar   MaskedRecords	TypeErrorra   ru   r   namesr   rw   r   rE   r   r	   hasattrasarraylistlenr=   rr   rz   ri   rv   rq   r5   rM   ranger2   r3   rt   object_dtypesilocFutureWarning)r   datar   r   r   r   	allow_mgrmanageris_pandas_object
data_dtypeoriginal_dtyper   r   _copyarrays_valuesarr2ds                     r   r   DataFrame.__init__  s    	((/EdI&&99DI yyey,d\<899 d!4!4 5T$t*:M:M9N O/ / '  #$$yyey, }U]4  ,1$?%dVUN,KLT7D1
 eS!!455gs##677<$%%7"tbjj.%ABBIIN $&&zui00 0 <".EM!4DE!(!4g-:JG".EL4HEDd\<899..w?u ! C d##d7dXCbnn--) $ 6 677  ).D C rzz65.IJJzzBJJ-& vt,8 3 5 54! YY%	 % $dCLL114--::d+D:D4y1}Q((/5D!$

338M8M*".w"7-B .*FU (##C )#!#C "&2Ga8H } !MNN 'E"7+G248 %00
 #3w<00 7tSZO0   $FG$GT:JL %++ *#!&6:;S{{"j0 
 "  1 <T&6!9s   - XFTboolc                    SSK Jn  U" XS9$ )a  
Return the dataframe interchange object implementing the interchange protocol.

Parameters
----------
nan_as_null : bool, default False
    `nan_as_null` is DEPRECATED and has no effect. Please avoid using
    it; it will be removed in a future release.
allow_copy : bool, default True
    Whether to allow memory copying when exporting. If set to False
    it would cause non-zero-copy exports to fail.

Returns
-------
DataFrame interchange object
    The object which consuming library can use to ingress the dataframe.

Notes
-----
Details on the interchange protocol:
https://data-apis.org/dataframe-protocol/latest/index.html

Examples
--------
>>> df_not_necessarily_pandas = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
>>> interchange_object = df_not_necessarily_pandas.__dataframe__()
>>> interchange_object.column_names()
Index(['A', 'B'], dtype='object')
>>> df_pandas = (pd.api.interchange.from_dataframe
...              (interchange_object.select_columns_by_name(['A'])))
>>> df_pandas
     A
0    1
1    2

These methods (``column_names``, ``select_columns_by_name``) should work
for any dataframe library which implements the interchange protocol.
r   )PandasDataFrameXchg)
allow_copy)!pandas.core.interchange.dataframer%  )r   nan_as_nullr&  r%  s       r   __dataframe__DataFrame.__dataframe__  s    T 	J"4??r   api_versionc               P    [        S5      nUR                  R                  nU" XS9$ )z
Provide entry point to the Consortium DataFrame Standard API.

This is developed and maintained outside of pandas.
Please report any issues to https://github.com/data-apis/dataframe-api-compat.
dataframe_api_compatr+  )r   pandas_standard'convert_to_standard_compliant_dataframe)r   r,  r.  r0  s       r   !__dataframe_consortium_standard__+DataFrame.__dataframe_consortium_standard__  s1      ::PQ 00XX 	0 7tUUr   c                    [        SSS9nUb  UR                  R                  U5      nUR                  R	                  XS9nUR                  5       $ )aH  
Export the pandas DataFrame as an Arrow C stream PyCapsule.

This relies on pyarrow to convert the pandas DataFrame to the Arrow
format (and follows the default behaviour of ``pyarrow.Table.from_pandas``
in its handling of the index, i.e. store the index as a column except
for RangeIndex).
This conversion is not necessarily zero-copy.

Parameters
----------
requested_schema : PyCapsule, default None
    The schema to which the dataframe should be casted, passed as a
    PyCapsule containing a C ArrowSchema representation of the
    requested schema.

Returns
-------
PyCapsule
pyarrowz14.0.0)min_version)schema)r   Schema_import_from_c_capsuleTablefrom_pandas__arrow_c_stream__)r   requested_schemapatables       r   r;  DataFrame.__arrow_c_stream__  sR    * (	xH'!yy??@PQ$$T$C''))r   c                2    U R                   U R                  /$ )aF  
Return a list representing the axes of the DataFrame.

It has the row axis labels and column axis labels as the only members.
They are returned in that order.

Examples
--------
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df.axes
[RangeIndex(start=0, stop=2, step=1), Index(['col1', 'col2'],
dtype='object')]
r   r   s    r   r   DataFrame.axes  s     

DLL))r   c                V    [        U R                  5      [        U R                  5      4$ )aS  
Return a tuple representing the dimensionality of the DataFrame.

See Also
--------
ndarray.shape : Tuple of array dimensions.

Examples
--------
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df.shape
(2, 2)

>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4],
...                    'col3': [5, 6]})
>>> df.shape
(2, 3)
)r  r   r   r   s    r   shapeDataFrame.shape  s     ( 4::DLL 111r   c                    [        U R                  R                   Vs1 s H  oR                  iM     sn5      S:*  $ s  snf )a  
Whether all the columns in a DataFrame have the same type.

Returns
-------
bool

Examples
--------
>>> DataFrame({"A": [1, 2], "B": [3, 4]})._is_homogeneous_type
True
>>> DataFrame({"A": [1, 2], "B": [3.0, 4.0]})._is_homogeneous_type
False

Items with the same type but different sizes are considered
different types.

>>> DataFrame({
...    "A": np.array([1, 2], dtype=np.int32),
...    "B": np.array([1, 2], dtype=np.int64)})._is_homogeneous_type
False
r   )r  r   r  r   )r   arrs     r   _is_homogeneous_typeDataFrame._is_homogeneous_type-  s4    2 )9)9:)9#II)9:;q@@:s   =c                    [        U R                  [        5      (       a  gU R                  R                  n[	        U5      S:w  a  gUS   R
                  n[        U5      (       + $ )zI
Can we transpose this DataFrame without creating any new array objects.
Fr   r   )r   r   ro   blocksr  r   r:   )r   rJ  r   s      r   _can_fast_transposeDataFrame._can_fast_transposeH  sQ    
 dii..!!v;!q	&u---r   c                   U R                   n[        U[        5      (       at  [        UR                  5      S:X  aF  [        UR                  S   R                  5      (       d  UR                  S   R                  SS5      $ [        U R                  5      $ UR                  n[        U5      S:w  a  [        U R                  5      $ US   R                  nUR                  S:X  a  U R                  $ [        SU5      nUR                  $ )z;
Analogue to ._values that may return a 2D ExtensionArray.
r   r   9np.ndarray | DatetimeArray | TimedeltaArray | PeriodArray)r   r   ro   r  r  r:   r   reshaper_   r   rJ  r  r   T)r   r   rJ  rF  s       r   _valuesDataFrame._valuesW  s    
 iic<((3::!#,?

1@S@S,T,T zz!},,R331$++>>v;!1$++>>Qi88q=;; NPSTuur   c                4    [        S5      n[        U 5      U:*  $ )z 
Check length against max_rows.
display.max_rows)r   r  )r   max_rowss     r   _repr_fits_vertical_DataFrame._repr_fits_vertical_u  s     014yH$$r   c                :   [         R                  " 5       u  p[        S5      n[        U R                  5      nU(       a  XC:  d  U(       a	  XAS-  :  a  gUb  [         R
                  " 5       (       d  g[        S5      c  [         R                  " 5       (       a  SnO[        S5      n[        5       nU nUb#  UR                  S[        U[        U5      5       nOgUR                  US	9  UR                  5       n[        S
 UR                  S5       5       5      n	X:  $ )zh
Check if full repr fits in horizontal boundaries imposed by the display
options width and max_columns.
display.max_columnsr   FNTzdisplay.widthr   rU  bufc              3  8   #    U  H  n[        U5      v   M     g 7fr   )r  ).0lines     r   	<genexpr>3DataFrame._repr_fits_horizontal_.<locals>.<genexpr>  s     A/@tT/@   
)r   get_console_sizer   r  r   in_interactive_sessionin_ipython_frontendr   r  min	to_stringgetvaluemaxsplit)
r   widthheightmax_columns
nb_columnsrV  r\  dvalue
repr_widths
             r   _repr_fits_horizontal_ DataFrame._repr_fits_horizontal_|  s    
  002 !67&
 J4jQJ/ = > > @ @o&2g6Q6Q6S6SH!"45H
 j .Xs1v./A	Au{{4/@AA
!!r   c                    [        S5      S:H  nU=(       a,    U R                  5       =(       a    U R                  5       (       + $ )z-
True if the repr should show the info view.
zdisplay.large_reprinfo)r   rs  rW  )r   info_repr_options     r   
_info_reprDataFrame._info_repr  sA     &&:;vE 
'')Id.G.G.I%
 	
r   c                    U R                  5       (       a)  [        5       nU R                  US9  UR                  5       $ [        R
                  " 5       nU R                  " S0 UD6$ )z<
Return a string representation for a particular DataFrame.
r[   )rx  r   rv  ri  fmtget_dataframe_repr_paramsrh  )r   r\  repr_paramss      r   __repr__DataFrame.__repr__  sR     ??*CII#I<<>!335~~,,,r   c                "   U R                  5       (       aS  [        5       nU R                  US9  UR                  5       R	                  SSS5      nUR	                  SSS5      nSU S3$ [        S	5      (       a  [        S
5      n[        S5      n[        S5      n[        S5      n[        R                  " U 40 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SU_SU_SU_S U_S!S"_6n[        R                  " U5      R                  SS#9$ g)$zX
Return a html representation for a particular DataFrame.

Mainly for IPython notebook.
r[  <z&lt;r   >z&gt;z<pre>z</pre>zdisplay.notebook_repr_htmlrU  zdisplay.min_rowsrZ  zdisplay.show_dimensionsr   N	col_spacena_repNaN
formattersfloat_formatsparsifyjustifyindex_namesTheaderr   	bold_rowsescaperV  min_rowsmax_colsshow_dimensionsdecimal.)notebook)
rx  r   rv  ri  replacer   r|  DataFrameFormatterDataFrameRendererto_html)r   r\  valrV  r  r  r  	formatters           r   _repr_html_DataFrame._repr_html_  sx    ??*CII#I,,.((gq9C++c7A.C3%v&&233!"45H!"45H!"78H()BCO..  	
   "   !     " "  "!" !0#$ %I( ((3;;T;JJr   .r\  c                    g r   r{  r   r\  r   r  r  r   r  r  r  r  r  r  rV  r  r  r  
line_widthr  max_colwidthencodings                       r   rh  DataFrame.to_string      . 	r   c                    g r   r{  r  s                       r   rh  r    r  r   z3.0r   rh  )versionallowed_argsr   zbool or list of strzkWrite out the column names. If a list of columns is given, it is assumed to be aliases for the column nameszint, list or dict of intzThe minimum width of each column. If a list of ints is given every integers corresponds with one column. If a dict is given, the key references the column, while the value defines the space to use.)header_typer  col_space_typer  )shared_paramsreturnsc                    SSK Jn  U" SU5         [        R                  " U 4UUUUUU	UU
UUUUUUUS.6n[        R                  " U5      R                  UUUS9sSSS5        $ ! , (       d  f       g= f)a  
Render a DataFrame to a console-friendly tabular output.
%(shared_params)s
line_width : int, optional
    Width to wrap a line in characters.
min_rows : int, optional
    The number of rows to display in the console in a truncated repr
    (when number of rows is above `max_rows`).
max_colwidth : int, optional
    Max width to truncate each column in characters. By default, no limit.
encoding : str, default "utf-8"
    Set character encoding.
%(returns)s
See Also
--------
to_html : Convert DataFrame to HTML.

Examples
--------
>>> d = {'col1': [1, 2, 3], 'col2': [4, 5, 6]}
>>> df = pd.DataFrame(d)
>>> print(df.to_string())
   col1  col2
0     1     4
1     2     5
2     3     6
r   )option_contextzdisplay.max_colwidth)r   r  r  r  r  r  r  r  r  r   r  rV  r  r  r  )r\  r  r  N)pandasr  r|  r  r  rh  )r   r\  r   r  r  r   r  r  r  r  r  r  rV  r  r  r  r  r  r  r  r  r  s                         r   rh  r    s    ~ 	*2LA..#%)!'!!! /!I$ ((3==!% > ' BAAs   A
A$$
A2c               n    U R                   R                  UUUUUS9nU R                  XfR                  S9$ )N)r  date_formatr  r  quotingr   )r   get_values_for_csvr   r   )r   r  r  r  r  r  r   s          r   _get_values_for_csvDataFrame._get_values_for_csvx  sF     ii**%# + 
 ))#HH)==r   c                    SSK Jn  U" U 5      $ )a  
Returns a Styler object.

Contains methods for building a styled HTML representation of the DataFrame.

See Also
--------
io.formats.style.Styler : Helps style a DataFrame or Series according to the
    data with HTML and CSS.

Examples
--------
>>> df = pd.DataFrame({'A': [1, 2, 3]})
>>> df.style  # doctest: +SKIP

Please see
`Table Visualization <../../user_guide/style.ipynb>`_ for more examples.
r   r   )pandas.io.formats.styler   )r   r   s     r   styleDataFrame.style  s    ( 	3d|r   a  
        Iterate over (column name, Series) pairs.

        Iterates over the DataFrame columns, returning a tuple with
        the column name and the content as a Series.

        Yields
        ------
        label : object
            The column names for the DataFrame being iterated over.
        content : Series
            The column entries belonging to each label, as a Series.

        See Also
        --------
        DataFrame.iterrows : Iterate over DataFrame rows as
            (index, Series) pairs.
        DataFrame.itertuples : Iterate over DataFrame rows as namedtuples
            of the values.

        Examples
        --------
        >>> df = pd.DataFrame({'species': ['bear', 'bear', 'marsupial'],
        ...                   'population': [1864, 22000, 80000]},
        ...                   index=['panda', 'polar', 'koala'])
        >>> df
                species   population
        panda   bear      1864
        polar   bear      22000
        koala   marsupial 80000
        >>> for label, content in df.items():
        ...     print(f'label: {label}')
        ...     print(f'content: {content}', sep='\n')
        ...
        label: species
        content:
        panda         bear
        polar         bear
        koala    marsupial
        Name: species, dtype: object
        label: population
        content:
        panda     1864
        polar    22000
        koala    80000
        Name: population, dtype: int64
        itemsc              #    #    U R                   R                  (       a9  [        U S5      (       a(  U R                    H  nXR                  U5      4v   M     g [	        U R                   5       H  u  p!XR                  USS94v   M     g 7f)N_item_cacher   r   )r   	is_uniquer  _get_item_cache	enumerate_ixs)r   kis      r   r  DataFrame.items  sm     <<!!gdM&B&B\\--a000 " "$,,/11--- 0s   BB	c              #  f  #    U R                   nU R                  n[        5       n[        U R                  U R
                  5       Hg  u  pEU" XQUS9R                  U 5      nU(       a@  U R                  R                  (       a%  UR                  R                  U R                  5        XF4v   Mi     g7f)a  
Iterate over DataFrame rows as (index, Series) pairs.

Yields
------
index : label or tuple of label
    The index of the row. A tuple for a `MultiIndex`.
data : Series
    The data of the row as a Series.

See Also
--------
DataFrame.itertuples : Iterate over DataFrame rows as namedtuples of the values.
DataFrame.items : Iterate over (column name, Series) pairs.

Notes
-----
1. Because ``iterrows`` returns a Series for each row,
   it does **not** preserve dtypes across the rows (dtypes are
   preserved across columns for DataFrames).

   To preserve dtypes while iterating over the rows, it is better
   to use :meth:`itertuples` which returns namedtuples of the values
   and which is generally faster than ``iterrows``.

2. You should **never modify** something you are iterating over.
   This is not guaranteed to work in all cases. Depending on the
   data types, the iterator returns a copy and not a view, and writing
   to it will have no effect.

Examples
--------

>>> df = pd.DataFrame([[1, 1.5]], columns=['int', 'float'])
>>> row = next(df.iterrows())[1]
>>> row
int      1.0
float    1.5
Name: 0, dtype: float64
>>> print(row['int'].dtype)
float64
>>> print(df['int'].dtype)
int64
r   r   N)
r   r   r   zipr   r   __finalize__r   is_single_blockadd_references)r   r   r   	using_cowr  vss          r   iterrowsDataFrame.iterrows  s     Z ,,((')	

DKK0DAaQ/<<TBATYY66%%dii0$J	 1s   B/B1c                  ^  / n[        T R                  5      nU(       a-  UR                  T R                  5        UR	                  SS5        UR                  U 4S j[        [        T R                  5      5       5       5        Ub1  [        R                  " X$SS9n[        UR                  [        U6 5      $ [        U6 $ )aK  
Iterate over DataFrame rows as namedtuples.

Parameters
----------
index : bool, default True
    If True, return the index as the first element of the tuple.
name : str or None, default "Pandas"
    The name of the returned namedtuples or None to return regular
    tuples.

Returns
-------
iterator
    An object to iterate over namedtuples for each row in the
    DataFrame with the first field possibly being the index and
    following fields being the column values.

See Also
--------
DataFrame.iterrows : Iterate over DataFrame rows as (index, Series)
    pairs.
DataFrame.items : Iterate over (column name, Series) pairs.

Notes
-----
The column names will be renamed to positional names if they are
invalid Python identifiers, repeated, or start with an underscore.

Examples
--------
>>> df = pd.DataFrame({'num_legs': [4, 2], 'num_wings': [0, 2]},
...                   index=['dog', 'hawk'])
>>> df
      num_legs  num_wings
dog          4          0
hawk         2          2
>>> for row in df.itertuples():
...     print(row)
...
Pandas(Index='dog', num_legs=4, num_wings=0)
Pandas(Index='hawk', num_legs=2, num_wings=2)

By setting the `index` parameter to False we can remove the index
as the first element of the tuple:

>>> for row in df.itertuples(index=False):
...     print(row)
...
Pandas(num_legs=4, num_wings=0)
Pandas(num_legs=2, num_wings=2)

With the `name` parameter set we set a custom name for the yielded
namedtuples:

>>> for row in df.itertuples(name='Animal'):
...     print(row)
...
Animal(Index='dog', num_legs=4, num_wings=0)
Animal(Index='hawk', num_legs=2, num_wings=2)
r   rf   c              3  J   >#    U  H  nTR                   S S 2U4   v   M     g 7fr   )r  )r^  r  r   s     r   r`  'DataFrame.itertuples.<locals>.<genexpr>^  s     H/G!dii1o/Gs    #T)rename)r  r   appendr   insertextendr  r  collections
namedtuplemap_maker  )r   r   r   r  fields	itertuples   `     r   
itertuplesDataFrame.itertuples  s    @ dll#MM$**%MM!W% 	HuS5F/GHH $..TI yV55 F|r   c                ,    [        U R                  5      $ )z9
Returns length of info axis, but here we use the index.
)r  r   r   s    r   __len__DataFrame.__len__k  s     4::r   c                    g r   r{  r   others     r   dotDataFrame.dotq      r   c                    g r   r{  r  s     r   r  r  u  r  r   c                z   [        U[        [        45      (       a  U R                  R	                  UR
                  5      n[        U5      [        U R                  5      :  d"  [        U5      [        UR
                  5      :  a  [        S5      eU R                  USS9nUR                  USS9nUR                  nUR                  nOiU nU R                  n[        R                  " U5      nUR                  S   UR                  S   :w  a%  [        SUR                   SUR                   35      e[        U[        5      (       ao  [        [        U R                   5      [        UR                   5      -   5      nU R#                  [        R$                  " XV5      UR
                  UR                  SUS	9$ [        U[        5      (       a\  [        [        U R                   5      UR                   /-   5      nU R'                  [        R$                  " XV5      UR
                  SUS
9$ [        U[        R(                  [*        45      (       aZ  [        R$                  " XV5      nUR,                  S:X  a  U R#                  XR
                  SS9$ U R'                  XR
                  SS9$ [/        S[1        U5       35      e)a  
Compute the matrix multiplication between the DataFrame and other.

This method computes the matrix product between the DataFrame and the
values of an other Series, DataFrame or a numpy array.

It can also be called using ``self @ other``.

Parameters
----------
other : Series, DataFrame or array-like
    The other object to compute the matrix product with.

Returns
-------
Series or DataFrame
    If other is a Series, return the matrix product between self and
    other as a Series. If other is a DataFrame or a numpy.array, return
    the matrix product of self and other in a DataFrame of a np.array.

See Also
--------
Series.dot: Similar method for Series.

Notes
-----
The dimensions of DataFrame and other must be compatible in order to
compute the matrix multiplication. In addition, the column names of
DataFrame and the index of other must contain the same values, as they
will be aligned prior to the multiplication.

The dot method for Series computes the inner product, instead of the
matrix product here.

Examples
--------
Here we multiply a DataFrame with a Series.

>>> df = pd.DataFrame([[0, 1, -2, -1], [1, 1, 1, 1]])
>>> s = pd.Series([1, 1, 2, 1])
>>> df.dot(s)
0    -4
1     5
dtype: int64

Here we multiply a DataFrame with another DataFrame.

>>> other = pd.DataFrame([[0, 1], [1, 2], [-1, -1], [2, 0]])
>>> df.dot(other)
    0   1
0   1   4
1   2   2

Note that the dot method give the same result as @

>>> df @ other
    0   1
0   1   4
1   2   2

The dot method works also if other is an np.array.

>>> arr = np.array([[0, 1], [1, 2], [-1, -1], [2, 0]])
>>> df.dot(arr)
    0   1
0   1   4
1   2   2

Note how shuffling of the objects does not change the result.

>>> s2 = s.reindex([1, 0, 2, 3])
>>> df.dot(s2)
0    -4
1     5
dtype: int64
zmatrices are not alignedFr   r   r   r   r   r   zDot product shape mismatch, z vs r   r   r   r   )r   r   r   r   zunsupported type: )r   r}   r   r   unionr   r  r  reindexr   rR  r  r  rC  r4   r  r  r   r  r   r  rf   r  r  r   )	r   r  rQ   leftrightlvalsrvalscommon_typeresults	            r   r  r  y  s3   Z efi011\\''4F6{S..#f+EKK@P2P !;<<<<U<;DMMUM;EKKEMMEDKKEJJu%E{{1~Q/ 25;;-tEKK=Q  eY''*4+<tELL?Q+QRK$$u$jj! %   v&&*4+<~+MNK++u$DJJU+ ,   

E233VVE)F{{a((zz(NN//jju/UU0e>??r   c                    g r   r{  r  s     r   
__matmul__DataFrame.__matmul__  r  r   c                    g r   r{  r  s     r   r  r    r  r   c                $    U R                  U5      $ )2
Matrix multiplication using binary `@` operator.
)r  r  s     r   r  r    s     xxr   c                     U R                   R                  [        R                  " U5      5      R                   $ ! [         aH  nS[        U5      ;  a  e S[        R                  " U5       SU R                   S3n[	        U5      UeSnAff = f)r  zshape mismatchzshapes z and z not alignedN)rQ  r  r  	transposer  strrC  )r   r  errmsgs       r   __rmatmul__DataFrame.__rmatmul__  su    	+66::bll512444 	+s3x/BHHUO,E$**\JCS/s*	+s   8; 
BABBr  orientc                   SnUR                  5       nUS:X  a  [        U5      S:  ay  [        [        [	        UR                  5       5      5      [        [        45      (       a  [        U5      nO[[        UR                  5       5      n[        UR                  5       5      nO(US;   a  Ub  [        SU S35      eO[        SU S35      eUS	:w  a  U " XXCS
9$ US   nS nU" US   US   5      nU" US   US   5      nU " XeXCS
9$ )aB	  
Construct DataFrame from dict of array-like or dicts.

Creates DataFrame object from dictionary by columns or by index
allowing dtype specification.

Parameters
----------
data : dict
    Of the form {field : array-like} or {field : dict}.
orient : {'columns', 'index', 'tight'}, default 'columns'
    The "orientation" of the data. If the keys of the passed dict
    should be the columns of the resulting DataFrame, pass 'columns'
    (default). Otherwise if the keys should be rows, pass 'index'.
    If 'tight', assume a dict with keys ['index', 'columns', 'data',
    'index_names', 'column_names'].

    .. versionadded:: 1.4.0
       'tight' as an allowed value for the ``orient`` argument

dtype : dtype, default None
    Data type to force after DataFrame construction, otherwise infer.
columns : list, default None
    Column labels to use when ``orient='index'``. Raises a ValueError
    if used with ``orient='columns'`` or ``orient='tight'``.

Returns
-------
DataFrame

See Also
--------
DataFrame.from_records : DataFrame from structured ndarray, sequence
    of tuples or dicts, or DataFrame.
DataFrame : DataFrame object creation using constructor.
DataFrame.to_dict : Convert the DataFrame to a dictionary.

Examples
--------
By default the keys of the dict become the DataFrame columns:

>>> data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
>>> pd.DataFrame.from_dict(data)
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d

Specify ``orient='index'`` to create the DataFrame using dictionary
keys as rows:

>>> data = {'row_1': [3, 2, 1, 0], 'row_2': ['a', 'b', 'c', 'd']}
>>> pd.DataFrame.from_dict(data, orient='index')
       0  1  2  3
row_1  3  2  1  0
row_2  a  b  c  d

When using the 'index' orientation, the column names can be
specified manually:

>>> pd.DataFrame.from_dict(data, orient='index',
...                        columns=['A', 'B', 'C', 'D'])
       A  B  C  D
row_1  3  2  1  0
row_2  a  b  c  d

Specify ``orient='tight'`` to create the DataFrame using a 'tight'
format:

>>> data = {'index': [('a', 'b'), ('a', 'c')],
...         'columns': [('x', 1), ('y', 2)],
...         'data': [[1, 3], [2, 4]],
...         'index_names': ['n1', 'n2'],
...         'column_names': ['z1', 'z2']}
>>> pd.DataFrame.from_dict(data, orient='tight')
z1     x  y
z2     1  2
n1 n2
a  b   1  3
   c   2  4
Nr   r   )r   tightz*cannot use columns parameter with orient=''zBExpected 'index', 'columns' or 'tight' for orient parameter. Got 'z	' insteadr  r   r   r   r  c                h    [        U5      S:  a  [        R                  " XS9nU$ [        XS   S9nU$ )Nr   r  r   r   )r  rk   from_tuplesrf   )	indexlistnamelistr   s      r   create_index)DataFrame.from_dict.<locals>.create_index  s:    x=1$&229ME  ")1+>Er   r  r   column_names)lowerr  r   nextiterr   r}   r  _from_nested_dictr  keysr  )clsr  r   r   r   r   realdatar  s           r   	from_dictDataFrame.from_dict  s   t W4y1}d4#67&$HH,T2D -E  .D++" #MfXUV!WXX # xy* 
 Wt'GGF|H !g]0CDE"4	?D4HIGxgKKr   c                    Ub  [         R                  " U5      nU R                  R                  XUS9nUR                  ULa  [         R                  " XAS9nU$ )a  
Convert the DataFrame to a NumPy array.

By default, the dtype of the returned array will be the common NumPy
dtype of all types in the DataFrame. For example, if the dtypes are
``float16`` and ``float32``, the results dtype will be ``float32``.
This may require copying data and coercing values, which may be
expensive.

Parameters
----------
dtype : str or numpy.dtype, optional
    The dtype to pass to :meth:`numpy.asarray`.
copy : bool, default False
    Whether to ensure that the returned value is not a view on
    another array. Note that ``copy=False`` does not *ensure* that
    ``to_numpy()`` is no-copy. Rather, ``copy=True`` ensure that
    a copy is made, even if not strictly necessary.
na_value : Any, optional
    The value to use for missing values. The default value depends
    on `dtype` and the dtypes of the DataFrame columns.

Returns
-------
numpy.ndarray

See Also
--------
Series.to_numpy : Similar method for Series.

Examples
--------
>>> pd.DataFrame({"A": [1, 2], "B": [3, 4]}).to_numpy()
array([[1, 3],
       [2, 4]])

With heterogeneous data, the lowest common type will have to
be used.

>>> df = pd.DataFrame({"A": [1, 2], "B": [3.0, 4.5]})
>>> df.to_numpy()
array([[1. , 3. ],
       [2. , 4.5]])

For a mix of numeric and non-numeric types, the output array will
have object dtype.

>>> df['C'] = pd.date_range('2000', periods=2)
>>> df.to_numpy()
array([[1, 3.0, Timestamp('2000-01-01 00:00:00')],
       [2, 4.5, Timestamp('2000-01-02 00:00:00')]], dtype=object)
)r   r   na_valuer   )r  r   r   as_arrayr  )r   r   r   r  r  s        r   to_numpyDataFrame.to_numpy  sP    t HHUOE##%X#N<<u$ZZ4Fr   c           	     <   U(       a9  U R                  SSS9 Vs/ s H  n[        [        [        U5      5      PM     nnU$ U R                  SSS9 Vs/ s H  n[        U5      PM     nnU(       a!  U H  nU H  n[        XV   5      XV'   M     M     U$ s  snf s  snf )z
Simple helper method to create data for to ``to_dict(orient="split")`` and
``to_dict(orient="tight")`` to create the main output data
FNr  )r  r  r  r7   )r   are_all_object_dtype_colsobject_dtype_indicestr  rowr  s          r   (_create_data_for_split_and_tight_to_dict2DataFrame._create_data_for_split_and_tight_to_dict  s     % u4@@A S)1-.@    &*__5t_%LM%LDG%LDM#  C1!1#&!9 2   
 Ns   #BBr   c                   g r   r{  r   r   intor   s       r   to_dictDataFrame.to_dict       	r   c                   g r   r{  r&  s       r   r(  r)    r*  r   r'  r   c                   g r   r{  r&  s       r   r(  r)    r*  r   c                   g r   r{  r&  s       r   r(  r)    r*  r   r(  c                    SSK Jn  U" XX#S9$ )a  
Convert the DataFrame to a dictionary.

The type of the key-value pairs can be customized with the parameters
(see below).

Parameters
----------
orient : str {'dict', 'list', 'series', 'split', 'tight', 'records', 'index'}
    Determines the type of the values of the dictionary.

    - 'dict' (default) : dict like {column -> {index -> value}}
    - 'list' : dict like {column -> [values]}
    - 'series' : dict like {column -> Series(values)}
    - 'split' : dict like
      {'index' -> [index], 'columns' -> [columns], 'data' -> [values]}
    - 'tight' : dict like
      {'index' -> [index], 'columns' -> [columns], 'data' -> [values],
      'index_names' -> [index.names], 'column_names' -> [column.names]}
    - 'records' : list like
      [{column -> value}, ... , {column -> value}]
    - 'index' : dict like {index -> {column -> value}}

    .. versionadded:: 1.4.0
        'tight' as an allowed value for the ``orient`` argument

into : class, default dict
    The collections.abc.MutableMapping subclass used for all Mappings
    in the return value.  Can be the actual class or an empty
    instance of the mapping type you want.  If you want a
    collections.defaultdict, you must pass it initialized.

index : bool, default True
    Whether to include the index item (and index_names item if `orient`
    is 'tight') in the returned dictionary. Can only be ``False``
    when `orient` is 'split' or 'tight'.

    .. versionadded:: 2.0.0

Returns
-------
dict, list or collections.abc.MutableMapping
    Return a collections.abc.MutableMapping object representing the
    DataFrame. The resulting transformation depends on the `orient`
    parameter.

See Also
--------
DataFrame.from_dict: Create a DataFrame from a dictionary.
DataFrame.to_json: Convert a DataFrame to JSON format.

Examples
--------
>>> df = pd.DataFrame({'col1': [1, 2],
...                    'col2': [0.5, 0.75]},
...                   index=['row1', 'row2'])
>>> df
      col1  col2
row1     1  0.50
row2     2  0.75
>>> df.to_dict()
{'col1': {'row1': 1, 'row2': 2}, 'col2': {'row1': 0.5, 'row2': 0.75}}

You can specify the return orientation.

>>> df.to_dict('series')
{'col1': row1    1
         row2    2
Name: col1, dtype: int64,
'col2': row1    0.50
        row2    0.75
Name: col2, dtype: float64}

>>> df.to_dict('split')
{'index': ['row1', 'row2'], 'columns': ['col1', 'col2'],
 'data': [[1, 0.5], [2, 0.75]]}

>>> df.to_dict('records')
[{'col1': 1, 'col2': 0.5}, {'col1': 2, 'col2': 0.75}]

>>> df.to_dict('index')
{'row1': {'col1': 1, 'col2': 0.5}, 'row2': {'col1': 2, 'col2': 0.75}}

>>> df.to_dict('tight')
{'index': ['row1', 'row2'], 'columns': ['col1', 'col2'],
 'data': [[1, 0.5], [2, 0.75]], 'index_names': [None], 'column_names': [None]}

You can also specify the mapping type.

>>> from collections import OrderedDict, defaultdict
>>> df.to_dict(into=OrderedDict)
OrderedDict([('col1', OrderedDict([('row1', 1), ('row2', 2)])),
             ('col2', OrderedDict([('row1', 0.5), ('row2', 0.75)]))])

If you want a `defaultdict`, you need to initialize it:

>>> dd = defaultdict(list)
>>> df.to_dict('records', into=dd)
[defaultdict(<class 'list'>, {'col1': 1, 'col2': 0.5}),
 defaultdict(<class 'list'>, {'col1': 2, 'col2': 0.75})]
r   )r(  r,  )pandas.core.methods.to_dictr(  )r   r   r'  r   r(  s        r   r(  r)    s    b 	8t$<<r   destination_tableto_gbqc                B    SSK Jn  UR                  U UUUUUUUUU	U
S9  g)a'  
Write a DataFrame to a Google BigQuery table.

.. deprecated:: 2.2.0

   Please use ``pandas_gbq.to_gbq`` instead.

This function requires the `pandas-gbq package
<https://pandas-gbq.readthedocs.io>`__.

See the `How to authenticate with Google BigQuery
<https://pandas-gbq.readthedocs.io/en/latest/howto/authentication.html>`__
guide for authentication instructions.

Parameters
----------
destination_table : str
    Name of table to be written, in the form ``dataset.tablename``.
project_id : str, optional
    Google BigQuery Account project ID. Optional when available from
    the environment.
chunksize : int, optional
    Number of rows to be inserted in each chunk from the dataframe.
    Set to ``None`` to load the whole dataframe at once.
reauth : bool, default False
    Force Google BigQuery to re-authenticate the user. This is useful
    if multiple accounts are used.
if_exists : str, default 'fail'
    Behavior when the destination table exists. Value can be one of:

    ``'fail'``
        If table exists raise pandas_gbq.gbq.TableCreationError.
    ``'replace'``
        If table exists, drop it, recreate it, and insert data.
    ``'append'``
        If table exists, insert data. Create if does not exist.
auth_local_webserver : bool, default True
    Use the `local webserver flow`_ instead of the `console flow`_
    when getting user credentials.

    .. _local webserver flow:
        https://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server
    .. _console flow:
        https://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console

    *New in version 0.2.0 of pandas-gbq*.

    .. versionchanged:: 1.5.0
       Default value is changed to ``True``. Google has deprecated the
       ``auth_local_webserver = False`` `"out of band" (copy-paste)
       flow
       <https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob>`_.
table_schema : list of dicts, optional
    List of BigQuery table fields to which according DataFrame
    columns conform to, e.g. ``[{'name': 'col1', 'type':
    'STRING'},...]``. If schema is not provided, it will be
    generated according to dtypes of DataFrame columns. See
    BigQuery API documentation on available names of a field.

    *New in version 0.3.1 of pandas-gbq*.
location : str, optional
    Location where the load job should run. See the `BigQuery locations
    documentation
    <https://cloud.google.com/bigquery/docs/dataset-locations>`__ for a
    list of available locations. The location must match that of the
    target dataset.

    *New in version 0.5.0 of pandas-gbq*.
progress_bar : bool, default True
    Use the library `tqdm` to show the progress bar for the upload,
    chunk by chunk.

    *New in version 0.5.0 of pandas-gbq*.
credentials : google.auth.credentials.Credentials, optional
    Credentials for accessing Google APIs. Use this parameter to
    override default credentials, such as to use Compute Engine
    :class:`google.auth.compute_engine.Credentials` or Service
    Account :class:`google.oauth2.service_account.Credentials`
    directly.

    *New in version 0.8.0 of pandas-gbq*.

See Also
--------
pandas_gbq.to_gbq : This function in the pandas-gbq library.
read_gbq : Read a DataFrame from Google BigQuery.

Examples
--------
Example taken from `Google BigQuery documentation
<https://cloud.google.com/bigquery/docs/samples/bigquery-pandas-gbq-to-gbq-simple>`_

>>> project_id = "my-project"
>>> table_id = 'my_dataset.my_table'
>>> df = pd.DataFrame({
...                   "my_string": ["a", "b", "c"],
...                   "my_int64": [1, 2, 3],
...                   "my_float64": [4.0, 5.0, 6.0],
...                   "my_bool1": [True, False, True],
...                   "my_bool2": [False, True, False],
...                   "my_dates": pd.date_range("now", periods=3),
...                   }
...                   )

>>> df.to_gbq(table_id, project_id=project_id)  # doctest: +SKIP
r   )gbq)	
project_id	chunksizereauth	if_existsauth_local_webservertable_schemalocationprogress_barcredentialsN)	pandas.ior4  r2  )r   r1  r5  r6  r7  r8  r9  r:  r;  r<  r=  r4  s               r   r2  DataFrame.to_gbq  s:    t 	"

!!5%%# 	 	
r   c                   [        U[        5      (       aq  [        R                  " S[        [        5       S9  Ub  [        U5      (       a  U/nX   nUb  UR                  U5      nUb  UR                  US9nUR                  SS9$ SnUb  [        U5      n        SS jn[        U5      (       a  US:X  a  U " 5       $  [        U5      n	Sn
[        U	S
5      (       a'  U	R                  R                   (       a  U	R                  n
U	/nUc  X-  nO(UR#                  [$        R&                  " XS-
  5      5        U
b  [(        R*                  " XS9nOUn[        U[,        5      (       a  Uc+  [        [/        U5      5      =pLU Vs/ s H  oU   PM	     nnGO/ n/ nUR1                  5        H/  u  nnX;   d  M  UR3                  U5        UR3                  U5        M1     [5        U5      nU" XXB5      u  pnO[        U[(        R6                  5      (       a  [9        X5      u  pUnOt[9        X5      u  pU(       aC  [;        U5       H4  u  nnUR                  [<        :X  d  M  [>        R@                  " USS9UU'   M6     [        U5      nUc  UnOU" XXB5      u  pnUc  [C        5       nO[C        U5      nUb  [        U[D        5      (       d  [        US5      (       dJ  URG                  U5      nURI                  U5        [K        U5      S:  a  [5        UU   US9nOJ[5        / US9nO? U Vs/ s H  nXRG                  U5         PM     nn[M        UUS9nURO                  U5        [U        U5      (       at  U Vs/ s H  nUU;   d  M  UPM     nnU Vs/ s H  nURG                  U5      PM     nn[;        U5       VVs/ s H  u  nnUU;  d  M  UPM     nnnUR                  U5      n[W        SSS9n[Y        XUUS9nU R[                  UUR\                  S9$ ! [         a	    U " X$S	9s $ f = fs  snf s  snf ! [P        [R        4 a    Un Nf = fs  snf s  snf s  snnf )ah  
Convert structured or record ndarray to DataFrame.

Creates a DataFrame object from a structured ndarray, sequence of
tuples or dicts, or DataFrame.

Parameters
----------
data : structured ndarray, sequence of tuples or dicts, or DataFrame
    Structured input data.

    .. deprecated:: 2.1.0
        Passing a DataFrame is deprecated.
index : str, list of fields, array-like
    Field of array to use as the index, alternately a specific set of
    input labels to use.
exclude : sequence, default None
    Columns or fields to exclude.
columns : sequence, default None
    Column names to use. If the passed data do not have names
    associated with them, this argument provides names for the
    columns. Otherwise this argument indicates the order of the columns
    in the result (any names not found in the data will become all-NA
    columns).
coerce_float : bool, default False
    Attempt to convert values of non-string, non-numeric objects (like
    decimal.Decimal) to floating point, useful for SQL result sets.
nrows : int, default None
    Number of rows to read if data is an iterator.

Returns
-------
DataFrame

See Also
--------
DataFrame.from_dict : DataFrame from dict of array-like or dicts.
DataFrame : DataFrame object creation using constructor.

Examples
--------
Data can be provided as a structured ndarray:

>>> data = np.array([(3, 'a'), (2, 'b'), (1, 'c'), (0, 'd')],
...                 dtype=[('col_1', 'i4'), ('col_2', 'U1')])
>>> pd.DataFrame.from_records(data)
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d

Data can be provided as a list of dicts:

>>> data = [{'col_1': 3, 'col_2': 'a'},
...         {'col_1': 2, 'col_2': 'b'},
...         {'col_1': 1, 'col_2': 'c'},
...         {'col_1': 0, 'col_2': 'd'}]
>>> pd.DataFrame.from_records(data)
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d

Data can be provided as a list of tuples with corresponding columns:

>>> data = [(3, 'a'), (2, 'b'), (1, 'c'), (0, 'd')]
>>> pd.DataFrame.from_records(data, columns=['col_1', 'col_2'])
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d
zwPassing a DataFrame to DataFrame.from_records is deprecated. Use set_index and/or drop to modify the DataFrame instead.r   N)r   Fr   c                    [        U 5      (       a  [        U S   5      nOSnSn[        U 5      S:X  a  Uc  US:X  a  [        S5      n[        XX$5      u  pXU4$ )z
If our desired 'columns' do not match the data's pre-existing 'arr_columns',
we re-order our arrays.  This is like a pre-emptive (cheap) reindex.
r   N)r  rh   rx   )r  arr_columnsr   r   lengthresult_indexs         r   maybe_reorder-DataFrame.from_records.<locals>.maybe_reorderz	  s^     6{{VAYL6{aEMfk,Q/"0g"VF44r   r   r   r   r   r  T)	try_float__iter__r  r  r   r   r   r   )r  zlist[ArrayLike]rB  rf   r   rf   returnz+tuple[list[ArrayLike], Index, Index | None])/r   r   r   r   r  r+   rF   	set_indexdropr   ri   rD   r  StopIterationr  r   r  r  	itertoolsislicer  r   r  sortedr  r  rf   r  ry   r  r  r   maybe_convert_objectsr  r  get_locaddr  rj   updateKeyErrorr  anyr   rq   r   r   )r  r  r   excluder   coerce_floatnrowsrD  rE  	first_rowr   r   rB  r  r  arr_columns_listr  r  rF  field
index_dataxarr_excludecol	to_remover  r   s                              r   from_recordsDataFrame.from_records	  sA   j dI&&MMI+-	 "W%%&iG} ~~e,"yyy199%9(( "7+G	5#	527	5BG	58	5& tzu9 J	 Ey'**y/D/D![F}i..tQY?@ xx4dD!!(4VD\(BB+237aq'73#%  JJLDAq|(//2a( )
 $$454A51\ bjj))'6OF!K"+D":F'/FAsyyF* %($=$=&*%q	 0 '{3K%4A51\ ?eG'lG%%%WUJ-G-GOOE*E"v;?#(#?L#(%#8L*RW!XRW&)<)<U)C"DRWJ!X
 $?zQV#WLNN5)w<<&-Bgk1A1gKB=HI[c,,S1[II$-f$5L$5DAq)9Ka$5FLll7+G1$?F\wG}}Ssxx}00{ ! 9889, 4j "Y ), )#(L) CILsZ   P P-&P7 *P2P7 8
QQQ=QQP*)P*2P7 7QQc           	        U(       GaK  [        U R                  R                  5       Vs/ s H2  n[        R                  " U R                  R                  U5      5      PM4     nnU[        [        U R                  5      5       Vs/ s H*  n[        R                  " U R                  SS2U4   5      PM,     sn-   n[        U R                  R                  5      n[        U R                  [        5      (       a  [        R                  " U5      nO	US   c  S/n[        R                   " XpR                  5       Vs/ s H  n[#        U5      PM     n	nOz[        [        U R                  5      5       Vs/ s H*  n[        R                  " U R                  SS2U4   5      PM,     nnU R                   V
s/ s H  n
[#        U
5      PM     n	n
/ n[        U5      n/ n[%        U5       H  u  pMUnX:  a  UnX~   nOX-  nUnU R                  U   n['        U5      (       a  X;   a  X   nOX;   a  X   nOSnUc  UR)                  UR*                  5        Mn  [        U[,        [        R*                  ["        45      (       a  UR)                  U5        M  XK:  a  SOSnSU SU SU 3n[/        U5      e   [        R0                  R3                  XiUS	.S
9$ s  snf s  snf s  snf s  snf s  sn
f )a	  
Convert DataFrame to a NumPy record array.

Index will be included as the first field of the record array if
requested.

Parameters
----------
index : bool, default True
    Include index in resulting record array, stored in 'index'
    field or using the index label, if set.
column_dtypes : str, type, dict, default None
    If a string or type, the data type to store all columns. If
    a dictionary, a mapping of column names and indices (zero-indexed)
    to specific data types.
index_dtypes : str, type, dict, default None
    If a string or type, the data type to store all index levels. If
    a dictionary, a mapping of index level names and indices
    (zero-indexed) to specific data types.

    This mapping is applied only if `index=True`.

Returns
-------
numpy.rec.recarray
    NumPy ndarray with the DataFrame labels as fields and each row
    of the DataFrame as entries.

See Also
--------
DataFrame.from_records: Convert structured or record ndarray
    to DataFrame.
numpy.rec.recarray: An ndarray that allows field access using
    attributes, analogous to typed columns in a
    spreadsheet.

Examples
--------
>>> df = pd.DataFrame({'A': [1, 2], 'B': [0.5, 0.75]},
...                   index=['a', 'b'])
>>> df
   A     B
a  1  0.50
b  2  0.75
>>> df.to_records()
rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)],
          dtype=[('index', 'O'), ('A', '<i8'), ('B', '<f8')])

If the DataFrame index has no label then the recarray field name
is set to 'index'. If the index has a label then this is used as the
field name:

>>> df.index = df.index.rename("I")
>>> df.to_records()
rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)],
          dtype=[('I', 'O'), ('A', '<i8'), ('B', '<f8')])

The index can be excluded from the record array:

>>> df.to_records(index=False)
rec.array([(1, 0.5 ), (2, 0.75)],
          dtype=[('A', '<i8'), ('B', '<f8')])

Data types can be specified for the columns:

>>> df.to_records(column_dtypes={"A": "int32"})
rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)],
          dtype=[('I', 'O'), ('A', '<i4'), ('B', '<f8')])

As well as for the index:

>>> df.to_records(index_dtypes="<S2")
rec.array([(b'a', 1, 0.5 ), (b'b', 2, 0.75)],
          dtype=[('I', 'S2'), ('A', '<i8'), ('B', '<f8')])

>>> index_dtypes = f"<S{df.index.str.len().max()}"
>>> df.to_records(index_dtypes=index_dtypes)
rec.array([(b'a', 1, 0.5 ), (b'b', 2, 0.75)],
          dtype=[('I', 'S1'), ('A', '<i8'), ('B', '<f8')])
Nr   r   r!  columnzInvalid dtype z specified for  )r  formatsr  )r  r   nlevelsr  r  get_level_valuesr  r   r  r  r  r   rk   comfill_missing_namesrM  chainr  r  r>   r  r   r   r  rec
fromarrays)r   r   column_dtypesindex_dtypesr  ix_valsr  r  r   r  c	index_lenrf  r  	index_intdtype_mappingelementr  s                     r   
to_recordsDataFrame.to_records	  s   f  tzz1122A 

4::66q9:2  
 5:3t||;L5M 5M

499QT?+5M  F tzz//0K$**j11!44[AQ'&i+4??;+UV+U4SY+UEVE;@T\\AR;ST;Sabjj1a41;SFT%)\\2\SV\E2K$	f%DAI $ ,"-&	 -||I. M**($1$7M/$1$<M$(M $qww'MD"((C+@AA }-#$=%h&}o_WIQtfU o%_ &b vv  7/S TTU
  WT2s   9K1K<K41K!5K&c           	         Ub  [        U5      n[        SSS9n[        U5      n[        U5      [        U5      :w  a  [	        S5      e[        UUUUUUS9nU R                  XwR                  S9$ )a  
Create DataFrame from a list of arrays corresponding to the columns.

Parameters
----------
arrays : list-like of arrays
    Each array in the list corresponds to one column, in order.
columns : list-like, Index
    The column names for the resulting DataFrame.
index : list-like, Index
    The rows labels for the resulting DataFrame.
dtype : dtype, optional
    Optional dtype to enforce for all arrays.
verify_integrity : bool, default True
    Validate and homogenize all input. If set to False, it is assumed
    that all elements of `arrays` are actual arrays how they will be
    stored in a block (numpy ndarray or ExtensionArray), have the same
    length as and are aligned with the index, and that `columns` and
    `index` are ensured to be an Index object.

Returns
-------
DataFrame
r   Tr   z#len(columns) must match len(arrays))r   verify_integrityr   r   )rI   r   ri   r  r  rq   r   r   )r  r  r   r   r   ry  r  r   s           r   _from_arraysDataFrame._from_arrays
  s{    B  'E1$?w'w<3v;&BCC-
 }}Sxx}00r   storage_optionscompression_optionspath)r|  r}  r   infer)convert_dateswrite_index	byteorder
time_stamp
data_labelvariable_labelsr  convert_strlcompressionr|  value_labelsc                  US;  a  [        S5      eUS:X  a  U	b  [        S5      eSSKJn  OUS:X  a  SS	KJn  OSS
KJn  0 nUb  US:  a  XS'   Ub  US:  a  XS'   U" UU 4UUUUUUU
UUS.	UD6nUR                  5         g)a  
Export DataFrame object to Stata dta format.

Writes the DataFrame to a Stata dataset file.
"dta" files contain a Stata dataset.

Parameters
----------
path : str, path object, or buffer
    String, path object (implementing ``os.PathLike[str]``), or file-like
    object implementing a binary ``write()`` function.

convert_dates : dict
    Dictionary mapping columns containing datetime types to stata
    internal format to use when writing the dates. Options are 'tc',
    'td', 'tm', 'tw', 'th', 'tq', 'ty'. Column can be either an integer
    or a name. Datetime columns that do not have a conversion type
    specified will be converted to 'tc'. Raises NotImplementedError if
    a datetime column has timezone information.
write_index : bool
    Write the index to Stata dataset.
byteorder : str
    Can be ">", "<", "little", or "big". default is `sys.byteorder`.
time_stamp : datetime
    A datetime to use as file creation date.  Default is the current
    time.
data_label : str, optional
    A label for the data set.  Must be 80 characters or smaller.
variable_labels : dict
    Dictionary containing columns as keys and variable labels as
    values. Each label must be 80 characters or smaller.
version : {{114, 117, 118, 119, None}}, default 114
    Version to use in the output dta file. Set to None to let pandas
    decide between 118 or 119 formats depending on the number of
    columns in the frame. Version 114 can be read by Stata 10 and
    later. Version 117 can be read by Stata 13 or later. Version 118
    is supported in Stata 14 and later. Version 119 is supported in
    Stata 15 and later. Version 114 limits string variables to 244
    characters or fewer while versions 117 and later allow strings
    with lengths up to 2,000,000 characters. Versions 118 and 119
    support Unicode characters, and version 119 supports more than
    32,767 variables.

    Version 119 should usually only be used when the number of
    variables exceeds the capacity of dta format 118. Exporting
    smaller datasets in format 119 may have unintended consequences,
    and, as of November 2020, Stata SE cannot read version 119 files.

convert_strl : list, optional
    List of column names to convert to string columns to Stata StrL
    format. Only available if version is 117.  Storing strings in the
    StrL format can produce smaller dta files if strings have more than
    8 characters and values are repeated.
{compression_options}

    .. versionchanged:: 1.4.0 Zstandard support.

{storage_options}

value_labels : dict of dicts
    Dictionary containing columns as keys and dictionaries of column value
    to labels as values. Labels for a single variable must be 32,000
    characters or smaller.

    .. versionadded:: 1.4.0

Raises
------
NotImplementedError
    * If datetimes contain timezone information
    * Column dtype is not representable in Stata
ValueError
    * Columns listed in convert_dates are neither datetime64[ns]
      or datetime.datetime
    * Column listed in convert_dates is not in DataFrame
    * Categorical label contains more than 32,000 characters

See Also
--------
read_stata : Import Stata data files.
io.stata.StataWriter : Low-level writer for Stata data files.
io.stata.StataWriter117 : Low-level writer for version 117 files.

Examples
--------
>>> df = pd.DataFrame({{'animal': ['falcon', 'parrot', 'falcon',
...                               'parrot'],
...                    'speed': [350, 18, 361, 15]}})
>>> df.to_stata('animals.dta')  # doctest: +SKIP
)r  u   v   w   Nz1Only formats 114, 117, 118 and 119 are supported.r  Nz#strl is not supported in format 114r   )StataWriterr  )StataWriter117)StataWriterUTF8r  r  r  )	r  r  r  r  r  r  r  r|  r  )r  pandas.io.statar  r  r  
write_file)r   r~  r  r  r  r  r  r  r  r  r  r|  r  statawriterkwargswriters                   r   to_stataDataFrame.to_stata
  s    \ 44PQQc>' !FGGB^ "$?gn%1>"?gn '9
 (!!#+#+%
 
 	r   c                "    SSK Jn  U" X40 UD6  g)a  
Write a DataFrame to the binary Feather format.

Parameters
----------
path : str, path object, file-like object
    String, path object (implementing ``os.PathLike[str]``), or file-like
    object implementing a binary ``write()`` function. If a string or a path,
    it will be used as Root Directory path when writing a partitioned dataset.
**kwargs :
    Additional keywords passed to :func:`pyarrow.feather.write_feather`.
    This includes the `compression`, `compression_level`, `chunksize`
    and `version` keywords.

Notes
-----
This function writes the dataframe as a `feather file
<https://arrow.apache.org/docs/python/feather.html>`_. Requires a default
index. For saving the DataFrame with your custom index use a method that
supports custom indices e.g. `to_parquet`.

Examples
--------
>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]])
>>> df.to_feather("file.feather")  # doctest: +SKIP
r   )
to_featherN)pandas.io.feather_formatr  )r   r~  r  r  s       r   r  DataFrame.to_feather]  s    6 	84((r   to_markdownr   a  Examples
        --------
        >>> df = pd.DataFrame(
        ...     data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
        ... )
        >>> print(df.to_markdown())
        |    | animal_1   | animal_2   |
        |---:|:-----------|:-----------|
        |  0 | elk        | dog        |
        |  1 | pig        | quetzal    |

        Output markdown with a tabulate option.

        >>> print(df.to_markdown(tablefmt="grid"))
        +----+------------+------------+
        |    | animal_1   | animal_2   |
        +====+============+============+
        |  0 | elk        | dog        |
        +----+------------+------------+
        |  1 | pig        | quetzal    |
        +----+------------+------------+)r   r|  examplesc                V   SU;   a  [        S5      eUR                  SS5        UR                  SS5        UR                  SU5        [        S5      nUR                  " U 40 UD6nUc  U$ [	        XUS9 nUR
                  R                  U5        S S S 5        g ! , (       d  f       g = f)	N	showindexz"Pass 'index' instead of 'showindexheadersr  tablefmtpipetabulater|  )r  
setdefaultr   r  r   handlewrite)	r   r\  moder   r|  r  r  r  handless	            r   r  DataFrame.to_markdown|  s    J & ABB)V,*f-+u--j9""4262;M?CwNN  ( D DCs   5B
B(c                    g r   r{  r   r~  enginer  r   partition_colsr|  r  s           r   
to_parquetDataFrame.to_parquet       	r   c                    g r   r{  r  s           r   r  r    r  r   r  r  c                .    SSK Jn  U" U UU4UUUUS.UD6$ )a$  
Write a DataFrame to the binary parquet format.

This function writes the dataframe as a `parquet file
<https://parquet.apache.org/>`_. You can choose different parquet
backends, and have the option of compression. See
:ref:`the user guide <io.parquet>` for more details.

Parameters
----------
path : str, path object, file-like object, or None, default None
    String, path object (implementing ``os.PathLike[str]``), or file-like
    object implementing a binary ``write()`` function. If None, the result is
    returned as bytes. If a string or path, it will be used as Root Directory
    path when writing a partitioned dataset.
engine : {{'auto', 'pyarrow', 'fastparquet'}}, default 'auto'
    Parquet library to use. If 'auto', then the option
    ``io.parquet.engine`` is used. The default ``io.parquet.engine``
    behavior is to try 'pyarrow', falling back to 'fastparquet' if
    'pyarrow' is unavailable.
compression : str or None, default 'snappy'
    Name of the compression to use. Use ``None`` for no compression.
    Supported options: 'snappy', 'gzip', 'brotli', 'lz4', 'zstd'.
index : bool, default None
    If ``True``, include the dataframe's index(es) in the file output.
    If ``False``, they will not be written to the file.
    If ``None``, similar to ``True`` the dataframe's index(es)
    will be saved. However, instead of being saved as values,
    the RangeIndex will be stored as a range in the metadata so it
    doesn't require much space and is faster. Other indexes will
    be included as columns in the file output.
partition_cols : list, optional, default None
    Column names by which to partition the dataset.
    Columns are partitioned in the order they are given.
    Must be None if path is not a string.
{storage_options}

**kwargs
    Additional arguments passed to the parquet library. See
    :ref:`pandas io <io.parquet>` for more details.

Returns
-------
bytes if no path argument is provided else None

See Also
--------
read_parquet : Read a parquet file.
DataFrame.to_orc : Write an orc file.
DataFrame.to_csv : Write a csv file.
DataFrame.to_sql : Write to a sql table.
DataFrame.to_hdf : Write to hdf.

Notes
-----
This function requires either the `fastparquet
<https://pypi.org/project/fastparquet>`_ or `pyarrow
<https://arrow.apache.org/docs/python/>`_ library.

Examples
--------
>>> df = pd.DataFrame(data={{'col1': [1, 2], 'col2': [3, 4]}})
>>> df.to_parquet('df.parquet.gzip',
...               compression='gzip')  # doctest: +SKIP
>>> pd.read_parquet('df.parquet.gzip')  # doctest: +SKIP
   col1  col2
0     1     3
1     2     4

If you want to get a buffer to the parquet content you can use a io.BytesIO
object, as long as you don't use partition_cols, which creates multiple files.

>>> import io
>>> f = io.BytesIO()
>>> df.to_parquet(f)
>>> f.seek(0)
0
>>> content = f.read()
r   )r  )r  r   r  r|  )pandas.io.parquetr  )	r   r~  r  r  r   r  r|  r  r  s	            r   r  r    s;    z 	1	
 $)+	
 	
 		
r   r4  r  r   engine_kwargsc                   SSK Jn  U" XX#US9$ )an	  
Write a DataFrame to the ORC format.

.. versionadded:: 1.5.0

Parameters
----------
path : str, file-like object or None, default None
    If a string, it will be used as Root Directory path
    when writing a partitioned dataset. By file-like object,
    we refer to objects with a write() method, such as a file handle
    (e.g. via builtin open function). If path is None,
    a bytes object is returned.
engine : {'pyarrow'}, default 'pyarrow'
    ORC library to use.
index : bool, optional
    If ``True``, include the dataframe's index(es) in the file output.
    If ``False``, they will not be written to the file.
    If ``None``, similar to ``infer`` the dataframe's index(es)
    will be saved. However, instead of being saved as values,
    the RangeIndex will be stored as a range in the metadata so it
    doesn't require much space and is faster. Other indexes will
    be included as columns in the file output.
engine_kwargs : dict[str, Any] or None, default None
    Additional keyword arguments passed to :func:`pyarrow.orc.write_table`.

Returns
-------
bytes if no path argument is provided else None

Raises
------
NotImplementedError
    Dtype of one or more columns is category, unsigned integers, interval,
    period or sparse.
ValueError
    engine is not pyarrow.

See Also
--------
read_orc : Read a ORC file.
DataFrame.to_parquet : Write a parquet file.
DataFrame.to_csv : Write a csv file.
DataFrame.to_sql : Write to a sql table.
DataFrame.to_hdf : Write to hdf.

Notes
-----
* Before using this function you should read the :ref:`user guide about
  ORC <io.orc>` and :ref:`install optional dependencies <install.warn_orc>`.
* This function requires `pyarrow <https://arrow.apache.org/docs/python/>`_
  library.
* For supported dtypes please refer to `supported ORC features in Arrow
  <https://arrow.apache.org/docs/cpp/orc.html#data-types>`__.
* Currently timezones in datetime columns are not preserved when a
  dataframe is converted into ORC files.

Examples
--------
>>> df = pd.DataFrame(data={'col1': [1, 2], 'col2': [4, 3]})
>>> df.to_orc('df.orc')  # doctest: +SKIP
>>> pd.read_orc('df.orc')  # doctest: +SKIP
   col1  col2
0     1     4
1     2     3

If you want to get a buffer to the orc content you can write it to io.BytesIO

>>> import io
>>> b = io.BytesIO(df.to_orc())  # doctest: +SKIP
>>> b.seek(0)  # doctest: +SKIP
0
>>> content = b.read()  # doctest: +SKIP
r   )to_orcr  )pandas.io.orcr  )r   r~  r  r   r  r  s         r   r  DataFrame.to_orc4  s    d 	)v-
 	
r   c                    g r   r{  r   r\  r   r  r  r   r  r  r  r  r  r  rV  r  r  r  r  classesr  r  bordertable_idrender_linksr  s                           r   r  DataFrame.to_html      6 	r   c                    g r   r{  r  s                           r   r  r    r  r   r  z,Whether to print column labels, default Truez&str or int, list or dict of int or strzXThe minimum width of each column in CSS length units.  An int is assumed to be px units.c           
     "   Ub  U[         R                  ;  a  [        S5      e[         R                  " U 40 SU_SU_SU_SU_SU_SU_SU_S	U_S
U	_SU_SU
_SU_SU_SU_SU_SU_6n[         R                  " U5      R                  UUUUUUUS9$ )az  
Render a DataFrame as an HTML table.
%(shared_params)s
bold_rows : bool, default True
    Make the row labels bold in the output.
classes : str or list or tuple, default None
    CSS class(es) to apply to the resulting html table.
escape : bool, default True
    Convert the characters <, >, and & to HTML-safe sequences.
notebook : {True, False}, default False
    Whether the generated HTML is for IPython Notebook.
border : int
    A ``border=border`` attribute is included in the opening
    `<table>` tag. Default ``pd.options.display.html.border``.
table_id : str, optional
    A css id is included in the opening `<table>` tag if specified.
render_links : bool, default False
    Convert URLs to HTML links.
encoding : str, default "utf-8"
    Set character encoding.
%(returns)s
See Also
--------
to_string : Convert DataFrame to a string.

Examples
--------
>>> df = pd.DataFrame(data={'col1': [1, 2], 'col2': [4, 3]})
>>> html_string = '''<table border="1" class="dataframe">
...   <thead>
...     <tr style="text-align: right;">
...       <th></th>
...       <th>col1</th>
...       <th>col2</th>
...     </tr>
...   </thead>
...   <tbody>
...     <tr>
...       <th>0</th>
...       <td>1</td>
...       <td>4</td>
...     </tr>
...     <tr>
...       <th>1</th>
...       <td>2</td>
...       <td>3</td>
...     </tr>
...   </tbody>
... </table>'''
>>> assert html_string == df.to_html()
z#Invalid value for justify parameterr   r  r  r  r   r  r  r  r  r  r  r  r  rV  r  r  )r\  r  r  r  r  r  r  )r|  VALID_JUSTIFY_PARAMETERSr  r  r  r  )r   r\  r   r  r  r   r  r  r  r  r  r  rV  r  r  r  r  r  r  r  r  r  r  r  r  s                            r   r  r    s   p 7#2N2N#NBCC**

  
 	

 
 
 "
 &
  
 
 
 $
 
 
 
  !
" ,#
	( $$Y/77% 8 
 	
r   )r   	root_namerow_namer  	attr_cols	elem_cols
namespacesprefixr  xml_declarationpretty_printparser
stylesheetr  r|  path_or_bufferc                   g r   r{  r   r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r|  s                    r   to_xmlDataFrame.to_xml?      * 	r   c                   g r   r{  r  s                    r   r  r  V  r  r   r  c                    SSK JnJn  [        SSS9nUS:X  a  Ub  UnO[	        S5      eUS:X  a  UnO[        S	5      eU" U 4UUUUUUUUU	U
UUUUUS
.6nUR                  5       $ )a  
Render a DataFrame to an XML document.

.. versionadded:: 1.3.0

Parameters
----------
path_or_buffer : str, path object, file-like object, or None, default None
    String, path object (implementing ``os.PathLike[str]``), or file-like
    object implementing a ``write()`` function. If None, the result is returned
    as a string.
index : bool, default True
    Whether to include index in XML document.
root_name : str, default 'data'
    The name of root element in XML document.
row_name : str, default 'row'
    The name of row element in XML document.
na_rep : str, optional
    Missing data representation.
attr_cols : list-like, optional
    List of columns to write as attributes in row element.
    Hierarchical columns will be flattened with underscore
    delimiting the different levels.
elem_cols : list-like, optional
    List of columns to write as children in row element. By default,
    all columns output as children of row element. Hierarchical
    columns will be flattened with underscore delimiting the
    different levels.
namespaces : dict, optional
    All namespaces to be defined in root element. Keys of dict
    should be prefix names and values of dict corresponding URIs.
    Default namespaces should be given empty string key. For
    example, ::

        namespaces = {{"": "https://example.com"}}

prefix : str, optional
    Namespace prefix to be used for every element and/or attribute
    in document. This should be one of the keys in ``namespaces``
    dict.
encoding : str, default 'utf-8'
    Encoding of the resulting document.
xml_declaration : bool, default True
    Whether to include the XML declaration at start of document.
pretty_print : bool, default True
    Whether output should be pretty printed with indentation and
    line breaks.
parser : {{'lxml','etree'}}, default 'lxml'
    Parser module to use for building of tree. Only 'lxml' and
    'etree' are supported. With 'lxml', the ability to use XSLT
    stylesheet is supported.
stylesheet : str, path object or file-like object, optional
    A URL, file-like object, or a raw string containing an XSLT
    script used to transform the raw XML output. Script should use
    layout of elements and attributes from original output. This
    argument requires ``lxml`` to be installed. Only XSLT 1.0
    scripts and not later versions is currently supported.
{compression_options}

    .. versionchanged:: 1.4.0 Zstandard support.

{storage_options}

Returns
-------
None or str
    If ``io`` is None, returns the resulting XML format as a
    string. Otherwise returns None.

See Also
--------
to_json : Convert the pandas object to a JSON string.
to_html : Convert DataFrame to a html.

Examples
--------
>>> df = pd.DataFrame({{'shape': ['square', 'circle', 'triangle'],
...                    'degrees': [360, 360, 180],
...                    'sides': [4, np.nan, 3]}})

>>> df.to_xml()  # doctest: +SKIP
<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <index>0</index>
    <shape>square</shape>
    <degrees>360</degrees>
    <sides>4.0</sides>
  </row>
  <row>
    <index>1</index>
    <shape>circle</shape>
    <degrees>360</degrees>
    <sides/>
  </row>
  <row>
    <index>2</index>
    <shape>triangle</shape>
    <degrees>180</degrees>
    <sides>3.0</sides>
  </row>
</data>

>>> df.to_xml(attr_cols=[
...           'index', 'shape', 'degrees', 'sides'
...           ])  # doctest: +SKIP
<?xml version='1.0' encoding='utf-8'?>
<data>
  <row index="0" shape="square" degrees="360" sides="4.0"/>
  <row index="1" shape="circle" degrees="360"/>
  <row index="2" shape="triangle" degrees="180" sides="3.0"/>
</data>

>>> df.to_xml(namespaces={{"doc": "https://example.com"}},
...           prefix="doc")  # doctest: +SKIP
<?xml version='1.0' encoding='utf-8'?>
<doc:data xmlns:doc="https://example.com">
  <doc:row>
    <doc:index>0</doc:index>
    <doc:shape>square</doc:shape>
    <doc:degrees>360</doc:degrees>
    <doc:sides>4.0</doc:sides>
  </doc:row>
  <doc:row>
    <doc:index>1</doc:index>
    <doc:shape>circle</doc:shape>
    <doc:degrees>360</doc:degrees>
    <doc:sides/>
  </doc:row>
  <doc:row>
    <doc:index>2</doc:index>
    <doc:shape>triangle</doc:shape>
    <doc:degrees>180</doc:degrees>
    <doc:sides>3.0</doc:sides>
  </doc:row>
</doc:data>
r   )EtreeXMLFormatterLxmlXMLFormatterz
lxml.etreeignore)errorslxmlz7lxml not found, please install or use the etree parser.etreez,Values for parser can only be lxml or etree.)r  r   r  r  r  r  r  r  r  r  r  r  r  r  r|  )pandas.io.formats.xmlr  r  r   ImportErrorr  write_output)r   r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r|  r  r  r  TreeBuilderxml_formatters                         r   r  r  m  s    H	

 *,xH V.!M  w+K KLL#
)!+%!#+!
& ))++r   c                <    [        U US9nUR                  UUUUS9  g )N)r  memory_usage)r\  r  verboseshow_counts)r   render)r   r  r\  r  r  r  rv  s          r   rv  DataFrame.info>  s3     %
 	#	 	 	
r   c                F   U R                  U R                  5        VVs/ s H  u  p4UR                  SUS9PM     snnU R                  [        R
                  S9nU(       a9  U R                  U R                  R                  US9S/S9nUR                  U5      nU$ s  snnf )a	  
Return the memory usage of each column in bytes.

The memory usage can optionally include the contribution of
the index and elements of `object` dtype.

This value is displayed in `DataFrame.info` by default. This can be
suppressed by setting ``pandas.options.display.memory_usage`` to False.

Parameters
----------
index : bool, default True
    Specifies whether to include the memory usage of the DataFrame's
    index in returned Series. If ``index=True``, the memory usage of
    the index is the first item in the output.
deep : bool, default False
    If True, introspect the data deeply by interrogating
    `object` dtypes for system-level memory consumption, and include
    it in the returned values.

Returns
-------
Series
    A Series whose index is the original column names and whose values
    is the memory usage of each column in bytes.

See Also
--------
numpy.ndarray.nbytes : Total bytes consumed by the elements of an
    ndarray.
Series.memory_usage : Bytes consumed by a Series.
Categorical : Memory-efficient array for string values with
    many repeated values.
DataFrame.info : Concise summary of a DataFrame.

Notes
-----
See the :ref:`Frequently Asked Questions <df-memory-usage>` for more
details.

Examples
--------
>>> dtypes = ['int64', 'float64', 'complex128', 'object', 'bool']
>>> data = dict([(t, np.ones(shape=5000, dtype=int).astype(t))
...              for t in dtypes])
>>> df = pd.DataFrame(data)
>>> df.head()
   int64  float64            complex128  object  bool
0      1      1.0              1.0+0.0j       1  True
1      1      1.0              1.0+0.0j       1  True
2      1      1.0              1.0+0.0j       1  True
3      1      1.0              1.0+0.0j       1  True
4      1      1.0              1.0+0.0j       1  True

>>> df.memory_usage()
Index           128
int64         40000
float64       40000
complex128    80000
object        40000
bool           5000
dtype: int64

>>> df.memory_usage(index=False)
int64         40000
float64       40000
complex128    80000
object        40000
bool           5000
dtype: int64

The memory footprint of `object` dtype columns is ignored by default:

>>> df.memory_usage(deep=True)
Index            128
int64          40000
float64        40000
complex128     80000
object        180000
bool            5000
dtype: int64

Use a Categorical for efficient storage of an object-dtype column with
many repeated values.

>>> df['object'].astype('category').memory_usage(deep=True)
5244
F)r   r   r   r   r   rf   r$  )r   r  r  r   r  intpr   _append)r   r   r   r_  rq  r  index_memory_usages          r   r  DataFrame.memory_usageR  s    r ))BF**,O,Q^^%d^3,O,,'' * 

 !%!9!9

''T'27) ": " (//7F Ps   B
r   c               L   [         R                  " U0 5        [        U R                  5      nU R                  (       a  U R
                  R                  nU(       a  [        5       (       d  UR                  5       nU R                  UU R                  U R                  SUR                  S9n[        5       (       a4  [        U 5      S:  a%  UR                  R                  U R                  5        GOU R                   (       Ga"  U(       Ga  [#        US   [$        5      (       Ga  [#        US   [&        5      (       a2  SSKJn  U" [-        [.        [0           U R3                  5       5      5      nO[#        US   [4        5      (       a0  SSKJnJn	  U	" [-        [.        U   U R3                  5       5      5      nO?US   n
U
R=                  5       nU R>                  nU Vs/ s H  oRA                  XS9PM     nn[C        U 5      RE                  UU R                  U R                  SS9nOmU R>                  R                  nU(       a  [        5       (       d  UR                  5       nU R                  UU R                  U R                  UR                  SS9nURG                  U S	S
9$ s  snf )aw
  
Transpose index and columns.

Reflect the DataFrame over its main diagonal by writing rows as columns
and vice-versa. The property :attr:`.T` is an accessor to the method
:meth:`transpose`.

Parameters
----------
*args : tuple, optional
    Accepted for compatibility with NumPy.
copy : bool, default False
    Whether to copy the data after transposing, even for DataFrames
    with a single dtype.

    Note that a copy is always required for mixed dtype DataFrames,
    or for DataFrames with any extension types.

    .. note::
        The `copy` keyword will change behavior in pandas 3.0.
        `Copy-on-Write
        <https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
        will be enabled by default, which means that all methods with a
        `copy` keyword will use a lazy copy mechanism to defer the copy and
        ignore the `copy` keyword. The `copy` keyword will be removed in a
        future version of pandas.

        You can already get the future behavior and improvements through
        enabling copy on write ``pd.options.mode.copy_on_write = True``

Returns
-------
DataFrame
    The transposed DataFrame.

See Also
--------
numpy.transpose : Permute the dimensions of a given array.

Notes
-----
Transposing a DataFrame with mixed dtypes will result in a homogeneous
DataFrame with the `object` dtype. In such a case, a copy of the data
is always made.

Examples
--------
**Square DataFrame with homogeneous dtype**

>>> d1 = {'col1': [1, 2], 'col2': [3, 4]}
>>> df1 = pd.DataFrame(data=d1)
>>> df1
   col1  col2
0     1     3
1     2     4

>>> df1_transposed = df1.T  # or df1.transpose()
>>> df1_transposed
      0  1
col1  1  2
col2  3  4

When the dtype is homogeneous in the original DataFrame, we get a
transposed DataFrame with the same dtype:

>>> df1.dtypes
col1    int64
col2    int64
dtype: object
>>> df1_transposed.dtypes
0    int64
1    int64
dtype: object

**Non-square DataFrame with mixed dtypes**

>>> d2 = {'name': ['Alice', 'Bob'],
...       'score': [9.5, 8],
...       'employed': [False, True],
...       'kids': [0, 0]}
>>> df2 = pd.DataFrame(data=d2)
>>> df2
    name  score  employed  kids
0  Alice    9.5     False     0
1    Bob    8.0      True     0

>>> df2_transposed = df2.T  # or df2.transpose()
>>> df2_transposed
              0     1
name      Alice   Bob
score       9.5   8.0
employed  False  True
kids          0     0

When the DataFrame has mixed dtypes, we get a transposed DataFrame with
the `object` dtype:

>>> df2.dtypes
name         object
score       float64
employed       bool
kids          int64
dtype: object
>>> df2_transposed.dtypes
0    object
1    object
dtype: object
Fr  r   )#transpose_homogeneous_masked_arrays)ArrowExtensionArraytranspose_homogeneous_pyarrowr  )r   r   ry  )r   r   r   r   r  method)$nvvalidate_transposer  r  rK  rR  rQ  r   r   r   r   r   r   r  r   r  rG  r   rM   rL   pandas.core.arrays.maskedr  r   r	   rY   _iter_column_arraysrK   pandas.core.arrays.arrow.arrayr  r  construct_array_typer   _from_sequencer   rz  r  )r   r   argsr  new_valsr  r  
new_valuesr  r  dtyparr_typr   r!  new_arrs                  r   r  DataFrame.transpose  s/   Z 	dB' dkk"##||~~H/11#==?&&ll

nn ' F #$$TQ**4995 %%%6!9n55 &)_55 A/2D4L4L4NO
 F1Iz22
 ;"568P8P8RS

 ay335QWXQW#44S4EQW
X$Z,,ll

!&	 - F kkmmG/11!,,.&&ll

mm ' F ""4"<<- Ys   J!c                "    U R                  5       $ )aG  
The transpose of the DataFrame.

Returns
-------
DataFrame
    The transposed DataFrame.

See Also
--------
DataFrame.transpose : Transpose index and columns.

Examples
--------
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df
   col1  col2
0     1     3
1     2     4

>>> df.T
      0  1
col1  1  2
col2  3  4
)r  r   s    r   rQ  DataFrame.To  s    6 ~~r   r   r   c                   US:X  a  U R                   R                  U5      n[        UR                  [        R
                  5      =(       a    UR                  R                  SL nU R                  X3R                  S9nU R                  U   Ul
        UR                  U 5      nUR                  XS9  U$ U R                  U   nU R                   R                  U5      nU R                  Xq5      nUR!                  X`5        U$ )zB
Parameters
----------
i : int
axis : int

Returns
-------
Series
r   Nr   r  )r   fast_xsr   r   r  r  baser   r   r   r   r  _set_is_copyr   iget_box_col_values_set_as_cached)r   r  r   new_mgrr   r  labelcol_mgrs           r   r  DataFrame._ixs  s     19ii''*G gmmRZZ8WW]]=O=OSW=WD66w\\6RF::a=FL((.F0M LLOEiinnQ'G))'5F !!%.Mr   c                8    U R                   R                  U5      $ )z
Get the values of the i'th column (ndarray or ExtensionArray, as stored
in the Block)

Warning! The returned array is a view but doesn't handle Copy-on-Write,
so this should be used with caution (for read-only purposes).
)r   iget_valuesr   r  s     r   _get_column_arrayDataFrame._get_column_array  s     yy$$Q''r   c              #     #    [        U R                  [        5      (       a  U R                  R                   Sh  vN   g[	        [        U R                  5      5       H  nU R                  U5      v   M     g N>7f)a  
Iterate over the arrays of all columns in order.
This returns the values as stored in the Block (ndarray or ExtensionArray).

Warning! The returned array is a view but doesn't handle Copy-on-Write,
so this should be used with caution (for read-only purposes).
N)r   r   ro   r  r  r  r   r  r  s     r   r  DataFrame._iter_column_arrays  sY      dii..yy''''3t||,-,,Q// . (s   9A<A:?A<c           	         U R                   R                  US5      S   nU R                   U   nU R                  R                  UUSSSSS9nU R	                  XDR
                  S9nUR                  U 5      nU$ )z\
Behaves like __getitem__, but returns a view in cases where __getitem__
would make a copy.
r   r   r   TF)r   
allow_dupsr   
only_slicer   )r   _get_indexer_strictr   reindex_indexerr   r   r  )r   keyindexernew_axisr  r  s         r   _getitem_nocopyDataFrame._getitem_nocopy  s     ,,223	B1E<<())++ , 
 ++G,,+G$$T*r   c                   [        U5        [        R                  " U5      n[        R                  " X5      n[        U5      (       a  [        U5      (       d  [        U R                  [        5      nU(       dW  U R                  R                  (       a  XR                  ;   d  XR                  R                  SS9;   a  U R                  U5      $ U(       a;  U R                  R                  (       a   XR                  ;   a  U R                  U5      $ [        U[        5      (       a  U R                  U5      $ [        U[         5      (       a  U R#                  U5      $ [        R$                  " U5      (       a  U R'                  U5      $ [        U[(        5      =(       d    [+        U5      (       + nU(       aZ  U R                  R,                  S:  a  U R                  U5      $ U R                  R/                  U5      n[1        U5      (       a  U/nO:[        U5      (       a  [3        U5      nU R                  R5                  US5      S   n[7        USS 5      [8        :X  a  [:        R"                  " U5      S   n[        U[        5      (       a  U R=                  USS9$ U R?                  USS9nU(       aC  UR@                  S   S:X  a0  [        U R                  [        5      (       d  UR                  U5      $ U$ )NFkeepr   r   r   r   r  )!rn   r   item_from_zerodimri  apply_if_callablerA   rD   r   r   rk   r  drop_duplicatesr  _getitem_multilevelslice_getitem_slicer   whereis_bool_indexer_getitem_bool_arraytuplerE   rg  rQ  rB   r  r  r   r#  r  _slice_take_with_is_copyrC  )r   r  is_miis_single_keyr  r  s         r   __getitem__DataFrame.__getitem__  sM   "3'##C(##C.sK$4$4 t||Z8E &&<<',,66E6BB++C004<<11c\\6I//44 c5!!&&s++ c9%%::c?" s##++C00 #3.Gl36G2G||##a'//44ll**3/G'""")33ill66sIFqIG 7GT*d2hhw'*Ggu%%;;wQ;//&&wQ&7
 zz!}!*T\\:*N*N++C00r   c                    [        U[        5      (       aM  UR                  R                  U R                  5      (       d#  [        R
                  " S[        [        5       S9  OP[        U5      [        U R                  5      :w  a.  [        S[        U5       S[        U R                  5       S35      e[        U R                  U5      nUR                  5       (       a  U R                  S S9$ UR                  5       S   nU R                  USS9$ )	Nz>Boolean Series key will be reindexed to match DataFrame index.r   Item wrong length  instead of r  r   r   r  )r   r}   r   equalsr   r   UserWarningr+   r  r  rm   allr   nonzeror0  )r   r  r  s      r   r-  DataFrame._getitem_bool_array"  s     c6""399+;+;DJJ+G+GMMP+-
 XTZZ($SXJl3tzz?:K1M  !S1779999$9''++-"&&wQ&77r   c                &   U R                   R                  U5      n[        U[        [        R
                  45      (       a  U R                   U   n[        X15      nU R                  S S 2U4   nXEl         [        UR                   5      S:X  ac  UR                   S   n[        U[        5      (       a  US   nUS:X  a4  US   n[        U[        5      (       a  U R                  XPR                  US9nUR                  U 5        U$ U R                  USS9$ )Nr   r    r  r  )r   rQ  r   r)  r  r  rl   r  r  r.  r}   r   r   r	  r  )r   r  locnew_columnsresult_columnsr  tops          r   r(  DataFrame._getitem_multilevel=  s    ll""3'cE2::.//,,s+K-k?NYYq#v&F+N 6>>"a' nnQ'c5))a&C"9#BZF!&&11!%!9!9"**3 ": " %M 99Sq9))r   c                n   U(       a  U R                  USS9nUR                  U   $ U R                  U5      nU R                  R                  n[        U R                  [        5      (       d*  U R                  R                  U5      nUR                  U   $ UR                  U5      nUR                  U   $ )aS  
Quickly retrieve single value at passed column and index.

Parameters
----------
index : row label
col : column label
takeable : interpret the index/col as indexers, default False

Returns
-------
scalar

Notes
-----
Assumes that both `self.index._index_as_unique` and
`self.columns._index_as_unique`; Caller is responsible for checking.
r   r  )r  rR  r  r   _enginer   rk   rQ  )r   r   r_  takeableseriesr  r!  r?  s           r   
_get_valueDataFrame._get_value_  s    & YYsY+F>>%((%%c*##$**j11 **$$U+C>>#&& nnU#~~c""r   c                   [        U[        5      (       a  [        U5      (       a  U/n[        U5      [        UR                  5      :w  a.  [        S[        U5       S[        UR                  5       S35      e[        U5       H:  u  p4U R                  UR                  SS2U4   5      u  pVU R                  XESUS9  M<     gU R                  U5      u  pVU R                  XSUS9  g)a  
Set the given value in the column with position `loc`.

This is a positional analogue to ``__setitem__``.

Parameters
----------
loc : int or sequence of ints
    Index position for the column.
value : scalar or arraylike
    Value(s) for the column.

Notes
-----
``frame.isetitem(loc, value)`` is an in-place method as it will
modify the DataFrame in place (not returning a new object). In contrast to
``frame.iloc[:, i] = value`` which will try to update the existing values in
place, ``frame.isetitem(loc, value)`` will not update the values of the column
itself in place, it will instead insert a new array.

In cases where ``frame.columns`` is unique, this is equivalent to
``frame[frame.columns[i]] = value``.
zGot z positions but value has z	 columns.NFr   refs)
r   r   rB   r  r   r  r  _sanitize_columnr  _iset_item_mgr)r   r?  rq  r  idx	arraylikerL  s          r   isetitemDataFrame.isetitem  s    0 eY''#e3x3u}}-- 3s8*$=c%-->P=Q R   
 $C."&"7"7

1a48H"I	##CE#M ) //6	CEEr   c                   [         (       dH  [        5       (       a9  [        R                  " U 5      S::  a  [        R
                  " [        [        SS9  O[         (       d  [        5       (       d  [        R                  " U 5      S::  ag  [        5       (       d:  [        5       (       dI  [        S U R                  R                   5       5      (       a  [        R
                  " [        [        SS9  [        R                  " X5      n[!        U["        5      (       a+  U R$                  R'                  USS9nU R)                  X25      $ [!        U[*        5      (       d  [-        USS 5      S:X  a  U R/                  X5        g [!        U[0        [2        R4                  [6        [8        45      (       a  U R;                  X5        g [!        U[*        5      (       a  U R=                  X5        g [?        U5      (       ak  U R@                  RB                  (       dP  S[E        U R@                  RG                  U/5      5      s=:  a  [E        U5      :X  a  O  OU R;                  U/U5        g U RI                  X5        g )	N   r   r   c              3  T   #    U  H  oR                   R                  5       v   M      g 7fr   )rL  has_reference)r^  bs     r   r`  (DataFrame.__setitem__.<locals>.<genexpr>  s      M<LqFF0022<Ls   &(getitem)kindr  r   )%r   r   sysgetrefcountr   r   r$   r!   r   rU  r   rJ  r&   r  ri  r&  r   r)  r   _convert_slice_indexer_setitem_slicer   r   _setitem_framer}   r  r  r  rf   _setitem_array_set_item_frame_valuerE   r   r  r  get_indexer_for	_set_item)r   r  rq  slcs       r   __setitem__DataFrame.__setitem__  s   t+--t$)+-CPQ 133t$)"$$*,,MDII<L<LMMM 3]q ##C. c5!!**33Ci3HC&&s22c9%%fd)Cq)H+fbjj$>??+y))&&s2LL**C44cU;<JE
J u- NN3&r   c                @    U R                  5         X R                  U'   g r   )_check_setitem_copyr  r   r  rq  s      r   r^  DataFrame._setitem_slice  s     	  "		#r   c                   [         R                  " U5      (       a  [        U5      [        U R                  5      :w  a.  [	        S[        U5       S[        U R                  5       S35      e[        U R                  U5      nUR                  5       S   nU R                  5         [        U[        5      (       a*  UR                  U R                  R                  U5      5      nX R                  U'   g [        U[        5      (       a;  [        U R                  X5        [        XR                  5       H  u  pEX%   X'   M     g [!        U5      (       d  U H  nX U'   M	     g [        U["        R$                  5      (       a"  UR&                  S:X  a  U R)                  X5        g ["        R&                  " U5      S:  a&  [        U5      R*                  nU R-                  X5      $ U R)                  X5        g )Nr6  r7  !r   r   r   )ri  r,  r  r   r  rm   r;  rh  r   r   r  taker  rd   r   r  rE   r  r  r  _iset_not_inplacer   r`  )r   r  rq  r  k1k2r_  s          r   r`  DataFrame._setitem_array  sz   s##3x3tzz?* (S
,s4::>OqQ  %TZZ5CkkmA&G$$&%++djjoog&>?!&IIg %++ s:!#}}5FB$yDH 6 "%((C %I  E2::..5::?&&s2!#!%(//**366 &&s2r   c                   SS jnU R                   R                  (       aP  [        R                  " U5      S   [	        U5      :w  a  [        S5      e[        U5       H  u  pEU" X$5      X'   M     g U R                   R                  U5      S   nUS:  R                  5       (       a  [        e[        R                  " U5      S   [	        U5      :w  a  [        S5      e[        R                  " U5      S::  d   eU R                   n [        [        [	        U R                   5      5      5      U l         [        U5       H  u  pHU" X$5      X'   M     Xpl         g ! Xpl         f = f)Nc                V    [        U [        R                  5      (       a  U SU4   $ X   $ )N.)r   r  r  )objr  s     r   igetitem-DataFrame._iset_not_inplace.<locals>.igetitem  s*     #rzz**36{"vr   rN  "Columns must be same length as keyr   r   )r  int)r   r  r  rC  r  r  r  get_indexer_non_uniquerU  NotImplementedErrorr  rf   r  )	r   r  rq  ru  r  r_  ilocsorig_columnsr  s	            r   rn  DataFrame._iset_not_inplace  s   	 <<!!xxr"c#h. !EFF#C.$U.	 ) LL77<Q?E	  ))xxr"c%j0 !EFF775>Q&&&<<L,$U3t||+<%=>(/GA!)%!3DJ  0  ,|s   A
E E c                   [        U[        R                  5      (       aJ  UR                  U R                  :w  a  [	        S5      eU R
                  " U40 U R                  5       DSS0D6nUR                  (       a,  [        S UR                   5       5      (       d  [        S5      eU R                  5         U R                  U* USS9  g )Nz,Array conditional must be same shape as selfr   Fc              3  8   #    U  H  n[        U5      v   M     g 7fr   )r<   )r^  r   s     r   r`  +DataFrame._setitem_frame.<locals>.<genexpr><  s     M*e 4 4*rb  z;Must pass DataFrame or 2-d ndarray with boolean values onlyTr   )r   r  r  rC  r  r   _construct_axes_dictsizer:  r  r  rh  _whereri  s      r   r_  DataFrame._setitem_frame4  s     c2::&&yyDJJ& !OPP##CS4+D+D+FSUSC88CM#**MMMM  	  "SD%.r   c                   U R                  U5        XR                  ;   Ga  U R                  R                  U5      nU R                  U   n[        U5      (       d  [	        U[
        5      (       a  SO
[        U5      nU[        UR                  5      :w  a  [        S5      e[	        U R                  [        5      (       a  [	        U[        [        [        R                  [        45      (       af  [        XA5      n[        U5      (       a0  UR                  UR                  5      (       d  UR!                  USS9n[#        XF5       H  u  pxX(   X'   M     g [        U5      (       a  X"R                  S      X'   g [	        U[        5      (       a7  [        R$                  " UR&                  UR(                  UR*                  5      n	O'[        U5      (       a  U/n	OUR-                  5       S   n	U R/                  X5      $ [        UR                  5      S:  a  [        SU 35      e[        UR                  5      S:X  a  [        SU 35      eX"R                  S      X'   g )Nr   rw  r  r   zBCannot set a DataFrame with multiple columns to the single column z5Cannot set a DataFrame without columns to the column )_ensure_valid_indexr   rQ  rF   r   r.  r  r  rk   r)  r}   r  r  rf   rl   r8  r  r  arangestartstopstepr;  rQ  )
r   r  rq  r?  colslen_colscols_droplevelr_  col_droplevellocss
             r   ra  DataFrame._set_item_frame_valueD  s     ' ,,,,&&s+C<<$D%dOOz$/F/FqCPTIH3u}}-- !EFF $,,
33
eVRZZ79 9 "2$!<~&&~/D/DU]]/S/S!MM.qMAE*-d*C&C % 4DI +D"==#34
 #u%%yyCHHchh?3u{{}Q'==--u}}!   1$GuM  --*+	r   c                X    U R                   R                  XX4S9  U R                  5         g )NrK  )r   iset_clear_item_cache)r   r?  rq  r   rL  s        r   rN  DataFrame._iset_item_mgrv  s$     			s7> r   c                    U R                   R                  U5      nU R                  XBUS9  [        U 5      (       a  U R                  5         g g ! [         a3    U R                  R                  [        U R                   5      XU5         N^f = f)NrL  )
_info_axisrQ  rN  rT  r   r  r  rh  )r   r  rq  rL  r?  s        r   _set_item_mgrDataFrame._set_item_mgr  s~    	7//))#.C
 6
 t99$$&   	EIIS13tD	Es   A :BBc                    [        5       (       a%  U R                  XR                  X2R                  S9  O(U R                  XR                  R	                  5       SS9  [        U 5      (       a  U R                  5         g g )NrK  Tr  )r   rN  rR  _referencesr   r  rh  )r   r?  rq  r   s       r   
_iset_itemDataFrame._iset_item  sm       ]]G:K:K    ]]%7%7%94H
 t99$$& r   c                   U R                  U5      u  p#XR                  ;   a  UR                  S:X  a  [        UR                  [
        5      (       d  U R                  R                  (       a  [        U R                  [        5      (       aQ  X   n[        U[        5      (       a8  [        R                  " U[        UR                  5      S45      R                  nSnU R                  XU5        g)a  
Add series to DataFrame in specified column.

If series is a numpy-array (not a Series/TimeSeries), it must be the
same length as the DataFrames index or an error will be thrown.

Series/TimeSeries will be conformed to the DataFrames index to
ensure homogeneity.
r   N)rM  r   r  r   r   rM   r  rk   r   r  tiler  rQ  r  )r   r  rq  rL  existing_pieces        r   rc  DataFrame._set_item  s     ++E2 <<

au{{N;; <<))Zj-Q-Q!%ni88GGEC0F0F,G+KLNNED3t,r   c                
    U(       a  Un[        [        U5      nO6U R                  R                  U5      nU R                  R                  U5      nU R
                  R                  XVUSS9  U R                  5         g! [        [        [        [        4 aE    U(       a  X0R                  X4'   OX0R                  X4'   U R                  R                  US5         g[          a  n[!        S[#        U5       35      UeSnAff = f)z
Put single value at passed column and index.

Parameters
----------
index : Label
    row label
col : Label
    column label
value : scalar
takeable : bool, default False
    Sets whether or not index/col interpreted as indexers
T)inplace_onlyNz)You can only assign a scalar value not a )r   rx  r   rQ  r   r   column_setitemr  rT  r  r  r0   r  r?  r  popr"   r   )r   r   r_  rq  rF  icoliindexii_errs           r   
_set_valueDataFrame._set_value  s     	c5)||++C0++E2II$$T5t$L""$)Z1BC 
	, (-		%*%',$  d+  	 $;DK=I	s   A;A> >AD	D%C==Dc                   [        U R                  5      (       d  [        U5      (       a  [        U5      (       a  [        U[        5      (       d   [        U5      nUR                  R                  5       nU R                  R                  b  U R                  R                  Ul
        U R                  R                  US[        R                  S9U l        gggg! [        [        [        4 a  n[        S5      UeSnAff = f)zV
Ensure that if we don't have an index, that we can create one from the
passed value.
zYCannot set a frame with no defined index and a value that cannot be converted to a SeriesNr   )r   
fill_value)r  r   rE   r   r   r}   r  rz  r  r   r   r   reindex_axisr  nan)r   rq  r  
index_copys       r   r  DataFrame._ensure_valid_index  s     4::<#6#63u::eY//"5ME ))+Jzz*"&**//
		..zbff.UDI <F#6 #$7C $K s   C D /C;;D c                    U R                   U   nU R                  XR                  S9nX4l        UR	                  U 5      $ )z$
Provide boxed values for a column.
r   )r   r   r   r   r  )r   r   r?  r   rt  s        r   r  DataFrame._box_col_values   s?     ||C //[[/I	%%r   c                8    U R                   R                  5         g r   )r  clearr   s    r   r  DataFrame._clear_item_cache  s     r   c                X   [        5       (       d  [        5       (       a+  U R                  R                  U5      nU R	                  USS9$ U R
                  nUR                  U5      nUc@  U R                  R                  U5      nU R	                  USS9nXCU'   U R                  Ul        U$ )z8Return the cached item, item represents a label indexer.r   r  )r   r   r   rQ  r  r  get_is_copy)r   itemr?  cacheress        r   r  DataFrame._get_item_cache  s      $6$8$8,,&&t,C99Sq9))  iio; ,,&&t,C))Ca)(C$K  ==CL
r   c                    g r   r{  r   s    r   _reset_cacherDataFrame._reset_cacher'  s    r   c                    U R                   R                  U5      nUR                  nU R                  USS9nUR                  UR                  L a  U(       a  gU R                  R                  XEUS9  g)z?
The object has called back to us saying maybe it has changed.
r   r  Nr  )r  rQ  rR  r  r   r  )r   r  rq  r   r?  rP  olds          r   _maybe_cache_changedDataFrame._maybe_cache_changed+  s\     oo%%d+MM	ii!i$;;%--'G		sw7r   r  c                   g r   r{  r   exprr   r  s       r   queryDataFrame.query<  r  r   c                   g r   r{  r  s       r   r  r  @  r  r   c                   g r   r{  r  s       r   r  r  D  r  r   c               V   [        US5      n[        U[        5      (       d  S[        U5       S3n[	        U5      eUR                  SS5      S-   US'   SUS'   U R                  " U40 UD6n U R                  U   nU(       a  U R                  U5        gU$ ! [         a    X   n N+f = f)	a_  
Query the columns of a DataFrame with a boolean expression.

Parameters
----------
expr : str
    The query string to evaluate.

    You can refer to variables
    in the environment by prefixing them with an '@' character like
    ``@a + b``.

    You can refer to column names that are not valid Python variable names
    by surrounding them in backticks. Thus, column names containing spaces
    or punctuations (besides underscores) or starting with digits must be
    surrounded by backticks. (For example, a column named "Area (cm^2)" would
    be referenced as ```Area (cm^2)```). Column names which are Python keywords
    (like "list", "for", "import", etc) cannot be used.

    For example, if one of your columns is called ``a a`` and you want
    to sum it with ``b``, your query should be ```a a` + b``.

inplace : bool
    Whether to modify the DataFrame rather than creating a new one.
**kwargs
    See the documentation for :func:`eval` for complete details
    on the keyword arguments accepted by :meth:`DataFrame.query`.

Returns
-------
DataFrame or None
    DataFrame resulting from the provided query expression or
    None if ``inplace=True``.

See Also
--------
eval : Evaluate a string describing operations on
    DataFrame columns.
DataFrame.eval : Evaluate a string describing operations on
    DataFrame columns.

Notes
-----
The result of the evaluation of this expression is first passed to
:attr:`DataFrame.loc` and if that fails because of a
multidimensional key (e.g., a DataFrame) then the result will be passed
to :meth:`DataFrame.__getitem__`.

This method uses the top-level :func:`eval` function to
evaluate the passed query.

The :meth:`~pandas.DataFrame.query` method uses a slightly
modified Python syntax by default. For example, the ``&`` and ``|``
(bitwise) operators have the precedence of their boolean cousins,
:keyword:`and` and :keyword:`or`. This *is* syntactically valid Python,
however the semantics are different.

You can change the semantics of the expression by passing the keyword
argument ``parser='python'``. This enforces the same semantics as
evaluation in Python space. Likewise, you can pass ``engine='python'``
to evaluate an expression using Python itself as a backend. This is not
recommended as it is inefficient compared to using ``numexpr`` as the
engine.

The :attr:`DataFrame.index` and
:attr:`DataFrame.columns` attributes of the
:class:`~pandas.DataFrame` instance are placed in the query namespace
by default, which allows you to treat both the index and columns of the
frame as a column in the frame.
The identifier ``index`` is used for the frame index; you can also
use the name of the index to identify it in a query. Please note that
Python keywords may not be used as identifiers.

For further details and examples see the ``query`` documentation in
:ref:`indexing <indexing.query>`.

*Backtick quoted variables*

Backtick quoted variables are parsed as literal Python code and
are converted internally to a Python valid identifier.
This can lead to the following problems.

During parsing a number of disallowed characters inside the backtick
quoted string are replaced by strings that are allowed as a Python identifier.
These characters include all operators in Python, the space character, the
question mark, the exclamation mark, the dollar sign, and the euro sign.
For other characters that fall outside the ASCII range (U+0001..U+007F)
and those that are not further specified in PEP 3131,
the query parser will raise an error.
This excludes whitespace different than the space character,
but also the hashtag (as it is used for comments) and the backtick
itself (backtick can also not be escaped).

In a special case, quotes that make a pair around a backtick can
confuse the parser.
For example, ```it's` > `that's``` will raise an error,
as it forms a quoted string (``'s > `that'``) with a backtick inside.

See also the Python documentation about lexical analysis
(https://docs.python.org/3/reference/lexical_analysis.html)
in combination with the source code in :mod:`pandas.core.computation.parsing`.

Examples
--------
>>> df = pd.DataFrame({'A': range(1, 6),
...                    'B': range(10, 0, -2),
...                    'C C': range(10, 5, -1)})
>>> df
   A   B  C C
0  1  10   10
1  2   8    9
2  3   6    8
3  4   4    7
4  5   2    6
>>> df.query('A > B')
   A  B  C C
4  5  2    6

The previous expression is equivalent to

>>> df[df.A > df.B]
   A  B  C C
4  5  2    6

For columns with spaces in their name, you can use backtick quoting.

>>> df.query('B == `C C`')
   A   B  C C
0  1  10   10

The previous expression is equivalent to

>>> df[df.B == df['C C']]
   A   B  C C
0  1  10   10
r   z'expr must be a string to be evaluated, z givenlevelr   r   Ntarget)	r.   r   r  r   r  r  evalr?  _update_inplace)r   r  r   r  r  r  r  s          r   r  r  H  s    R &gy9$$$;DJ<vNCS/! **Wa014wxii''	XXc]F   (M  	 YF	s   -B B('B(c                   g r   r{  r  s       r   r  DataFrame.eval  r  r   c                   g r   r{  r  s       r   r  r    r  r   c                  SSK Jn  [        US5      nUR                  SS5      S-   US'   U R	                  5       nU R                  5       nXe4nSU;  a  XS'   [        UR                  SS5      5      U-   US'   U" U4SU0UD6$ )	a  
Evaluate a string describing operations on DataFrame columns.

Operates on columns only, not specific rows or elements.  This allows
`eval` to run arbitrary code, which can make you vulnerable to code
injection if you pass user input to this function.

Parameters
----------
expr : str
    The expression string to evaluate.
inplace : bool, default False
    If the expression contains an assignment, whether to perform the
    operation inplace and mutate the existing DataFrame. Otherwise,
    a new DataFrame is returned.
**kwargs
    See the documentation for :func:`eval` for complete details
    on the keyword arguments accepted by
    :meth:`~pandas.DataFrame.query`.

Returns
-------
ndarray, scalar, pandas object, or None
    The result of the evaluation or None if ``inplace=True``.

See Also
--------
DataFrame.query : Evaluates a boolean expression to query the columns
    of a frame.
DataFrame.assign : Can evaluate an expression or function to create new
    values for a column.
eval : Evaluate a Python expression as a string using various
    backends.

Notes
-----
For more details see the API documentation for :func:`~eval`.
For detailed examples see :ref:`enhancing performance with eval
<enhancingperf.eval>`.

Examples
--------
>>> df = pd.DataFrame({'A': range(1, 6), 'B': range(10, 0, -2)})
>>> df
   A   B
0  1  10
1  2   8
2  3   6
3  4   4
4  5   2
>>> df.eval('A + B')
0    11
1    10
2     9
3     8
4     7
dtype: int64

Assignment is allowed though by default the original DataFrame is not
modified.

>>> df.eval('C = A + B')
   A   B   C
0  1  10  11
1  2   8  10
2  3   6   9
3  4   4   8
4  5   2   7
>>> df
   A   B
0  1  10
1  2   8
2  3   6
3  4   4
4  5   2

Multiple columns can be assigned to using multi-line expressions:

>>> df.eval(
...     '''
... C = A + B
... D = A - B
... '''
... )
   A   B   C  D
0  1  10  11 -9
1  2   8  10 -6
2  3   6   9 -3
3  4   4   8  0
4  5   2   7  3
r   )r  r   r  r   r  	resolversr{  )pandas.core.computation.evalr  r.   r  _get_index_resolvers_get_cleaned_column_resolversr.  r  )r   r  r   r  _evalindex_resolverscolumn_resolversr  s           r   r  r    s    x 	?%gy9 **Wa014w335==?$5	6!#8#FJJ{B$?@9L{T575f55r   c                (  ^^^ [        T5      (       d  Tb  T4OSm[        T5      (       d  Tb  T4OSm[        T5      [        T5      4n[        U5      (       d  [        S5      eS nU" T5      mU" T5      mTT4 H  n[	        U5        M     TR                  T5      (       d  [        STT-   35      eS
S jmSUUU4S jjnU R                  R                  U5      R                  SS9nU R                  XwR                  S	9R                  U 5      $ )au  
Return a subset of the DataFrame's columns based on the column dtypes.

Parameters
----------
include, exclude : scalar or list-like
    A selection of dtypes or strings to be included/excluded. At least
    one of these parameters must be supplied.

Returns
-------
DataFrame
    The subset of the frame including the dtypes in ``include`` and
    excluding the dtypes in ``exclude``.

Raises
------
ValueError
    * If both of ``include`` and ``exclude`` are empty
    * If ``include`` and ``exclude`` have overlapping elements
    * If any kind of string dtype is passed in.

See Also
--------
DataFrame.dtypes: Return Series with the data type of each column.

Notes
-----
* To select all *numeric* types, use ``np.number`` or ``'number'``
* To select strings you must use the ``object`` dtype, but note that
  this will return *all* object dtype columns
* See the `numpy dtype hierarchy
  <https://numpy.org/doc/stable/reference/arrays.scalars.html>`__
* To select datetimes, use ``np.datetime64``, ``'datetime'`` or
  ``'datetime64'``
* To select timedeltas, use ``np.timedelta64``, ``'timedelta'`` or
  ``'timedelta64'``
* To select Pandas categorical dtypes, use ``'category'``
* To select Pandas datetimetz dtypes, use ``'datetimetz'``
  or ``'datetime64[ns, tz]'``

Examples
--------
>>> df = pd.DataFrame({'a': [1, 2] * 3,
...                    'b': [True, False] * 3,
...                    'c': [1.0, 2.0] * 3})
>>> df
        a      b  c
0       1   True  1.0
1       2  False  2.0
2       1   True  1.0
3       2  False  2.0
4       1   True  1.0
5       2  False  2.0

>>> df.select_dtypes(include='bool')
   b
0  True
1  False
2  True
3  False
4  True
5  False

>>> df.select_dtypes(include=['float64'])
   c
0  1.0
1  2.0
2  1.0
3  2.0
4  1.0
5  2.0

>>> df.select_dtypes(exclude=['int64'])
       b    c
0   True  1.0
1  False  2.0
2   True  1.0
3  False  2.0
4   True  1.0
5  False  2.0
Nr{  z3at least one of include or exclude must be nonemptyc                   / nU  H  n[        U[        5      (       a  US:X  d	  U[        L a@  UR                  [        R
                  5        UR                  [        R                  5        Mg  US:X  d	  U[        L a1  UR                  [        R                  [        R                  /5        M  UR                  [        U5      5        M     [        U5      $ )Nrx  float)r   r  rx  r  r  int32int64r  r  float64float32r9   	frozenset)r  converted_dtypesr   s      r   check_int_infer_dtype6DataFrame.select_dtypes.<locals>.check_int_infer_dtype  s    +- uc**u~5C<$++BHH5$++BHH5g%%$++RZZ,DE$++,CE,JK   -..r   zinclude and exclude overlap on c                   [        U [        5      (       d  U OU R                  n [        U R                  [        U5      5      =(       d>    [        R                  U;   =(       a$    [        U SS5      =(       a    [        U 5      (       + $ )N_is_numericF)
r   rK   numpy_dtype
issubclassr   r.  r  numberr   r<   )r   
dtypes_sets     r   dtype_predicate0DataFrame.select_dtypes.<locals>.dtype_predicate  se    !+E:!>!>EEDUDUEejj%
*;< 		Z' -E=%8-%e,,r   c                v   > U R                   nT(       a  T" UT5      (       d  gT(       a  T" UT5      (       a  gg)NFTr  )rF  r   r  rV  includes     r   	predicate*DataFrame.select_dtypes.<locals>.predicate  s5    IIE&ug66 "5'22 r   r   r   )r   r   rI  r#  )rF  r   rI  r#  )rE   r  rU  r  r6   
isdisjointr   _get_data_subsetr   r   r   r  )	r   r  rV  	selectionr  r  r  r   r  s	    ``     @r   select_dtypesDataFrame.select_dtypesW  s   f G$$$+$7wjRGG$$$+$7wjRGw'7);<	9~~RSS	/ (0'0(F$V, ) !!'**>'@Q>STUU	
	 
	 ii((388d8C))#HH)=JJ4PPr   c                h   U[         R                  L a  SnU(       a&  U R                  R                  (       d  [	        S5      eU(       d  X R
                  ;   a  [	        SU S35      e[        U5      (       d  [        S5      e[        U5      n[        U[        5      (       a;  [        UR
                  5      S:  a"  [	        S[        UR
                  5       S35      e[        U[        5      (       a  UR                  S	S	2S
4   nU R                  U5      u  p5U R                  R                  XX5S9  g	)a  
Insert column into DataFrame at specified location.

Raises a ValueError if `column` is already contained in the DataFrame,
unless `allow_duplicates` is set to True.

Parameters
----------
loc : int
    Insertion index. Must verify 0 <= loc <= len(columns).
column : str, number, or hashable object
    Label of the inserted column.
value : Scalar, Series, or array-like
    Content of the inserted column.
allow_duplicates : bool, optional, default lib.no_default
    Allow duplicate column labels to be created.

See Also
--------
Index.insert : Insert new item by index.

Examples
--------
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df
   col1  col2
0     1     3
1     2     4
>>> df.insert(1, "newcol", [99, 99])
>>> df
   col1  newcol  col2
0     1      99     3
1     2      99     4
>>> df.insert(0, "col1", [100, 100], allow_duplicates=True)
>>> df
   col1  col1  newcol  col2
0   100     1      99     3
1   100     2      99     4

Notice that pandas uses index alignment in case of `value` from type `Series`:

>>> df.insert(0, "col0", pd.Series([5, 6], index=[1, 2]))
>>> df
   col0  col1  col1  newcol  col2
0   NaN   100     1      99     3
1   5.0   100     2      99     4
FzZCannot specify 'allow_duplicates=True' when 'self.flags.allows_duplicate_labels' is False.zcannot insert z, already existszloc must be intr   z8Expected a one-dimensional object, got a DataFrame with z columns instead.Nr   r  )r   
no_defaultflagsallows_duplicate_labelsr  r   rB   r  rx  r   r   r  r  rM  r   r  )r   r?  rd  rq  allow_duplicatesrL  s         r   r  DataFrame.insert  s   l s~~-$DJJ$F$FA   Fll$:~fX5EFGG#-..#heY''C,>,BJu}}%&&79  y))JJq!t$E++E2		e7r   c                    U R                  SS9nUR                  5        H  u  p4[        R                  " XB5      X#'   M     U$ )a*  
Assign new columns to a DataFrame.

Returns a new object with all original columns in addition to new ones.
Existing columns that are re-assigned will be overwritten.

Parameters
----------
**kwargs : dict of {str: callable or Series}
    The column names are keywords. If the values are
    callable, they are computed on the DataFrame and
    assigned to the new columns. The callable must not
    change input DataFrame (though pandas doesn't check it).
    If the values are not callable, (e.g. a Series, scalar, or array),
    they are simply assigned.

Returns
-------
DataFrame
    A new DataFrame with the new columns in addition to
    all the existing columns.

Notes
-----
Assigning multiple columns within the same ``assign`` is possible.
Later items in '\*\*kwargs' may refer to newly created or modified
columns in 'df'; items are computed and assigned into 'df' in order.

Examples
--------
>>> df = pd.DataFrame({'temp_c': [17.0, 25.0]},
...                   index=['Portland', 'Berkeley'])
>>> df
          temp_c
Portland    17.0
Berkeley    25.0

Where the value is a callable, evaluated on `df`:

>>> df.assign(temp_f=lambda x: x.temp_c * 9 / 5 + 32)
          temp_c  temp_f
Portland    17.0    62.6
Berkeley    25.0    77.0

Alternatively, the same behavior can be achieved by directly
referencing an existing Series or sequence:

>>> df.assign(temp_f=df['temp_c'] * 9 / 5 + 32)
          temp_c  temp_f
Portland    17.0    62.6
Berkeley    25.0    77.0

You can create multiple columns within the same assign where one
of the columns depends on another one defined within the same assign:

>>> df.assign(temp_f=lambda x: x['temp_c'] * 9 / 5 + 32,
...           temp_k=lambda x: (x['temp_f'] + 459.67) * 5 / 9)
          temp_c  temp_f  temp_k
Portland    17.0    62.6  290.15
Berkeley    25.0    77.0  298.15
Nr   )r   r  ri  r&  )r   r  r  r  r  s        r   assignDataFrame.assign6  s>    | yydy#LLNDA++A4DG #r   c                0   U R                  U5        [        U[        5      (       a   e[        U5      (       a5  [        U[        5      (       d  [	        U5      n[        XR                  5      $ [        U5      (       a   [        R                  " XR                  5        [        XR                  SSS9n[        U[        5      (       aL  UR                  S:X  a<  UR                  UR                  :w  a"  [        R                  " S[        [!        5       S9  US4$ )a;  
Ensures new columns (which go into the BlockManager as new blocks) are
always copied (or a reference is being tracked to them under CoW)
and converted into an array.

Parameters
----------
value : scalar, Series, or array-like

Returns
-------
tuple of numpy.ndarray or ExtensionArray and optional BlockValuesRefs
T)r   allow_2dr  zSetting an Index with object dtype into a DataFrame will stop inferring another dtype in a future version. Cast the Index explicitly before setting it into the DataFrame.r   N)r  r   r   r>   r}   _reindex_for_setitemr   rE   ri  require_length_matchr`   rf   r   r   r   r  r+   )r   rq  rF  s      r   rM  DataFrame._sanitize_columnz  s     	  ' eY////eV,,u'zz::$$UJJ7UJJTDIue$$x'		U[[( MMC +- Dyr   c           
     ~    [        U R                  5       VVs0 s H  u  pX R                  USS9_M     snn$ s  snnf )Nr   r  )r  r   r  )r   rO  r  s      r   _seriesDataFrame._series  s7    >G>UV>Uii!i,,>UVVVs   9c                
   U R                   R                  US   5      u  pEU R                  R                  US   5      u  pgUb+  Ub(  XW4n[        U R                  XS9n	U R                  XUSS9$ U R                  XE/Xg/S.UUS9$ )z*
We are guaranteed non-Nones in the axes.
r   r   )r  Fr   r   r   )r   r   )r   r  )r   r  r   rW   r   r   _reindex_with_indexers)
r   r   r   r  	new_indexrow_indexerr@  col_indexerr  r  s
             r   _reindex_multiDataFrame._reindex_multi  s     "&!3!3DM!B	#'<<#7#7Y#H "{'> ".G&t{{GSJ$$[u %   ..,+1KL% /  r   a  
        Examples
        --------
        >>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})

        Change the row labels.

        >>> df.set_axis(['a', 'b', 'c'], axis='index')
           A  B
        a  1  4
        b  2  5
        c  3  6

        Change the column labels.

        >>> df.set_axis(['I', 'II'], axis='columns')
           I  II
        0  1   4
        1  2   5
        2  3   6
        r   z
 column orz, and 1 identifies the columnsz or columns)r   r   extended_summary_subaxis_description_subsee_also_subr   r   c                   > [         TU ]  XUS9$ )Nr  )superset_axis)r   labelsr   r   	__class__s       r   r  DataFrame.set_axis  s    L w==r   r   )r   r   )	r   r   r   r  r   r  r  limit	tolerancec       	        0   > [         TU ]  UUUUUUUUU	U
S9
$ )N)
r  r   r   r   r  r   r  r  r  r  )r  r  )r   r  r   r   r   r  r   r  r  r  r  r  s              r   r  DataFrame.reindex  s9    & w!  
 	
r   )r   r   r   r  r  c                   g r   r{  r   r  r   r   r   r  r   r  s           r   rK  DataFrame.drop       	r   )r   r   r   r  r   r  c                   g r   r{  r   s           r   rK  r!    r"  r   c                   g r   r{  r   s           r   rK  r!  +  r"  r   raisec          
     *   > [         TU ]  UUUUUUUS9$ )a  
Drop specified labels from rows or columns.

Remove rows or columns by specifying label names and corresponding
axis, or by directly specifying index or column names. When using a
multi-index, labels on different levels can be removed by specifying
the level. See the :ref:`user guide <advanced.shown_levels>`
for more information about the now unused levels.

Parameters
----------
labels : single label or list-like
    Index or column labels to drop. A tuple will be used as a single
    label and not treated as a list-like.
axis : {0 or 'index', 1 or 'columns'}, default 0
    Whether to drop labels from the index (0 or 'index') or
    columns (1 or 'columns').
index : single label or list-like
    Alternative to specifying axis (``labels, axis=0``
    is equivalent to ``index=labels``).
columns : single label or list-like
    Alternative to specifying axis (``labels, axis=1``
    is equivalent to ``columns=labels``).
level : int or level name, optional
    For MultiIndex, level from which the labels will be removed.
inplace : bool, default False
    If False, return a copy. Otherwise, do operation
    in place and return None.
errors : {'ignore', 'raise'}, default 'raise'
    If 'ignore', suppress error and only existing labels are
    dropped.

Returns
-------
DataFrame or None
    Returns DataFrame or None DataFrame with the specified
    index or column labels removed or None if inplace=True.

Raises
------
KeyError
    If any of the labels is not found in the selected axis.

See Also
--------
DataFrame.loc : Label-location based indexer for selection by label.
DataFrame.dropna : Return DataFrame with labels on given axis omitted
    where (all or any) data are missing.
DataFrame.drop_duplicates : Return DataFrame with duplicate rows
    removed, optionally only considering certain columns.
Series.drop : Return Series with specified index labels removed.

Examples
--------
>>> df = pd.DataFrame(np.arange(12).reshape(3, 4),
...                   columns=['A', 'B', 'C', 'D'])
>>> df
   A  B   C   D
0  0  1   2   3
1  4  5   6   7
2  8  9  10  11

Drop columns

>>> df.drop(['B', 'C'], axis=1)
   A   D
0  0   3
1  4   7
2  8  11

>>> df.drop(columns=['B', 'C'])
   A   D
0  0   3
1  4   7
2  8  11

Drop a row by index

>>> df.drop([0, 1])
   A  B   C   D
2  8  9  10  11

Drop columns and/or rows of MultiIndex DataFrame

>>> midx = pd.MultiIndex(levels=[['llama', 'cow', 'falcon'],
...                              ['speed', 'weight', 'length']],
...                      codes=[[0, 0, 0, 1, 1, 1, 2, 2, 2],
...                             [0, 1, 2, 0, 1, 2, 0, 1, 2]])
>>> df = pd.DataFrame(index=midx, columns=['big', 'small'],
...                   data=[[45, 30], [200, 100], [1.5, 1], [30, 20],
...                         [250, 150], [1.5, 0.8], [320, 250],
...                         [1, 0.8], [0.3, 0.2]])
>>> df
                big     small
llama   speed   45.0    30.0
        weight  200.0   100.0
        length  1.5     1.0
cow     speed   30.0    20.0
        weight  250.0   150.0
        length  1.5     0.8
falcon  speed   320.0   250.0
        weight  1.0     0.8
        length  0.3     0.2

Drop a specific index combination from the MultiIndex
DataFrame, i.e., drop the combination ``'falcon'`` and
``'weight'``, which deletes only the corresponding row

>>> df.drop(index=('falcon', 'weight'))
                big     small
llama   speed   45.0    30.0
        weight  200.0   100.0
        length  1.5     1.0
cow     speed   30.0    20.0
        weight  250.0   150.0
        length  1.5     0.8
falcon  speed   320.0   250.0
        length  0.3     0.2

>>> df.drop(index='cow', columns='small')
                big
llama   speed   45.0
        weight  200.0
        length  1.5
falcon  speed   320.0
        weight  1.0
        length  0.3

>>> df.drop(index='length', level=1)
                big     small
llama   speed   45.0    30.0
        weight  200.0   100.0
cow     speed   30.0    20.0
        weight  250.0   150.0
falcon  speed   320.0   250.0
        weight  1.0     0.8
)r  r   r   r   r  r   r  )r  rK  )	r   r  r   r   r   r  r   r  r  s	           r   rK  r!  9  s1    h w|  
 	
r   )r   r   r   r   r  r  c                   g r   r{  	r   mapperr   r   r   r   r   r  r  s	            r   r  DataFrame.rename       	r   )r   r   r   r   r   r  r  c                   g r   r{  r(  s	            r   r  r*    r+  r   c                   g r   r{  r(  s	            r   r  r*    r+  r   r  c               ,   > [         T	U ]  UUUUUUUUS9$ )aE  
Rename columns or index labels.

Function / dict values must be unique (1-to-1). Labels not contained in
a dict / Series will be left as-is. Extra labels listed don't throw an
error.

See the :ref:`user guide <basics.rename>` for more.

Parameters
----------
mapper : dict-like or function
    Dict-like or function transformations to apply to
    that axis' values. Use either ``mapper`` and ``axis`` to
    specify the axis to target with ``mapper``, or ``index`` and
    ``columns``.
index : dict-like or function
    Alternative to specifying axis (``mapper, axis=0``
    is equivalent to ``index=mapper``).
columns : dict-like or function
    Alternative to specifying axis (``mapper, axis=1``
    is equivalent to ``columns=mapper``).
axis : {0 or 'index', 1 or 'columns'}, default 0
    Axis to target with ``mapper``. Can be either the axis name
    ('index', 'columns') or number (0, 1). The default is 'index'.
copy : bool, default True
    Also copy underlying data.

    .. note::
        The `copy` keyword will change behavior in pandas 3.0.
        `Copy-on-Write
        <https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
        will be enabled by default, which means that all methods with a
        `copy` keyword will use a lazy copy mechanism to defer the copy and
        ignore the `copy` keyword. The `copy` keyword will be removed in a
        future version of pandas.

        You can already get the future behavior and improvements through
        enabling copy on write ``pd.options.mode.copy_on_write = True``
inplace : bool, default False
    Whether to modify the DataFrame rather than creating a new one.
    If True then value of copy is ignored.
level : int or level name, default None
    In case of a MultiIndex, only rename labels in the specified
    level.
errors : {'ignore', 'raise'}, default 'ignore'
    If 'raise', raise a `KeyError` when a dict-like `mapper`, `index`,
    or `columns` contains labels that are not present in the Index
    being transformed.
    If 'ignore', existing keys will be renamed and extra keys will be
    ignored.

Returns
-------
DataFrame or None
    DataFrame with the renamed axis labels or None if ``inplace=True``.

Raises
------
KeyError
    If any of the labels is not found in the selected axis and
    "errors='raise'".

See Also
--------
DataFrame.rename_axis : Set the name of the axis.

Examples
--------
``DataFrame.rename`` supports two calling conventions

* ``(index=index_mapper, columns=columns_mapper, ...)``
* ``(mapper, axis={'index', 'columns'}, ...)``

We *highly* recommend using keyword arguments to clarify your
intent.

Rename columns using a mapping:

>>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
>>> df.rename(columns={"A": "a", "B": "c"})
   a  c
0  1  4
1  2  5
2  3  6

Rename index using a mapping:

>>> df.rename(index={0: "x", 1: "y", 2: "z"})
   A  B
x  1  4
y  2  5
z  3  6

Cast index labels to a different type:

>>> df.index
RangeIndex(start=0, stop=3, step=1)
>>> df.rename(index=str).index
Index(['0', '1', '2'], dtype='object')

>>> df.rename(columns={"A": "a", "B": "b", "C": "c"}, errors="raise")
Traceback (most recent call last):
KeyError: ['C'] not found in axis

Using axis-style parameters:

>>> df.rename(str.lower, axis='columns')
   a  b
0  1  4
1  2  5
2  3  6

>>> df.rename({1: 2, 2: 4}, axis='index')
   A  B
0  1  4
2  2  5
4  3  6
)r)  r   r   r   r   r   r  r  )r  _rename)
r   r)  r   r   r   r   r   r  r  r  s
            r   r  r*    s4    F w  	
 		
r   c                   > [         TU ]  US9$ )a!  
Return item and drop from frame. Raise KeyError if not found.

Parameters
----------
item : label
    Label of column to be popped.

Returns
-------
Series

Examples
--------
>>> df = pd.DataFrame([('falcon', 'bird', 389.0),
...                    ('parrot', 'bird', 24.0),
...                    ('lion', 'mammal', 80.5),
...                    ('monkey', 'mammal', np.nan)],
...                   columns=('name', 'class', 'max_speed'))
>>> df
     name   class  max_speed
0  falcon    bird      389.0
1  parrot    bird       24.0
2    lion  mammal       80.5
3  monkey  mammal        NaN

>>> df.pop('class')
0      bird
1      bird
2    mammal
3    mammal
Name: class, dtype: object

>>> df
     name  max_speed
0  falcon      389.0
1  parrot       24.0
2    lion       80.5
3  monkey        NaN
)r  )r  r  )r   r  r  s     r   r  DataFrame.pop  s    R w{{%%r   c                $   U(       a  U OU R                  SS9nU R                  n[        U5       HE  u  pgXq;   d  M  U R                  SS2U4   nX   u  pUR	                  XUS9nUR                  XkUS9  MG     U(       a  gUR                  U 5      $ )z
Dispatch to Series.replace column-wise.

Parameters
----------
mapping : dict
    of the form {col: (target, value)}
inplace : bool
regex : bool or same types as `to_replace` in DataFrame.replace

Returns
-------
DataFrame or None
Nr   )regexr  )r   r   r  r  r  r  r  )r   mappingr   r3  r  axr  ax_valuer   r  rq  newobjs               r   _replace_columnwiseDataFrame._replace_columnwise  s    $ d499$9#7\\$R=KA"ii1o ' 1V%@q': ) %%r   )r   r   c           
       > UbE  U[         R                  La2  [        R                  " S[        [        5       S9  [         R                  nU R                  (       a  U R                  5       $ U R                  U5      n[        U5      (       a  [        [        U5      nUS:X  a  [        S5      e[        U5      S:X  a  [        S5      eSSKJn  / nU H{  n[!        U5      (       d  [#        SU S	[%        U5       S
35      e[        [&        U5      nUR)                  [*        TU ]Y  XX4S9R/                  U(       a  U SU 3OSU 35      5        M}     U" USS9$ U(       a  [        S5      e[        [&        U5      n[        U R0                  5      n	U R2                  R4                  n
US:X  Ga  US:w  Ga  U	S:  Ga~  UGcz  U[         R                  L Ga8  U R0                  S   nUS:  ax  U R6                  S S 2S U* 24   n[9        [;        U	[=        U5      5      5       H?  nU R6                  S S 2S4   R-                  [        U 5      5      nUR?                  SXSS9  MA     OU R6                  S S 2U* S 24   n[9        [;        U	[=        U5      5      5       HR  nU R6                  S S 2S4   R-                  [        U 5      5      nUR?                  [        UR0                  5      XSS9  MT     U R0                  R                  5       Ul        U$ [        U
5      S:  d  [A        U
S   U5      (       d  [=        U5      n[;        X5      nUS:  a?  [B        RD                  " S/U-  [G        [9        X-
  5      5      -   [B        RH                  S9nO<[B        RD                  " [G        [9        X5      5      S/U-  -   [B        RH                  S9nU R2                  RK                  U R0                  USUSS9nU RM                  UURN                  S9nURQ                  U SS9$ U RR                  R-                  XS9RR                  $ [*        TU ]Y  XX4S9$ )NzPassing a 'freq' together with a 'fill_value' silently ignores the fill_value and is deprecated. This will raise in a future version.r   r   z:If `periods` contains multiple shifts, `axis` cannot be 1.r   z0If `periods` is an iterable, it cannot be empty.concatzPeriods must be integer, but z is r  )periodsfreqr   r  r  r  z/Cannot specify `suffix` if `periods` is an int.Tr  rN  r  )r   r  r  r   shiftr  )r=  r  )*r   r  r   r   r  r+   emptyr   _get_axis_numberrE   r   r	   r  r  pandas.core.reshape.concatr<  rB   r  r   rx  r  r  r@  
add_suffixr   r   r  r  r  rg  absr  r1   r  r   r  r  r  r   r   r  rQ  )r   r=  r>  r   r  suffixr<  shifted_dataframesperiodncolsr  r  r  r_  fillernperr  r   res_dfr  s                      r   r@  DataFrame.shift  s    
#.. @MM +- J::99;$$T*  8W-Gqy P  7|q  !STT9!#!!&))#7xtDL>QRS  c6*"))G #)4UWZ6(!F8 4axLQ " ,155NOOsG$DLL!!!19A%!)S^^+ QQ;!YYq)G8)|4F$SG%=> "&1a4!6!6s4y!AaN	  ? "YYq7()|4F$SG%=>!%1b5!1!7!7D	!B/QU &   ? "&!2!2!4Vq
 %VAY
;; 7|4'Q; hhtd5+A&BB"''G !hhU4/0B4$;>bggG ii//LL)# 0  33Cchh3G**4*@@vv||G|KMMMw}T  
 	
r   )rK  r  r   ry  c                   g r   r{  r   r  rK  r  r   ry  s         r   rJ  DataFrame.set_indexQ       	r   )rK  r  ry  c                   g r   r{  rO  s         r   rJ  rP  ]  rQ  r   c          
       ^ ^ [        US5      nT R                  U5        [        U[        5      (       d  U/nSn/ nU H  m[        T[        [
        [        R                  [        [        R                  45      (       a  [        TSS5      S:w  a  [        U5      eM_   TT R                  ;   nU(       d  UR                  T5        M  M     U(       a  [!        SU S35      eU(       a  T n
OT R#                  SS	9n
/ n/ nU(       a  [        T R$                  R&                  5      n[        T R$                  [(        5      (       a9  UR+                  U 4S
 j[-        T R$                  R.                  5       5       5        OUR                  T R$                  5        / nU GH  m[        T[(        5      (       aK  UR+                  U4S j[-        TR.                  5       5       5        UR+                  TR&                  5        GO[        T[        [
        45      (       a-  UR                  T5        UR                  TR0                  5        O[        T[        [        R                  45      (       a#  UR                  T5        UR                  S5        O[        T[        R                  5      (       a,  UR                  [        T5      5        UR                  S5        O=UR                  U
T   5        UR                  T5        U(       a  UR                  T5        [3        US   5      [3        T 5      :w  d  GM  [        S[3        T 5       S[3        US   5       35      e   [5        X5      nU(       a?  UR6                  (       d.  XR9                  5          R;                  5       n[        SU 35      e[=        U5       H  nU
U	 M     UR?                  5         Xl        U(       d  U
$ g! [         a  n	[        U S[        T5       35      U	eSn	A	ff = f)af	  
Set the DataFrame index using existing columns.

Set the DataFrame index (row labels) using one or more existing
columns or arrays (of the correct length). The index can replace the
existing index or expand on it.

Parameters
----------
keys : label or array-like or list of labels/arrays
    This parameter can be either a single column key, a single array of
    the same length as the calling DataFrame, or a list containing an
    arbitrary combination of column keys and arrays. Here, "array"
    encompasses :class:`Series`, :class:`Index`, ``np.ndarray``, and
    instances of :class:`~collections.abc.Iterator`.
drop : bool, default True
    Delete columns to be used as the new index.
append : bool, default False
    Whether to append columns to existing index.
inplace : bool, default False
    Whether to modify the DataFrame rather than creating a new one.
verify_integrity : bool, default False
    Check the new index for duplicates. Otherwise defer the check until
    necessary. Setting to False will improve the performance of this
    method.

Returns
-------
DataFrame or None
    Changed row labels or None if ``inplace=True``.

See Also
--------
DataFrame.reset_index : Opposite of set_index.
DataFrame.reindex : Change to new indices or expand indices.
DataFrame.reindex_like : Change to same indices as other DataFrame.

Examples
--------
>>> df = pd.DataFrame({'month': [1, 4, 7, 10],
...                    'year': [2012, 2014, 2013, 2014],
...                    'sale': [55, 40, 84, 31]})
>>> df
   month  year  sale
0      1  2012    55
1      4  2014    40
2      7  2013    84
3     10  2014    31

Set the index to become the 'month' column:

>>> df.set_index('month')
       year  sale
month
1      2012    55
4      2014    40
7      2013    84
10     2014    31

Create a MultiIndex using columns 'year' and 'month':

>>> df.set_index(['year', 'month'])
            sale
year  month
2012  1     55
2014  4     40
2013  7     84
2014  10    31

Create a MultiIndex using an Index and a column:

>>> df.set_index([pd.Index([1, 2, 3, 4]), 'year'])
         month  sale
   year
1  2012  1      55
2  2014  4      40
3  2013  7      84
4  2014  10     31

Create a MultiIndex using two Series:

>>> s = pd.Series([1, 2, 3, 4])
>>> df.set_index([s, s**2])
      month  year  sale
1 1       1  2012    55
2 4       4  2014    40
3 9       7  2013    84
4 16     10  2014    31
r   zThe parameter "keys" may be a column key, one-dimensional array, or a list containing only valid column keys and one-dimensional arrays.r  r   z. Received column of type NzNone of z are in the columnsr   c              3  Z   >#    U  H   nTR                   R                  U5      v   M"     g 7fr   )r   _get_level_values)r^  r  r   s     r   r`  &DataFrame.set_index.<locals>.<genexpr>  s'      =VDJJ0033=Vs   (+c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr   )rU  )r^  nr_  s     r   r`  rV     s!     S@R1c33A66@Rs   !rN  zLength mismatch: Expected z  rows, received array of length zIndex has duplicate keys: ) r.   *_check_inplace_and_allows_duplicate_labelsr   r  rf   r}   r  r  r   r   r   r  r   r  r  r   rT  r   r   r  rk   r  r  rg  r   r  rj   r  r   uniquer  _cleanup)r   r  rK  r  r   ry  err_msgmissingfoundr  framer  r  r`  r   
duplicatesrq  r_  s   `                @r   rJ  rP  i  sR   D &gy977@$%%6D& 	 #%C#vrzz4NOO 3*a/$W-- 0,4<</E !s+ ! $ XgY.ABCCE II4I(E  "))*E$**j11 =B4::CUCU=V  djj)$&	C#z**Sckk@RSSSYY'C%11
 c"SXX&C$

!344 c"T"C.. d3i(T" eCj)S!$$S)6":#d)+ !0T <003F2J/@B ? H ,F:EOO//1299;J9*FGG YAa   	Le ! #")#=d3i[Is   O##
P-PP)rK  r   	col_levelcol_fillr  r  c                   g r   r{  r   r  rK  r   ra  rb  r  r  s           r   reset_indexDataFrame.reset_index5  r"  r   )rK  ra  rb  r  r  c                   g r   r{  rd  s           r   re  rf  C  r"  r   c                   g r   r{  rd  s           r   re  rf  Q  r"  r   r>  c               @   [        US5      nU R                  U5        U(       a  U nOU R                  SS9nU[        R                  La  [        US5      n[        [        U5      5      n	Ub  [        U[        [        45      (       d  U/nU V
s/ s H  oR                  R                  U
5      PM     nn
[        U5      U R                  R                  :  a  U R                  R                  U5      n	U(       Gd  SU ;  a  SOSnU R                  R                  X{5      n[        U R                  [        5      (       a5  [!        U R                  R"                  U R                  R$                  5      nOU R                  S44n[        U R&                  [        5      n[)        [        [+        U5      5      5       GHL  u  nu  pUb  X;  a  M  X~   nU(       a  [        U[        5      (       a  [        U5      OU/nUc8  [        U5      SU R&                  R                  4;  a  [-        SU 35      eUS	   nU R&                  R                  U5      nU/U-  U-   nU R&                  R                  [        U5      -
  nUU/U-  -  n[        U5      nU
R.                  nUR0                  [2        R4                  :X  a  [        R6                  " U5      nUb!  [8        R:                  " UUS
U
R<                  S9nUR?                  S	UUUS9  GMO     Xl
        U(       d  U$ gs  sn
f )a*  
Reset the index, or a level of it.

Reset the index of the DataFrame, and use the default one instead.
If the DataFrame has a MultiIndex, this method can remove one or more
levels.

Parameters
----------
level : int, str, tuple, or list, default None
    Only remove the given levels from the index. Removes all levels by
    default.
drop : bool, default False
    Do not try to insert index into dataframe columns. This resets
    the index to the default integer index.
inplace : bool, default False
    Whether to modify the DataFrame rather than creating a new one.
col_level : int or str, default 0
    If the columns have multiple levels, determines which level the
    labels are inserted into. By default it is inserted into the first
    level.
col_fill : object, default ''
    If the columns have multiple levels, determines how the other
    levels are named. If None then the index name is repeated.
allow_duplicates : bool, optional, default lib.no_default
    Allow duplicate column labels to be created.

    .. versionadded:: 1.5.0

names : int, str or 1-dimensional list, default None
    Using the given string, rename the DataFrame column which contains the
    index data. If the DataFrame has a MultiIndex, this has to be a list or
    tuple with length equal to the number of levels.

    .. versionadded:: 1.5.0

Returns
-------
DataFrame or None
    DataFrame with the new index or None if ``inplace=True``.

See Also
--------
DataFrame.set_index : Opposite of reset_index.
DataFrame.reindex : Change to new indices or expand indices.
DataFrame.reindex_like : Change to same indices as other DataFrame.

Examples
--------
>>> df = pd.DataFrame([('bird', 389.0),
...                    ('bird', 24.0),
...                    ('mammal', 80.5),
...                    ('mammal', np.nan)],
...                   index=['falcon', 'parrot', 'lion', 'monkey'],
...                   columns=('class', 'max_speed'))
>>> df
         class  max_speed
falcon    bird      389.0
parrot    bird       24.0
lion    mammal       80.5
monkey  mammal        NaN

When we reset the index, the old index is added as a column, and a
new sequential index is used:

>>> df.reset_index()
    index   class  max_speed
0  falcon    bird      389.0
1  parrot    bird       24.0
2    lion  mammal       80.5
3  monkey  mammal        NaN

We can use the `drop` parameter to avoid the old index being added as
a column:

>>> df.reset_index(drop=True)
    class  max_speed
0    bird      389.0
1    bird       24.0
2  mammal       80.5
3  mammal        NaN

You can also use `reset_index` with `MultiIndex`.

>>> index = pd.MultiIndex.from_tuples([('bird', 'falcon'),
...                                    ('bird', 'parrot'),
...                                    ('mammal', 'lion'),
...                                    ('mammal', 'monkey')],
...                                   names=['class', 'name'])
>>> columns = pd.MultiIndex.from_tuples([('speed', 'max'),
...                                      ('species', 'type')])
>>> df = pd.DataFrame([(389.0, 'fly'),
...                    (24.0, 'fly'),
...                    (80.5, 'run'),
...                    (np.nan, 'jump')],
...                   index=index,
...                   columns=columns)
>>> df
               speed species
                 max    type
class  name
bird   falcon  389.0     fly
       parrot   24.0     fly
mammal lion     80.5     run
       monkey    NaN    jump

Using the `names` parameter, choose a name for the index column:

>>> df.reset_index(names=['classes', 'names'])
  classes   names  speed species
                     max    type
0    bird  falcon  389.0     fly
1    bird  parrot   24.0     fly
2  mammal    lion   80.5     run
3  mammal  monkey    NaN    jump

If the index has multiple levels, we can reset a subset of them:

>>> df.reset_index(level='class')
         class  speed species
                  max    type
name
falcon    bird  389.0     fly
parrot    bird   24.0     fly
lion    mammal   80.5     run
monkey  mammal    NaN    jump

If we are not dropping the index, by default, it is placed in the top
level. We can place it in another level:

>>> df.reset_index(level='class', col_level=1)
                speed species
         class    max    type
name
falcon    bird  389.0     fly
parrot    bird   24.0     fly
lion    mammal   80.5     run
monkey  mammal    NaN    jump

When the index is inserted under another level, we can specify under
which one with the parameter `col_fill`:

>>> df.reset_index(level='class', col_level=1, col_fill='species')
              species  speed species
                class    max    type
name
falcon           bird  389.0     fly
parrot           bird   24.0     fly
lion           mammal   80.5     run
monkey         mammal    NaN    jump

If we specify a nonexistent level for `col_fill`, it is created:

>>> df.reset_index(level='class', col_level=1, col_fill='genus')
                genus  speed species
                class    max    type
name
falcon           bird  389.0     fly
parrot           bird   24.0     fly
lion           mammal   80.5     run
monkey         mammal    NaN    jump
r   Nr   r  r   level_0r   z:col_fill=None is incompatible with incomplete column name r   T
allow_fillr  r?  ) r.   rY  r   r   r  rh   r  r   r.  r  r   _get_level_numberrg  	droplevel_get_default_index_namesrk   r  levelscodesr   reversedr  r  rR  r   r  r  rP  rP   rm  	_na_valuer  )r   r  rK  r   ra  rb  r  r  new_objr  levdefault	to_insert	multi_colr  labr   col_namelev_numname_lstr]  level_valuess                         r   re  rf  _  s   Z &gy977@GiiTi*G3>>123CEWX!#g,/	eeT]33BGH%3ZZ11#6%EH5zDJJ... JJ007	 ")!4g)GJJ77GE$**j11

 1 14::3C3CD	"jj$/1	"4<<<I!)$y/C*D!E:C$x-7e-D-DtDz4&H'x=DLL4H4H0II",!??Cf!F#  $,A;"ll<<YGG (zG3h>H"ll22S]BG
W 44H ?D  #{{%%3#&#<#<\#JL?#-??$cds}}$L  %5	  ? "FL "Nu Is   $Lc                    U R                   R                  [        S9nU R                  XR                  S9nUR	                  U SS9$ )N)funcr   rN   r  )r   rN   r   r   r  )r   res_mgrr  s      r   rN   DataFrame.isnaX  sC    ))..d.+++G,,+G""4"77r   c                "    U R                  5       $ )z2
DataFrame.isnull is an alias for DataFrame.isna.
rN   r   s    r   isnullDataFrame.isnull^  s    
 yy{r   c                $    U R                  5       ) $ r   r  r   s    r   rO   DataFrame.notnae  s    		|r   c                $    U R                  5       ) $ )z4
DataFrame.notnull is an alias for DataFrame.notna.
r  r   s    r   notnullDataFrame.notnulli  s    
 		|r   )r   howthreshsubsetr   ignore_indexc                   g r   r{  r   r   r  r  r  r   r  s          r   dropnaDataFrame.dropnap  r  r   )r   r  r  r  r  c                   g r   r{  r  s          r   r  r  }  r  r   c                  U[         R                  La  U[         R                  La  [        S5      eU[         R                  L a  Sn[        US5      n[	        U[
        [        45      (       a  [        S5      eU R                  U5      nSU-
  nU nUb  [        U5      (       d  U/nU R                  U5      n	U	R                  U5      n
U
S:H  nUR                  5       (       a0  [        [        R                  " U5      U   R                  5       5      eU R!                  XS9nU[         R                  La  UR#                  US9nX:  nONUS:X  a  [%        U5      R'                  US	S
9nO.US:X  a  [%        U5      R                  US	S
9nO[)        SU 35      e[        R&                  " U5      (       a  U R+                  SS9nOU R-                  US9U   nU(       a  [/        [1        U5      5      Ul        U(       d  U$ U R5                  U5        g)u  
Remove missing values.

See the :ref:`User Guide <missing_data>` for more on which values are
considered missing, and how to work with missing data.

Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
    Determine if rows or columns which contain missing values are
    removed.

    * 0, or 'index' : Drop rows which contain missing values.
    * 1, or 'columns' : Drop columns which contain missing value.

    Only a single axis is allowed.

how : {'any', 'all'}, default 'any'
    Determine if row or column is removed from DataFrame, when we have
    at least one NA or all NA.

    * 'any' : If any NA values are present, drop that row or column.
    * 'all' : If all values are NA, drop that row or column.

thresh : int, optional
    Require that many non-NA values. Cannot be combined with how.
subset : column label or sequence of labels, optional
    Labels along other axis to consider, e.g. if you are dropping rows
    these would be a list of columns to include.
inplace : bool, default False
    Whether to modify the DataFrame rather than creating a new one.
ignore_index : bool, default ``False``
    If ``True``, the resulting axis will be labeled 0, 1, …, n - 1.

    .. versionadded:: 2.0.0

Returns
-------
DataFrame or None
    DataFrame with NA entries dropped from it or None if ``inplace=True``.

See Also
--------
DataFrame.isna: Indicate missing values.
DataFrame.notna : Indicate existing (non-missing) values.
DataFrame.fillna : Replace missing values.
Series.dropna : Drop missing values.
Index.dropna : Drop missing indices.

Examples
--------
>>> df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
...                    "toy": [np.nan, 'Batmobile', 'Bullwhip'],
...                    "born": [pd.NaT, pd.Timestamp("1940-04-25"),
...                             pd.NaT]})
>>> df
       name        toy       born
0    Alfred        NaN        NaT
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT

Drop the rows where at least one element is missing.

>>> df.dropna()
     name        toy       born
1  Batman  Batmobile 1940-04-25

Drop the columns where at least one element is missing.

>>> df.dropna(axis='columns')
       name
0    Alfred
1    Batman
2  Catwoman

Drop the rows where all elements are missing.

>>> df.dropna(how='all')
       name        toy       born
0    Alfred        NaN        NaT
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT

Keep only the rows with at least 2 non-NA values.

>>> df.dropna(thresh=2)
       name        toy       born
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT

Define in which columns to look for missing values.

>>> df.dropna(subset=['name', 'toy'])
       name        toy       born
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT
zBYou cannot set both the how and thresh arguments at the same time.rU  r   z7supplying multiple axes to axis is no longer supported.r   NrN  r  F)r   	bool_onlyr:  zinvalid how option: r   )r   r  r  r.   r   r.  r  rB  rE   	_get_axisrb  rU  rT  r  r   tolistrm  countrO   r:  r  r   r?  rh   r  r   r  )r   r   r  r  r  r   r  agg_axisagg_objr5  indicescheckr  maskr  s                  r   r  r    s   V s~~%F#..,HT  #.. C%gy9dUDM**UVV$$T*t8'' )B((0GrMEyy{{rxx/6==?@@iii7G'MMxM0E?DE\>%%8u%EDE\>%%8u%ED3C59::66$<<YYDY)FXX4X(.F(V5FLMV$r   )r$  r  c                   g r   r{  r   r  r$  r   r  s        r   r'  DataFrame.drop_duplicates*       	r   )r$  r   r  c                   g r   r{  r  s        r   r'  r  5  r  r   c                   g r   r{  r  s        r   r'  r  @  r  r   firstc                  U R                   (       a  U R                  SS9$ [        US5      n[        US5      nX R                  XS9*    nU(       a  [	        [        U5      5      Ul        U(       a  U R                  U5        gU$ )u  
Return DataFrame with duplicate rows removed.

Considering certain columns is optional. Indexes, including time indexes
are ignored.

Parameters
----------
subset : column label or sequence of labels, optional
    Only consider certain columns for identifying duplicates, by
    default use all of the columns.
keep : {'first', 'last', ``False``}, default 'first'
    Determines which duplicates (if any) to keep.

    - 'first' : Drop duplicates except for the first occurrence.
    - 'last' : Drop duplicates except for the last occurrence.
    - ``False`` : Drop all duplicates.

inplace : bool, default ``False``
    Whether to modify the DataFrame rather than creating a new one.
ignore_index : bool, default ``False``
    If ``True``, the resulting axis will be labeled 0, 1, …, n - 1.

Returns
-------
DataFrame or None
    DataFrame with duplicates removed or None if ``inplace=True``.

See Also
--------
DataFrame.value_counts: Count unique combinations of columns.

Examples
--------
Consider dataset containing ramen rating.

>>> df = pd.DataFrame({
...     'brand': ['Yum Yum', 'Yum Yum', 'Indomie', 'Indomie', 'Indomie'],
...     'style': ['cup', 'cup', 'cup', 'pack', 'pack'],
...     'rating': [4, 4, 3.5, 15, 5]
... })
>>> df
    brand style  rating
0  Yum Yum   cup     4.0
1  Yum Yum   cup     4.0
2  Indomie   cup     3.5
3  Indomie  pack    15.0
4  Indomie  pack     5.0

By default, it removes duplicate rows based on all columns.

>>> df.drop_duplicates()
    brand style  rating
0  Yum Yum   cup     4.0
2  Indomie   cup     3.5
3  Indomie  pack    15.0
4  Indomie  pack     5.0

To remove duplicates on specific column(s), use ``subset``.

>>> df.drop_duplicates(subset=['brand'])
    brand style  rating
0  Yum Yum   cup     4.0
2  Indomie   cup     3.5

To remove duplicates and keep last occurrences, use ``keep``.

>>> df.drop_duplicates(subset=['brand', 'style'], keep='last')
    brand style  rating
1  Yum Yum   cup     4.0
2  Indomie   cup     3.5
4  Indomie  pack     5.0
Nr   r   r  r#  )rA  r   r.   r   rh   r  r   r  )r   r  r$  r   r  r  s         r   r'  r  K  sw    b ::99$9''%gy9*<Hv99:(V5FL  (Mr   c           	     ^  ^ ^ T R                   (       a  T R                  [        S9$ SU 4S jjnTc  T R                  mOX[        R
                  " T5      (       a:  [        T[        5      (       d%  [        T[        5      (       a  TT R                  ;   a  T4m[        [        T5      m[        T5      [        T R                  5      -
  nU(       a  [        [        U5      5      e[        T5      S:X  a:  T R                  R                  (       a  T TS      R!                  U5      nSUl        OsU4S jT R%                  5        5       n['        [(        [+        ['        X65      6 5      u  px[-        U[        U5      SSS9n	T R                  [!        X5      T R.                  S	9nUR1                  T S
S9$ )a  
Return boolean Series denoting duplicate rows.

Considering certain columns is optional.

Parameters
----------
subset : column label or sequence of labels, optional
    Only consider certain columns for identifying duplicates, by
    default use all of the columns.
keep : {'first', 'last', False}, default 'first'
    Determines which duplicates (if any) to mark.

    - ``first`` : Mark duplicates as ``True`` except for the first occurrence.
    - ``last`` : Mark duplicates as ``True`` except for the last occurrence.
    - False : Mark all duplicates as ``True``.

Returns
-------
Series
    Boolean series for each duplicated rows.

See Also
--------
Index.duplicated : Equivalent method on index.
Series.duplicated : Equivalent method on Series.
Series.drop_duplicates : Remove duplicate values from Series.
DataFrame.drop_duplicates : Remove duplicate values from DataFrame.

Examples
--------
Consider dataset containing ramen rating.

>>> df = pd.DataFrame({
...     'brand': ['Yum Yum', 'Yum Yum', 'Indomie', 'Indomie', 'Indomie'],
...     'style': ['cup', 'cup', 'cup', 'pack', 'pack'],
...     'rating': [4, 4, 3.5, 15, 5]
... })
>>> df
    brand style  rating
0  Yum Yum   cup     4.0
1  Yum Yum   cup     4.0
2  Indomie   cup     3.5
3  Indomie  pack    15.0
4  Indomie  pack     5.0

By default, for each set of duplicated values, the first occurrence
is set on False and all others on True.

>>> df.duplicated()
0    False
1     True
2    False
3    False
4    False
dtype: bool

By using 'last', the last occurrence of each set of duplicated values
is set on False and all others on True.

>>> df.duplicated(keep='last')
0     True
1    False
2    False
3    False
4    False
dtype: bool

By setting ``keep`` on False, all duplicates are True.

>>> df.duplicated(keep=False)
0     True
1     True
2    False
3    False
4    False
dtype: bool

To find duplicates on specific column(s), use ``subset``.

>>> df.duplicated(subset=['brand'])
0    False
1     True
2    False
3     True
4     True
dtype: bool
r  c                z   > [         R                  " U [        T5      S9u  pUR                  SSS9[        U5      4$ )N)	size_hinti8Fr  )rP   	factorizer  astype)valsr  rC  r   s      r   fDataFrame.duplicated.<locals>.f  s7    &00TKMF==E=2CJ>>r   Nr   r   c              3  P   >#    U  H  u  pUT;   d  M  UR                   v   M     g 7fr   )r   )r^  r   r_  r  s      r   r`  'DataFrame.duplicated.<locals>.<genexpr>-  s     O94JCJJs   &&F)sortxnullr$  r   r  )rI  ztuple[np.ndarray, int])rA  r   r#  r   r  iterabler   r  r.  r   r	   r  rT  rf   r  r  r   r   r  r  r  r  r   r   r  )
r   r  r$  r  diffr  r  r  rC  idss
   ``        r   r   DataFrame.duplicated  sS   | ::++$+77	? > \\FF##&#&&&%(($,,&YF h'
 6{S..5;''v;! 6 6&)_//5FFKO

ODc3q<&89MF!&%,U%PC--j.C4::-VF""4"==r   )r   	ascendingr   rZ  na_positionr  r  c                   g r   r{  	r   byr   r  r   rZ  r  r  r  s	            r   sort_valuesDataFrame.sort_values7  r+  r   )r   r  rZ  r  r  r  c                   g r   r{  r  s	            r   r  r  F  r+  r   	quicksortlastc          	     @   [        US5      nU R                  U5      n[        U5      n[        U[        5      (       d  U/n[        U5      (       a<  [        U5      [        U5      :w  a$  [        S[        U5       S[        U5       S35      e[        U5      S:  aR  U V	s/ s H  oR                  XS9PM     n
n	Ub&  [        X5       VVs/ s H  u  p[        XS9PM     n
nn[        XXhS	9nO[        U5      (       aN  U R                  US
   US9nUb  [        XS
   S9n[        U[        [        45      (       a  US
   n[        XX6US9nO'U(       a  U R                  U 5      $ U R                  SS9$ [!        U[        U5      5      (       ad  U R                  U(       + =(       a    [#        5       (       + S9nU(       a  [%        [        U5      5      Ul        U(       a  U R                  U5      $ U$ U R(                  R+                  XR-                  U5      SS9nU(       a3  UR/                  U R-                  U5      [%        [        U5      5      5        U R1                  XR2                  S9nU(       a  U R                  U5      $ UR5                  U SS9$ s  sn	f s  snnf )u  
Sort by the values along either axis.

Parameters
----------
by : str or list of str
    Name or list of names to sort by.

    - if `axis` is 0 or `'index'` then `by` may contain index
      levels and/or column labels.
    - if `axis` is 1 or `'columns'` then `by` may contain column
      levels and/or index labels.
axis : "{0 or 'index', 1 or 'columns'}", default 0
     Axis to be sorted.
ascending : bool or list of bool, default True
     Sort ascending vs. descending. Specify list for multiple sort
     orders.  If this is a list of bools, must match the length of
     the by.
inplace : bool, default False
     If True, perform operation in-place.
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort'
     Choice of sorting algorithm. See also :func:`numpy.sort` for more
     information. `mergesort` and `stable` are the only stable algorithms. For
     DataFrames, this option is only applied when sorting on a single
     column or label.
na_position : {'first', 'last'}, default 'last'
     Puts NaNs at the beginning if `first`; `last` puts NaNs at the
     end.
ignore_index : bool, default False
     If True, the resulting axis will be labeled 0, 1, …, n - 1.
key : callable, optional
    Apply the key function to the values
    before sorting. This is similar to the `key` argument in the
    builtin :meth:`sorted` function, with the notable difference that
    this `key` function should be *vectorized*. It should expect a
    ``Series`` and return a Series with the same shape as the input.
    It will be applied to each column in `by` independently.

Returns
-------
DataFrame or None
    DataFrame with sorted values or None if ``inplace=True``.

See Also
--------
DataFrame.sort_index : Sort a DataFrame by the index.
Series.sort_values : Similar method for a Series.

Examples
--------
>>> df = pd.DataFrame({
...     'col1': ['A', 'A', 'B', np.nan, 'D', 'C'],
...     'col2': [2, 1, 9, 8, 7, 4],
...     'col3': [0, 1, 9, 4, 2, 3],
...     'col4': ['a', 'B', 'c', 'D', 'e', 'F']
... })
>>> df
  col1  col2  col3 col4
0    A     2     0    a
1    A     1     1    B
2    B     9     9    c
3  NaN     8     4    D
4    D     7     2    e
5    C     4     3    F

Sort by col1

>>> df.sort_values(by=['col1'])
  col1  col2  col3 col4
0    A     2     0    a
1    A     1     1    B
2    B     9     9    c
5    C     4     3    F
4    D     7     2    e
3  NaN     8     4    D

Sort by multiple columns

>>> df.sort_values(by=['col1', 'col2'])
  col1  col2  col3 col4
1    A     1     1    B
0    A     2     0    a
2    B     9     9    c
5    C     4     3    F
4    D     7     2    e
3  NaN     8     4    D

Sort Descending

>>> df.sort_values(by='col1', ascending=False)
  col1  col2  col3 col4
4    D     7     2    e
5    C     4     3    F
2    B     9     9    c
0    A     2     0    a
1    A     1     1    B
3  NaN     8     4    D

Putting NAs first

>>> df.sort_values(by='col1', ascending=False, na_position='first')
  col1  col2  col3 col4
3  NaN     8     4    D
4    D     7     2    e
5    C     4     3    F
2    B     9     9    c
0    A     2     0    a
1    A     1     1    B

Sorting with a key function

>>> df.sort_values(by='col4', key=lambda col: col.str.lower())
   col1  col2  col3 col4
0    A     2     0    a
1    A     1     1    B
2    B     9     9    c
3  NaN     8     4    D
4    D     7     2    e
5    C     4     3    F

Natural sort with the key argument,
using the `natsort <https://github.com/SethMMorton/natsort>` package.

>>> df = pd.DataFrame({
...    "time": ['0hr', '128hr', '72hr', '48hr', '96hr'],
...    "value": [10, 20, 30, 40, 50]
... })
>>> df
    time  value
0    0hr     10
1  128hr     20
2   72hr     30
3   48hr     40
4   96hr     50
>>> from natsort import index_natsorted
>>> df.sort_values(
...     by="time",
...     key=lambda x: np.argsort(index_natsorted(df["time"]))
... )
    time  value
0    0hr     10
3   48hr     40
2   72hr     30
4   96hr     50
1  128hr     20
r   zLength of ascending (z) != length of by ()r   r  Nr  )ordersr  r  r   )rZ  r  r  r  r   F)r   verifyr   r  r  )r.   rB  r-   r   r  rG   r  r  _get_label_or_level_valuesr  r}   r   r.  r   r  r   r   r   rh   r   r   rm  _get_block_manager_axisr  r   r   r  )r   r  r   r  r   rZ  r  r  r  r]  r  r  r   r  r  new_datas                   r   r  r  U  s   | &gy9$$T*&y1	"d##B y!!Gs9~% 'I'7 8%%(WIQ0  r7Q;KMN2a33A3A2DN 
 &)]%2	 1(%2  
 &KG WW //1D/AA  1a5))eT]33%aL		PSG ++D11yydy++GS\22YY[%N9L9N5NYPF,S[9++F3399>>66t<U " 
 ,,T2M#g,4O ++H==+I''//&&tM&BBy Os    JJ)r   r  r  rZ  r  sort_remainingr  r  c       	            g r   r{  
r   r   r  r  r   rZ  r  r  r  r  s
             r   
sort_indexDataFrame.sort_indexB       	r   	r   r  r  r   rZ  r  r  r  r  c       	            g r   r{  r  s
             r   r  r  R  r  r   c       	            g r   r{  r  s
             r   r  r  b  r  r   c       	        .   > [         T
U ]  UUUUUUUUU	S9	$ )u  
Sort object by labels (along an axis).

Returns a new DataFrame sorted by label if `inplace` argument is
``False``, otherwise updates the original DataFrame and returns None.

Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
    The axis along which to sort.  The value 0 identifies the rows,
    and 1 identifies the columns.
level : int or level name or list of ints or list of level names
    If not None, sort on values in specified index level(s).
ascending : bool or list-like of bools, default True
    Sort ascending vs. descending. When the index is a MultiIndex the
    sort direction can be controlled for each level individually.
inplace : bool, default False
    Whether to modify the DataFrame rather than creating a new one.
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort'
    Choice of sorting algorithm. See also :func:`numpy.sort` for more
    information. `mergesort` and `stable` are the only stable algorithms. For
    DataFrames, this option is only applied when sorting on a single
    column or label.
na_position : {'first', 'last'}, default 'last'
    Puts NaNs at the beginning if `first`; `last` puts NaNs at the end.
    Not implemented for MultiIndex.
sort_remaining : bool, default True
    If True and sorting by level and index is multilevel, sort by other
    levels too (in order) after sorting by specified level.
ignore_index : bool, default False
    If True, the resulting axis will be labeled 0, 1, …, n - 1.
key : callable, optional
    If not None, apply the key function to the index values
    before sorting. This is similar to the `key` argument in the
    builtin :meth:`sorted` function, with the notable difference that
    this `key` function should be *vectorized*. It should expect an
    ``Index`` and return an ``Index`` of the same shape. For MultiIndex
    inputs, the key is applied *per level*.

Returns
-------
DataFrame or None
    The original DataFrame sorted by the labels or None if ``inplace=True``.

See Also
--------
Series.sort_index : Sort Series by the index.
DataFrame.sort_values : Sort DataFrame by the value.
Series.sort_values : Sort Series by the value.

Examples
--------
>>> df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
...                   columns=['A'])
>>> df.sort_index()
     A
1    4
29   2
100  1
150  5
234  3

By default, it sorts in ascending order, to sort in descending order,
use ``ascending=False``

>>> df.sort_index(ascending=False)
     A
234  3
150  5
100  1
29   2
1    4

A key function can be specified which is applied to the index before
sorting. For a ``MultiIndex`` this is applied to each level separately.

>>> df = pd.DataFrame({"a": [1, 2, 3, 4]}, index=['A', 'b', 'C', 'd'])
>>> df.sort_index(key=lambda x: x.str.lower())
   a
A  1
b  2
C  3
d  4
r  )r  r  )r   r   r  r  r   rZ  r  r  r  r  r  s             r   r  r  r  s8    B w!#)% " 

 
	
r   c                   Uc  U R                   R                  5       nU(       a  SOSnU R                  XSS9R                  R	                  5       nXgl        U(       a  UR                  US9nU(       a  XwR                  5       -  n[        U5      (       aI  [        U5      S:X  a:  [        R                  " UR                  /UR                  R
                  /S9Ul        U$ )a
  
Return a Series containing the frequency of each distinct row in the Dataframe.

Parameters
----------
subset : label or list of labels, optional
    Columns to use when counting unique combinations.
normalize : bool, default False
    Return proportions rather than frequencies.
sort : bool, default True
    Sort by frequencies when True. Sort by DataFrame column values when False.
ascending : bool, default False
    Sort in ascending order.
dropna : bool, default True
    Don't include counts of rows that contain NA values.

    .. versionadded:: 1.3.0

Returns
-------
Series

See Also
--------
Series.value_counts: Equivalent method on Series.

Notes
-----
The returned Series will have a MultiIndex with one level per input
column but an Index (non-multi) for a single label. By default, rows
that contain any NA values are omitted from the result. By default,
the resulting Series will be in descending order so that the first
element is the most frequently-occurring row.

Examples
--------
>>> df = pd.DataFrame({'num_legs': [2, 4, 4, 6],
...                    'num_wings': [2, 0, 0, 0]},
...                   index=['falcon', 'dog', 'cat', 'ant'])
>>> df
        num_legs  num_wings
falcon         2          2
dog            4          0
cat            4          0
ant            6          0

>>> df.value_counts()
num_legs  num_wings
4         0            2
2         2            1
6         0            1
Name: count, dtype: int64

>>> df.value_counts(sort=False)
num_legs  num_wings
2         2            1
4         0            2
6         0            1
Name: count, dtype: int64

>>> df.value_counts(ascending=True)
num_legs  num_wings
2         2            1
6         0            1
4         0            2
Name: count, dtype: int64

>>> df.value_counts(normalize=True)
num_legs  num_wings
4         0            0.50
2         2            0.25
6         0            0.25
Name: proportion, dtype: float64

With `dropna` set to `False` we can also count rows with NA values.

>>> df = pd.DataFrame({'first_name': ['John', 'Anne', 'John', 'Beth'],
...                    'middle_name': ['Smith', pd.NA, pd.NA, 'Louise']})
>>> df
  first_name middle_name
0       John       Smith
1       Anne        <NA>
2       John        <NA>
3       Beth      Louise

>>> df.value_counts()
first_name  middle_name
Beth        Louise         1
John        Smith          1
Name: count, dtype: int64

>>> df.value_counts(dropna=False)
first_name  middle_name
Anne        NaN            1
Beth        Louise         1
John        Smith          1
            NaN            1
Name: count, dtype: int64

>>> df.value_counts("first_name")
first_name
John    2
Anne    1
Beth    1
Name: count, dtype: int64

proportionr  F)r  observed)r  r   r  )r   r  groupby_grouperr  r   r  sumrE   r  rk   from_arraysr   )r   r  	normalizer  r  r  r   countss           r   value_countsDataFrame.value_counts  s    d >\\((*F(|gfeDMMRRT'')'<Fjjl"F CK1$4%11v||'8'8&9FL r   c                H    [         R                  " XX2S9R                  5       $ )ah  
Return the first `n` rows ordered by `columns` in descending order.

Return the first `n` rows with the largest values in `columns`, in
descending order. The columns that are not specified are returned as
well, but not used for ordering.

This method is equivalent to
``df.sort_values(columns, ascending=False).head(n)``, but more
performant.

Parameters
----------
n : int
    Number of rows to return.
columns : label or list of labels
    Column label(s) to order by.
keep : {'first', 'last', 'all'}, default 'first'
    Where there are duplicate values:

    - ``first`` : prioritize the first occurrence(s)
    - ``last`` : prioritize the last occurrence(s)
    - ``all`` : keep all the ties of the smallest item even if it means
      selecting more than ``n`` items.

Returns
-------
DataFrame
    The first `n` rows ordered by the given columns in descending
    order.

See Also
--------
DataFrame.nsmallest : Return the first `n` rows ordered by `columns` in
    ascending order.
DataFrame.sort_values : Sort DataFrame by the values.
DataFrame.head : Return the first `n` rows without re-ordering.

Notes
-----
This function cannot be used with all column types. For example, when
specifying columns with `object` or `category` dtypes, ``TypeError`` is
raised.

Examples
--------
>>> df = pd.DataFrame({'population': [59000000, 65000000, 434000,
...                                   434000, 434000, 337000, 11300,
...                                   11300, 11300],
...                    'GDP': [1937894, 2583560 , 12011, 4520, 12128,
...                            17036, 182, 38, 311],
...                    'alpha-2': ["IT", "FR", "MT", "MV", "BN",
...                                "IS", "NR", "TV", "AI"]},
...                   index=["Italy", "France", "Malta",
...                          "Maldives", "Brunei", "Iceland",
...                          "Nauru", "Tuvalu", "Anguilla"])
>>> df
          population      GDP alpha-2
Italy       59000000  1937894      IT
France      65000000  2583560      FR
Malta         434000    12011      MT
Maldives      434000     4520      MV
Brunei        434000    12128      BN
Iceland       337000    17036      IS
Nauru          11300      182      NR
Tuvalu         11300       38      TV
Anguilla       11300      311      AI

In the following example, we will use ``nlargest`` to select the three
rows having the largest values in column "population".

>>> df.nlargest(3, 'population')
        population      GDP alpha-2
France    65000000  2583560      FR
Italy     59000000  1937894      IT
Malta       434000    12011      MT

When using ``keep='last'``, ties are resolved in reverse order:

>>> df.nlargest(3, 'population', keep='last')
        population      GDP alpha-2
France    65000000  2583560      FR
Italy     59000000  1937894      IT
Brunei      434000    12128      BN

When using ``keep='all'``, the number of element kept can go beyond ``n``
if there are duplicate values for the smallest element, all the
ties are kept:

>>> df.nlargest(3, 'population', keep='all')
          population      GDP alpha-2
France      65000000  2583560      FR
Italy       59000000  1937894      IT
Malta         434000    12011      MT
Maldives      434000     4520      MV
Brunei        434000    12128      BN

However, ``nlargest`` does not keep ``n`` distinct largest elements:

>>> df.nlargest(5, 'population', keep='all')
          population      GDP alpha-2
France      65000000  2583560      FR
Italy       59000000  1937894      IT
Malta         434000    12011      MT
Maldives      434000     4520      MV
Brunei        434000    12128      BN

To order by the largest values in column "population" and then "GDP",
we can specify multiple columns like in the next example.

>>> df.nlargest(3, ['population', 'GDP'])
        population      GDP alpha-2
France    65000000  2583560      FR
Italy     59000000  1937894      IT
Brunei      434000    12128      BN
rX  r$  r   )r{   SelectNFramenlargestr   rX  r   r$  s       r   r  DataFrame.nlargeste  s!    n ##DDJSSUUr   c                H    [         R                  " XX2S9R                  5       $ )a  
Return the first `n` rows ordered by `columns` in ascending order.

Return the first `n` rows with the smallest values in `columns`, in
ascending order. The columns that are not specified are returned as
well, but not used for ordering.

This method is equivalent to
``df.sort_values(columns, ascending=True).head(n)``, but more
performant.

Parameters
----------
n : int
    Number of items to retrieve.
columns : list or str
    Column name or names to order by.
keep : {'first', 'last', 'all'}, default 'first'
    Where there are duplicate values:

    - ``first`` : take the first occurrence.
    - ``last`` : take the last occurrence.
    - ``all`` : keep all the ties of the largest item even if it means
      selecting more than ``n`` items.

Returns
-------
DataFrame

See Also
--------
DataFrame.nlargest : Return the first `n` rows ordered by `columns` in
    descending order.
DataFrame.sort_values : Sort DataFrame by the values.
DataFrame.head : Return the first `n` rows without re-ordering.

Examples
--------
>>> df = pd.DataFrame({'population': [59000000, 65000000, 434000,
...                                   434000, 434000, 337000, 337000,
...                                   11300, 11300],
...                    'GDP': [1937894, 2583560 , 12011, 4520, 12128,
...                            17036, 182, 38, 311],
...                    'alpha-2': ["IT", "FR", "MT", "MV", "BN",
...                                "IS", "NR", "TV", "AI"]},
...                   index=["Italy", "France", "Malta",
...                          "Maldives", "Brunei", "Iceland",
...                          "Nauru", "Tuvalu", "Anguilla"])
>>> df
          population      GDP alpha-2
Italy       59000000  1937894      IT
France      65000000  2583560      FR
Malta         434000    12011      MT
Maldives      434000     4520      MV
Brunei        434000    12128      BN
Iceland       337000    17036      IS
Nauru         337000      182      NR
Tuvalu         11300       38      TV
Anguilla       11300      311      AI

In the following example, we will use ``nsmallest`` to select the
three rows having the smallest values in column "population".

>>> df.nsmallest(3, 'population')
          population    GDP alpha-2
Tuvalu         11300     38      TV
Anguilla       11300    311      AI
Iceland       337000  17036      IS

When using ``keep='last'``, ties are resolved in reverse order:

>>> df.nsmallest(3, 'population', keep='last')
          population  GDP alpha-2
Anguilla       11300  311      AI
Tuvalu         11300   38      TV
Nauru         337000  182      NR

When using ``keep='all'``, the number of element kept can go beyond ``n``
if there are duplicate values for the largest element, all the
ties are kept.

>>> df.nsmallest(3, 'population', keep='all')
          population    GDP alpha-2
Tuvalu         11300     38      TV
Anguilla       11300    311      AI
Iceland       337000  17036      IS
Nauru         337000    182      NR

However, ``nsmallest`` does not keep ``n`` distinct
smallest elements:

>>> df.nsmallest(4, 'population', keep='all')
          population    GDP alpha-2
Tuvalu         11300     38      TV
Anguilla       11300    311      AI
Iceland       337000  17036      IS
Nauru         337000    182      NR

To order by the smallest values in column "population" and then "GDP", we can
specify multiple columns like in the next example.

>>> df.nsmallest(3, ['population', 'GDP'])
          population  GDP alpha-2
Tuvalu         11300   38      TV
Anguilla       11300  311      AI
Nauru         337000  182      NR
r  )r{   r  	nsmallestr  s       r   r  DataFrame.nsmallest  s!    \ ##DDJTTVVr   zaxis : {0 or 'index', 1 or 'columns'}, default 0
            The axis to swap levels on. 0 or 'index' for row-wise, 1 or
            'columns' for column-wise.at          Examples
        --------
        >>> df = pd.DataFrame(
        ...     {"Grade": ["A", "B", "A", "C"]},
        ...     index=[
        ...         ["Final exam", "Final exam", "Coursework", "Coursework"],
        ...         ["History", "Geography", "History", "Geography"],
        ...         ["January", "February", "March", "April"],
        ...     ],
        ... )
        >>> df
                                            Grade
        Final exam  History     January      A
                    Geography   February     B
        Coursework  History     March        A
                    Geography   April        C

        In the following example, we will swap the levels of the indices.
        Here, we will swap the levels column-wise, but levels can be swapped row-wise
        in a similar manner. Note that column-wise is the default behaviour.
        By not supplying any arguments for i and j, we swap the last and second to
        last indices.

        >>> df.swaplevel()
                                            Grade
        Final exam  January     History         A
                    February    Geography       B
        Coursework  March       History         A
                    April       Geography       C

        By supplying one argument, we can choose which index to swap the last
        index with. We can for example swap the first index with the last one as
        follows.

        >>> df.swaplevel(0)
                                            Grade
        January     History     Final exam      A
        February    Geography   Final exam      B
        March       History     Coursework      A
        April       Geography   Coursework      C

        We can also define explicitly which indices we want to swap by supplying values
        for both i and j. Here, we for example swap the first and second indices.

        >>> df.swaplevel(0, 1)
                                            Grade
        History     Final exam  January         A
        Geography   Final exam  February        B
        History     Coursework  March           A
        Geography   Coursework  April           C)r   extra_paramsr  rN  c                   U R                  S S9nU R                  U5      n[        UR                  U5      [        5      (       d  [        S5      eUS:X  aC  [        UR                  [        5      (       d   eUR                  R                  X5      Ul        U$ [        UR                  [        5      (       d   eUR                  R                  X5      Ul        U$ )Nr   z,Can only swap levels on a hierarchical axis.r   )	r   rB  r   r  rk   r  r   	swaplevelr   )r   r  jr   r  s        r   r  DataFrame.swaplevelN  s    ~ %$$T*&**40*==JKK19fllJ7777!<<11!7FL  fnnj9999#^^55a;FNr   c                   U R                  U5      n[        U R                  U5      [        5      (       d  [	        S5      eU R                  SS9nUS:X  aC  [        UR                  [        5      (       d   eUR                  R                  U5      Ul        U$ [        UR                  [        5      (       d   eUR                  R                  U5      Ul        U$ )aK  
Rearrange index levels using input order. May not drop or duplicate levels.

Parameters
----------
order : list of int or list of str
    List representing new level order. Reference level by number
    (position) or by key (label).
axis : {0 or 'index', 1 or 'columns'}, default 0
    Where to reorder levels.

Returns
-------
DataFrame

Examples
--------
>>> data = {
...     "class": ["Mammals", "Mammals", "Reptiles"],
...     "diet": ["Omnivore", "Carnivore", "Carnivore"],
...     "species": ["Humans", "Dogs", "Snakes"],
... }
>>> df = pd.DataFrame(data, columns=["class", "diet", "species"])
>>> df = df.set_index(["class", "diet"])
>>> df
                                  species
class      diet
Mammals    Omnivore                Humans
           Carnivore                 Dogs
Reptiles   Carnivore               Snakes

Let's reorder the levels of the index:

>>> df.reorder_levels(["diet", "class"])
                                  species
diet      class
Omnivore  Mammals                  Humans
Carnivore Mammals                    Dogs
          Reptiles                 Snakes
z/Can only reorder levels on a hierarchical axis.Nr   r   )	rB  r   r  rk   r  r   r   reorder_levelsr   )r   orderr   r  s       r   r  DataFrame.reorder_levels  s    R $$T*$...
;;MNN%19fllJ7777!<<66u=FL  fnnj9999#^^::5AFNr   c                n    SnU R                  XSS S9u  pU R                  XUS9nU R                  U5      $ )Nr   Fflexr  r  )_align_for_op_dispatch_frame_op_construct_resultr   r  opr   r  s        r   _cmp_methodDataFrame._cmp_method  sH    ((5(M **54*@%%h//r   c                f   U R                  XSS S 5      (       a  U R                  X5      $ Sn[        R                  " XR                  U   45      nU R                  XSS S9u  p[        R                  " SS9   U R                  XUS9nS S S 5        U R                  W5      $ ! , (       d  f       N= f)Nr   Tr  r  r:  r  )
_should_reindex_frame_op_arith_method_with_reindexrS   maybe_prepare_scalar_for_oprC  r  r  errstater  r  r  s        r   _arith_methodDataFrame._arith_method  s    ((AtTBB225==//

48H7JK((4t(L[[X&..ut.DH '%%h// '&s   8B""
B0c                   [         R                  " U5      n[        R                  " U5      n[	        U5      (       d2  U R
                  R                  XAS9nU R                  XUR                  S9$ [        U[        5      (       a  U R                  R                  UR                  5      (       d   eU R                  R                  UR                  5      (       d   eU R
                  R                  UR
                  U5      nU R                  XUR                  S9$ [        U[        5      (       a  US:X  a  UR                  R                  U R                  5      (       d   eUR                   n[        U["        R$                  5      (       a   e['        U R)                  5       U5       VVs/ s H  u  pgU" Xg5      PM     nnnO~[        U[        5      (       a^  UR                  R                  U R                  5      (       d   eUR                   nU R)                  5        V	s/ s H
  o" X5      PM     nn	O[+        U5      e[-        U 5      R/                  XR                  U R                  SS9$ s  snnf s  sn	f )aY  
Evaluate the frame operation func(left, right) by evaluating
column-by-column, dispatching to the Series implementation.

Parameters
----------
right : scalar, Series, or DataFrame
func : arithmetic or comparison operator
axis : {None, 0, 1}

Returns
-------
DataFrame

Notes
-----
Caller is responsible for setting np.errstate where relevant.
)r  r   r   F)ry  )rS   get_array_opr   r%  rE   r   applyr   r   r   r   r   r8  r   operate_blockwiser}   rR  r  r  r  r  rz  r   rz  )
r   r  r  r   array_opbm_left_rightr  r  s
             r   r  DataFrame._dispatch_frame_op  s   , ##D)%%e,E""7B--bww-??y))::$$U[[1111<<&&u}}5555 ,, 

	B --bww-??v&&419;;%%dll3333MME!%4444 &))A)A)CU%K%KME '%K  F
 v&&;;%%djj1111MME8<8P8P8RS8Rht+8RFSF &e,,Dz&&LL$**u ' 
 	
 Ts   ,I0#I6c                F   ^^ Tc  TnOUU4S jnU R                  X5      nU$ )Nc                F   > [         R                  " XT5      u  pT" X5      $ r   )rS   
fill_binop)r  r  r  r  s     r   	_arith_op+DataFrame._combine_frame.<locals>._arith_opD  s"     "nnT*ED((r   )r  )r   r  r  r  r  r  s     ``  r   _combine_frameDataFrame._combine_frame:  s.      I) **5<r   c                   U nUR                   R                  UR                   SSSS9u  pEnUR                  SS2U4   nUR                  SS2U4   nU" Xx5      n	UR                   R                  UR                   SSSS9u  n
  nU	R                   R                  (       aH  U	R                   R	                  U
5      u  p[
        R                  " U5      nU	R                  SX/0SS9n	U	$ U	R                  U
SS9n	U	$ )	z
For DataFrame-with-DataFrame operations that require reindexing,
operate only on shared columns, then reindex.

Parameters
----------
right : DataFrame
op : binary operator

Returns
-------
DataFrame
innerNT)r  r  return_indexersouterr   )r  r  )	r   joinr  has_duplicatesry  rP   unique1dr  r  )r   r  r  r  r  lcolsrcolsnew_left	new_rightr  join_columnsr  r  s                r   r  $DataFrame._arith_method_with_reindexN  s     "\\..MMwdD / 
U 99QX&JJq%x(	H( "\\..MMwdD / 
a >>((  >>|LJG ))'2G22\+, 3 F  ^^Lq^9Fr   c                   U[         R                  L d  U[        R                  L a  g[	        U[
        5      (       d  gUc  Uc  US:X  a  U R                  R                  5       nUR                  R                  5       nUR                  U5      n[        U5      (       a1  [        U5      [        U5      :X  a  [        U5      [        U5      :X  d  gg)zM
Check if this is an operation between DataFrames that will need to reindex.
Fr   T)
operatorpowrT   rpowr   r   r   rZ  intersectionr  )	r   r  r  r   r  r  left_uniquesright_uniquesr  s	            r   r  "DataFrame._should_reindex_frame_opz  s     y~~!5%++%-DAI  <<..0L!MM002M,,];D4yyD	S..3t9M@R3R r   c                  ^^ XsmnUU4S jn[        U[        R                  5      (       Ga  UR                  S:X  a
  U" U5      nGOUR                  S:X  GaA  SnUR                  [
        :X  a  [
        nUR                  TR                  :X  a(  TR                  UTR                  TR                  US9nGOqUR                  S   TR                  S   :X  a[  UR                  S   S:X  aH  [        R                  " UTR                  5      nTR                  UTR                  TR                  US9nOUR                  S   TR                  S   :X  a#  UR                  S   S:X  a  U" USSS24   5      nO[        STR                   SUR                   35      eUR                  S:  a  [        S	UR                   35      eOe[        U5      (       aU  [        U[        [        45      (       d:  [        S
 U 5       5      (       a  [        S[!        US   5       S35      eU" U5      nUb[  [        U[        5      (       aF  TR#                  U5      (       d+  U(       a  TR%                  USUSS9u  mnTU4$ [        S5      e TU4$ [        U[        5      (       an  Tb  TOSmU(       d8  TR&                  T   R)                  UR                  5      (       d  [        S5      eTR%                  USTUSS9u  mnTR+                  UT5      nTU4$ )ae  
Convert rhs to meet lhs dims if input is list, tuple or np.ndarray.

Parameters
----------
left : DataFrame
right : Any
axis : int
flex : bool or None, default False
    Whether this is a flex op, in which case we reindex.
    None indicates not to check for alignment.
level : int or level name, default None

Returns
-------
left : DataFrame
right : Any
c                  > SnS n[        U SS 5      [        :X  a  [        nTS:X  at  [        TR                  5      [        U 5      :w  a5  [	        UR                  [        TR                  5      [        U 5      S95      eTR                  U TR                  US9n U $ [        TR                  5      [        U 5      :w  a5  [	        UR                  [        TR                  5      [        U 5      S95      eTR                  U TR                  US9n U $ )NzGUnable to coerce to Series, length must be {req_len}: given {given_len}r   r   )req_len	given_lenr  )r   r  r  r   r  r   r   r   )r  r  r   r   r  s      r   	to_series*DataFrame._align_for_op.<locals>.to_series  s    >  Eugt,6 qytzz?c%j0$

3tzz?c%j
Q  00djjPU0V L t||$E
2$

3t||+<E

S  00dllRW0XLr   r   r   Nr  r   z-Unable to coerce to DataFrame, shape must be z: given z>Unable to coerce to Series/DataFrame, dimension must be <= 2: c              3  8   #    U  H  n[        U5      v   M     g 7fr   )r;   )r^  els     r   r`  *DataFrame._align_for_op.<locals>.<genexpr>  s     5u=$$urb  zUnable to coerce list of z to Series/DataFramer  F)r  r  r   zOCan only compare identically-labeled (both index and columns) DataFrame objectszdOperands are not aligned. Do `left, right = left.align(right, axis=1, copy=False)` before operating.)r  r   r  r   )r   r  r  r  r   r  rC  r   r   r   broadcast_tor  rE   r}   r   rU  r   _indexed_samealignr   r8  _maybe_align_series_as_frame)	r   r  r   r  r  r  r*  r   r  s	     `     @r   r  DataFrame._align_for_op  s   2 e	8 eRZZ((zzQ!%(q ;;&( #E;;$**, --TZZU . E [[^tzz!}4Q19LOOE4::>E --TZZU . E [[^tzz!}4Q19L%eAqDk2E %##'::,hu{{mE 
 a //4{{m=    %  EFI;N)O)O5u555 /U1X/??ST  e$E
5) < <%%e,,"&**G5u #- #KD%8 U{1 %,  -< U{) v&&+4Dyy--ekk::$,  ** % KD% 55eTBEU{r   c                   UR                   n[        U[        R                  5      (       d)  UR                  S;   a  [        R
                  " U5      nOU$ US:X  a  UR                  SS5      nOUR                  SS5      n[        R                  " X0R                  5      nU R                  UU R                  U R                  UR                  S9$ )zV
If the Series operand is not EA-dtype, we can broadcast to 2D and operate
blockwise.
)zdatetime64[ns]ztimedelta64[ns]r   rN  r   r  )rR  r   r  r  r   r  rP  r/  rC  r   r   r   )r   rG  r   rvaluess       r   r2  &DataFrame._maybe_align_series_as_frame   s    
 ..'2::..}} EE**W-19oob!,Gooa,G//'::6  **LL--	 ! 
 	
r   )r   r  r  c                  Ub  U R                  U5      OSnU R                  XX5U5      (       a  U R                  X5      $ [        U[        5      (       a  Ub  [        SU S35      e[        R                  " XR                  5      nU R                  XSUS9u  p[        R                  " SS9   [        U[        5      (       a  U R                  XU5      nOK[        U[        5      (       a  U R                  XUS9nO%Ub  U R                  U5      n U R                  X5      nS S S 5        U R!                  W5      $ ! , (       d  f       N= f)	Nr   zfill_value z not supported.Tr  r  r  r  )rB  r  r  r   r}   rz  rS   r  rC  r  r  r  r   r  r  fillnar  )r   r  r  r   r  r  r  s          r   _flex_arith_methodDataFrame._flex_arith_method:   s*    /3.>t$$T*A((DeLL225==eV$$)? &J<&OPP//zzB((4u(M[[X&%++..u*EE6**22542H );;z2D225= ' %%h// '&s   .A4D;;
E	c                    U R                  USS9R                  U 5      nU R                  Ul        U R                  Ul        U$ )z
Wrap the result of an arithmetic, comparison, or logical operation.

Parameters
----------
result : DataFrame

Returns
-------
DataFrame
Fr  )r   r  r   r   )r   r  outs      r   r  DataFrame._construct_resultZ   sA     U3@@F llJJ	
r   c                    X-  nXU-  -
  nX#4$ r   r{  r   r  divmods       r   
__divmod__DataFrame.__divmod__m   s    m5[ xr   c                    X-  nXU -  -
  nX#4$ r   r{  r?  s       r   __rdivmod__DataFrame.__rdivmod__s   s    mDj xr   r   r  c                   Ub  U R                  U5      OSnU R                  XSUS9u  pU R                  XUS9nU R                  U5      $ )Nr   Tr  r  )rB  r  r  r  )r   r  r  r   r  r  s         r   _flex_cmp_methodDataFrame._flex_cmp_methody   sX    .2.>t$$T*A((4u(M**54*@%%h//r   eqc                @    U R                  U[        R                  X#S9$ NrG  )rI  r  rK  r   r  r   r  s       r   rK  DataFrame.eq       $$UHKKd$PPr   nec                @    U R                  U[        R                  X#S9$ rM  )rI  r  rQ  rN  s       r   rQ  DataFrame.ne   rP  r   lec                @    U R                  U[        R                  X#S9$ rM  )rI  r  rT  rN  s       r   rT  DataFrame.le   rP  r   ltc                @    U R                  U[        R                  X#S9$ rM  )rI  r  rW  rN  s       r   rW  DataFrame.lt   rP  r   gec                @    U R                  U[        R                  X#S9$ rM  )rI  r  rZ  rN  s       r   rZ  DataFrame.ge   rP  r   gtc                @    U R                  U[        R                  X#S9$ rM  )rI  r  r]  rN  s       r   r]  DataFrame.gt   rP  r   rR  c                B    U R                  U[        R                  X4US9$ N)r  r  r   )r9  r  rR  r   r  r   r  r  s        r   rR  DataFrame.add   )     &&8<<u$ ' 
 	
r   raddc                B    U R                  U[        R                  X4US9$ ra  )r9  rT   re  rb  s        r   re  DataFrame.radd   )     &&9>>D ' 
 	
r   subc                B    U R                  U[        R                  X4US9$ ra  )r9  r  ri  rb  s        r   ri  DataFrame.sub   rd  r   rsubc                B    U R                  U[        R                  X4US9$ ra  )r9  rT   rl  rb  s        r   rl  DataFrame.rsub   rh  r   mulc                B    U R                  U[        R                  X4US9$ ra  )r9  r  ro  rb  s        r   ro  DataFrame.mul   rd  r   rmulc                B    U R                  U[        R                  X4US9$ ra  )r9  rT   rr  rb  s        r   rr  DataFrame.rmul   rh  r   truedivc                B    U R                  U[        R                  X4US9$ ra  )r9  r  ru  rb  s        r   ru  DataFrame.truediv   s+     &&8##5d ' 
 	
r   rtruedivc                B    U R                  U[        R                  X4US9$ ra  )r9  rT   rx  rb  s        r   rx  DataFrame.rtruediv   s,     &&9%%UPT ' 
 	
r   floordivc                B    U R                  U[        R                  X4US9$ ra  )r9  r  r{  rb  s        r   r{  DataFrame.floordiv   s+     &&8$$Et ' 
 	
r   	rfloordivc                B    U R                  U[        R                  X4US9$ ra  )r9  rT   r~  rb  s        r   r~  DataFrame.rfloordiv   s,     &&9&&eQU ' 
 	
r   rA  c                B    U R                  U[        R                  X4US9$ ra  )r9  r  rA  rb  s        r   rA  DataFrame.mod   rd  r   rmodc                B    U R                  U[        R                  X4US9$ ra  )r9  rT   r  rb  s        r   r  DataFrame.rmod   rh  r   r   c                B    U R                  U[        R                  X4US9$ ra  )r9  r  r   rb  s        r   r   DataFrame.pow!  rd  r   r!  c                B    U R                  U[        R                  X4US9$ ra  )r9  rT   r!  rb  s        r   r!  DataFrame.rpow
!  rh  r   comparea  
        Returns
        -------
        DataFrame
            DataFrame that shows the differences stacked side by side.

            The resulting index will be a MultiIndex with 'self' and 'other'
            stacked alternately at the inner level.

        Raises
        ------
        ValueError
            When the two DataFrames don't have identical labels or shape.

        See Also
        --------
        Series.compare : Compare with another Series and show differences.
        DataFrame.equals : Test whether two objects contain the same elements.

        Notes
        -----
        Matching NaNs will not appear as a difference.

        Can only compare identically-labeled
        (i.e. same shape, identical row and column labels) DataFrames

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {{
        ...         "col1": ["a", "a", "b", "b", "a"],
        ...         "col2": [1.0, 2.0, 3.0, np.nan, 5.0],
        ...         "col3": [1.0, 2.0, 3.0, 4.0, 5.0]
        ...     }},
        ...     columns=["col1", "col2", "col3"],
        ... )
        >>> df
          col1  col2  col3
        0    a   1.0   1.0
        1    a   2.0   2.0
        2    b   3.0   3.0
        3    b   NaN   4.0
        4    a   5.0   5.0

        >>> df2 = df.copy()
        >>> df2.loc[0, 'col1'] = 'c'
        >>> df2.loc[2, 'col3'] = 4.0
        >>> df2
          col1  col2  col3
        0    c   1.0   1.0
        1    a   2.0   2.0
        2    b   3.0   4.0
        3    b   NaN   4.0
        4    a   5.0   5.0

        Align the differences on columns

        >>> df.compare(df2)
          col1       col3
          self other self other
        0    a     c  NaN   NaN
        2  NaN   NaN  3.0   4.0

        Assign result_names

        >>> df.compare(df2, result_names=("left", "right"))
          col1       col3
          left right left right
        0    a     c  NaN   NaN
        2  NaN   NaN  3.0   4.0

        Stack the differences on rows

        >>> df.compare(df2, align_axis=0)
                col1  col3
        0 self     a   NaN
          other    c   NaN
        2 self   NaN   3.0
          other  NaN   4.0

        Keep the equal values

        >>> df.compare(df2, keep_equal=True)
          col1       col3
          self other self other
        0    a     c  1.0   1.0
        2    b     b  3.0   4.0

        Keep all original rows and columns

        >>> df.compare(df2, keep_shape=True)
          col1       col2       col3
          self other self other self other
        0    a     c  NaN   NaN  NaN   NaN
        1  NaN   NaN  NaN   NaN  NaN   NaN
        2  NaN   NaN  NaN   NaN  3.0   4.0
        3  NaN   NaN  NaN   NaN  NaN   NaN
        4  NaN   NaN  NaN   NaN  NaN   NaN

        Keep all original rows and columns and also all original values

        >>> df.compare(df2, keep_shape=True, keep_equal=True)
          col1       col2       col3
          self other self other self other
        0    a     c  1.0   1.0  1.0   1.0
        1    a     a  2.0   2.0  2.0   2.0
        2    b     b  3.0   3.0  3.0   4.0
        3    b     b  NaN   NaN  4.0   4.0
        4    a     a  5.0   5.0  5.0   5.0
        c                &   > [         TU ]  UUUUUS9$ )N)r  
align_axis
keep_shape
keep_equalresult_names)r  r  )r   r  r  r  r  r  r  s         r   r  DataFrame.compare!  s+    x w!!!%  
 	
r   c                T   [        UR                  5      nU R                  USS9u  paUR                  nUR                  (       a2  [        U5      [        U R                  5      :X  a  U R	                  5       $ U R                  (       a  [        U5      U:X  a  UR	                  5       $ UR
                  R                  UR
                  5      nUSLn	0 n
U GH!  nXk   nX   nUR                  nUR                  n[        U5      n[        U5      nU(       d+  UR                  5       (       a  Xk   R	                  5       X'   Ml  U	(       a(  UR	                  5       nUR	                  5       nX<U'   X=U'   XR
                  ;  a  Un UR                  USS9nO,[        X/5      nUR                  USS9nUR                  USS9nU" X5      n[        U[        R                  5      (       a  [        UU5      nUX'   GM$     U R!                  XUS9nUR#                  U SS9$ ! [         a     Nhf = f)a
  
Perform column-wise combine with another DataFrame.

Combines a DataFrame with `other` DataFrame using `func`
to element-wise combine columns. The row and column indexes of the
resulting DataFrame will be the union of the two.

Parameters
----------
other : DataFrame
    The DataFrame to merge column-wise.
func : function
    Function that takes two series as inputs and return a Series or a
    scalar. Used to merge the two dataframes column by columns.
fill_value : scalar value, default None
    The value to fill NaNs with prior to passing any column to the
    merge func.
overwrite : bool, default True
    If True, columns in `self` that do not exist in `other` will be
    overwritten with NaNs.

Returns
-------
DataFrame
    Combination of the provided DataFrames.

See Also
--------
DataFrame.combine_first : Combine two DataFrame objects and default to
    non-null values in frame calling the method.

Examples
--------
Combine using a simple function that chooses the smaller column.

>>> df1 = pd.DataFrame({'A': [0, 0], 'B': [4, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> take_smaller = lambda s1, s2: s1 if s1.sum() < s2.sum() else s2
>>> df1.combine(df2, take_smaller)
   A  B
0  0  3
1  0  3

Example using a true element-wise combine function.

>>> df1 = pd.DataFrame({'A': [5, 0], 'B': [2, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> df1.combine(df2, np.minimum)
   A  B
0  1  2
1  0  3

Using `fill_value` fills Nones prior to passing the column to the
merge function.

>>> df1 = pd.DataFrame({'A': [0, 0], 'B': [None, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> df1.combine(df2, take_smaller, fill_value=-5)
   A    B
0  0 -5.0
1  0  4.0

However, if the same element in both dataframes is None, that None
is preserved

>>> df1 = pd.DataFrame({'A': [0, 0], 'B': [None, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [None, 3]})
>>> df1.combine(df2, take_smaller, fill_value=-5)
    A    B
0  0 -5.0
1  0  3.0

Example that demonstrates the use of `overwrite` and behavior when
the axis differ between the dataframes.

>>> df1 = pd.DataFrame({'A': [0, 0], 'B': [4, 4]})
>>> df2 = pd.DataFrame({'B': [3, 3], 'C': [-10, 1], }, index=[1, 2])
>>> df1.combine(df2, take_smaller)
     A    B     C
0  NaN  NaN   NaN
1  NaN  3.0 -10.0
2  NaN  3.0   1.0

>>> df1.combine(df2, take_smaller, overwrite=False)
     A    B     C
0  0.0  NaN   NaN
1  0.0  3.0 -10.0
2  NaN  3.0   1.0

Demonstrating the preference of the passed in dataframe.

>>> df2 = pd.DataFrame({'B': [3, 3], 'C': [1, 1], }, index=[1, 2])
>>> df2.combine(df1, take_smaller)
   A    B   C
0  0.0  NaN NaN
1  0.0  3.0 NaN
2  NaN  3.0 NaN

>>> df2.combine(df1, take_smaller, overwrite=False)
     A    B   C
0  0.0  NaN NaN
1  0.0  3.0 1.0
2  NaN  3.0 1.0
Fr  Nr   combiner  )r  r   r1  rA  r   r   r  r   rN   r:  r  r  r4   r   r  r8   r   r  )r   r  r  r  	overwriteother_idxlenthisr  r@  do_fillr  r_  rG  other_series
this_dtypeother_dtype	this_mask
other_mask	new_dtyperF  frame_results                        r   r  DataFrame.combine!  s   ^ 5;;'jjUj3JJ	;;3y>S_<99;::#e*4::< ll((7D(CYF :LJ&,,KVIl+J !1!1"inn.+002$.y!+5Z(,,& (	#]]95]AF -j-FG	yu=+22952Iv,C)RXX..
 . FK_ d ((+(V((i(@@/ " s   H
H'&H'c           	       ^ ^ SSK Jm  S
UU 4S jjn[        U5      S:X  ah  T R                  T R                  R                  UR                  R                  T R                  5      5      SS9nUR                  UR                  5      nOT R                  XSS9nT R                  R                  UR                  5       Vs0 s HM  nUR                  U   T R                  U   :w  d  M%  U[        T R                  U   UR                  U   /5      _MO     nnU(       a  UR                  U5      nUR                  T SS	9$ s  snf )a  
Update null elements with value in the same location in `other`.

Combine two DataFrame objects by filling null values in one DataFrame
with non-null values from other DataFrame. The row and column indexes
of the resulting DataFrame will be the union of the two. The resulting
dataframe contains the 'first' dataframe values and overrides the
second one values where both first.loc[index, col] and
second.loc[index, col] are not missing values, upon calling
first.combine_first(second).

Parameters
----------
other : DataFrame
    Provided DataFrame to use to fill null values.

Returns
-------
DataFrame
    The result of combining the provided DataFrame with the other object.

See Also
--------
DataFrame.combine : Perform series-wise operation on two DataFrames
    using a given function.

Examples
--------
>>> df1 = pd.DataFrame({'A': [None, 0], 'B': [None, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> df1.combine_first(df2)
     A    B
0  1.0  3.0
1  0.0  4.0

Null values still persist if the location of that null value
does not exist in `other`

>>> df1 = pd.DataFrame({'A': [None, 0], 'B': [4, None]})
>>> df2 = pd.DataFrame({'B': [3, 3], 'C': [1, 1]}, index=[1, 2])
>>> df1.combine_first(df2)
     A    B    C
0  NaN  4.0  NaN
1  0.0  3.0  1.0
2  NaN  3.0  1.0
r   )expressionsc                   > U R                  5       R                  nU R                  nUR                  nUR                  TR                  ;  a  U$ TR	                  X$U5      $ r   )rN   rR  r   r   r+  )r]  yr  x_valuesy_valuesr  r   s        r   combiner)DataFrame.combine_first.<locals>.combiner}"  sP    668##DyyHyyH vvT\\)$$TX>>r   r   r  F)r  combine_firstr  )r]  r}   r  r}   )pandas.core.computationr  r  r  r   r  
differencer  r  r  r"  r4   r  )r   r  r  combinedr_  r  r  s   `     @r   r  DataFrame.combine_firstL"  s#   ^ 	8	? 	? u:?||##EMM$<$<T\\$JKRS $ H  u||4H||Eu|EH ||00?
?s#t{{3'77 IC!4;;s#3U\\#5F"GHH? 	 
 v.H$$T/$BB
s    $D>(,D>c                   [         (       dL  [        5       (       a=  [        R                  " U 5      [        ::  a  [
        R                  " [        [        SS9  Ok[         (       d`  [        5       (       dQ  U R                  5       (       a<  [        R                  " U 5      [        ::  a  [
        R                  " [        [        SS9  US:w  a  [        S5      eUS;  a  [        S5      e[        U[        5      (       d  [        U5      nUR!                  U R"                  5      nU R$                  R'                  UR$                  5       GH  nX   R(                  nX   R(                  nUb  U" U5      ) [+        U5      -  n	OWUS:X  a3  [-        U5      n
[-        U5      n[/        X-  5      (       a  [        S	5      eU(       a  [+        U5      n	O[-        U5      n	U	R1                  5       (       a  M  [
        R2                  " 5          [
        R4                  " S
S[        S9  X   R7                  X5      U R8                  SS2U4'   SSS5        GM     g! , (       d  f       GM  = f)a:  
Modify in place using non-NA values from another DataFrame.

Aligns on indices. There is no return value.

Parameters
----------
other : DataFrame, or object coercible into a DataFrame
    Should have at least one matching index/column label
    with the original DataFrame. If a Series is passed,
    its name attribute must be set, and that will be
    used as the column name to align with the original DataFrame.
join : {'left'}, default 'left'
    Only left join is implemented, keeping the index and columns of the
    original object.
overwrite : bool, default True
    How to handle non-NA values for overlapping keys:

    * True: overwrite original DataFrame's values
      with values from `other`.
    * False: only update values that are NA in
      the original DataFrame.

filter_func : callable(1d-array) -> bool 1d-array, optional
    Can choose to replace values other than NA. Return True for values
    that should be updated.
errors : {'raise', 'ignore'}, default 'ignore'
    If 'raise', will raise a ValueError if the DataFrame and `other`
    both contain non-NA data in the same place.

Returns
-------
None
    This method directly changes calling object.

Raises
------
ValueError
    * When `errors='raise'` and there's overlapping non-NA data.
    * When `errors` is not either `'ignore'` or `'raise'`
NotImplementedError
    * If `join != 'left'`

See Also
--------
dict.update : Similar method for dictionaries.
DataFrame.merge : For column(s)-on-column(s) operations.

Examples
--------
>>> df = pd.DataFrame({'A': [1, 2, 3],
...                    'B': [400, 500, 600]})
>>> new_df = pd.DataFrame({'B': [4, 5, 6],
...                        'C': [7, 8, 9]})
>>> df.update(new_df)
>>> df
   A  B
0  1  4
1  2  5
2  3  6

The DataFrame's length does not increase as a result of the update,
only values at matching index/column labels are updated.

>>> df = pd.DataFrame({'A': ['a', 'b', 'c'],
...                    'B': ['x', 'y', 'z']})
>>> new_df = pd.DataFrame({'B': ['d', 'e', 'f', 'g', 'h', 'i']})
>>> df.update(new_df)
>>> df
   A  B
0  a  d
1  b  e
2  c  f

>>> df = pd.DataFrame({'A': ['a', 'b', 'c'],
...                    'B': ['x', 'y', 'z']})
>>> new_df = pd.DataFrame({'B': ['d', 'f']}, index=[0, 2])
>>> df.update(new_df)
>>> df
   A  B
0  a  d
1  b  y
2  c  f

For Series, its name attribute must be set.

>>> df = pd.DataFrame({'A': ['a', 'b', 'c'],
...                    'B': ['x', 'y', 'z']})
>>> new_column = pd.Series(['d', 'e', 'f'], name='B')
>>> df.update(new_column)
>>> df
   A  B
0  a  d
1  b  e
2  c  f

If `other` contains NaNs the corresponding values are not updated
in the original dataframe.

>>> df = pd.DataFrame({'A': [1, 2, 3],
...                    'B': [400., 500., 600.]})
>>> new_df = pd.DataFrame({'B': [4, np.nan, 6]})
>>> df.update(new_df)
>>> df
   A      B
0  1    4.0
1  2  500.0
2  3    6.0
r   r   r  zOnly left join is supported)r  r%  z7The parameter errors must be either 'ignore' or 'raise'Nr%  zData overlaps.r  zDowncasting behavior)messagecategory)r   r   r[  r\  r   r   r   r#   r!   _is_view_after_cow_rulesr%   r  rz  r  r   r   r  r   r   r"  rR  rN   rO   rU  r:  catch_warningsfilterwarningsr+  r?  )r   r  r  r  filter_funcr  r_  r  thatr  	mask_this	mask_thats               r   rS  DataFrame.update"  s   l t+--t$	12* 
 1338U8U8W8Wt$	1:!  6>%&CDD,,VWW%++e$Edjj)<<,,U]];C9$$D:%%D&#D))DJ6W$ %dI %dI9011()9:::D ;D xxzz((*''2* $(9??4#>C  +*- <, +*s   ?I
I	aQ  
        Examples
        --------
        >>> df = pd.DataFrame({'Animal': ['Falcon', 'Falcon',
        ...                               'Parrot', 'Parrot'],
        ...                    'Max Speed': [380., 370., 24., 26.]})
        >>> df
           Animal  Max Speed
        0  Falcon      380.0
        1  Falcon      370.0
        2  Parrot       24.0
        3  Parrot       26.0
        >>> df.groupby(['Animal']).mean()
                Max Speed
        Animal
        Falcon      375.0
        Parrot       25.0

        **Hierarchical Indexes**

        We can groupby different levels of a hierarchical index
        using the `level` parameter:

        >>> arrays = [['Falcon', 'Falcon', 'Parrot', 'Parrot'],
        ...           ['Captive', 'Wild', 'Captive', 'Wild']]
        >>> index = pd.MultiIndex.from_arrays(arrays, names=('Animal', 'Type'))
        >>> df = pd.DataFrame({'Max Speed': [390., 350., 30., 20.]},
        ...                   index=index)
        >>> df
                        Max Speed
        Animal Type
        Falcon Captive      390.0
               Wild         350.0
        Parrot Captive       30.0
               Wild          20.0
        >>> df.groupby(level=0).mean()
                Max Speed
        Animal
        Falcon      370.0
        Parrot       25.0
        >>> df.groupby(level="Type").mean()
                 Max Speed
        Type
        Captive      210.0
        Wild         185.0

        We can also choose to include NA in group keys or not by setting
        `dropna` parameter, the default setting is `True`.

        >>> l = [[1, 2, 3], [1, None, 4], [2, 1, 3], [1, 2, 2]]
        >>> df = pd.DataFrame(l, columns=["a", "b", "c"])

        >>> df.groupby(by=["b"]).sum()
            a   c
        b
        1.0 2   3
        2.0 2   5

        >>> df.groupby(by=["b"], dropna=False).sum()
            a   c
        b
        1.0 2   3
        2.0 2   5
        NaN 1   4

        >>> l = [["a", 12, 12], [None, 12.3, 33.], ["b", 12.3, 123], ["a", 1, 1]]
        >>> df = pd.DataFrame(l, columns=["a", "b", "c"])

        >>> df.groupby(by="a").sum()
            b     c
        a
        a   13.0   13.0
        b   12.3  123.0

        >>> df.groupby(by="a", dropna=False).sum()
            b     c
        a
        a   13.0   13.0
        b   12.3  123.0
        NaN 12.3   33.0

        When using ``.apply()``, use ``group_keys`` to include or exclude the
        group keys. The ``group_keys`` argument defaults to ``True`` (include).

        >>> df = pd.DataFrame({'Animal': ['Falcon', 'Falcon',
        ...                               'Parrot', 'Parrot'],
        ...                    'Max Speed': [380., 370., 24., 26.]})
        >>> df.groupby("Animal", group_keys=True)[['Max Speed']].apply(lambda x: x)
                  Max Speed
        Animal
        Falcon 0      380.0
               1      370.0
        Parrot 2       24.0
               3       26.0

        >>> df.groupby("Animal", group_keys=False)[['Max Speed']].apply(lambda x: x)
           Max Speed
        0      380.0
        1      370.0
        2       24.0
        3       26.0
        r  c	                0   U[         R                  La]  U R                  U5      nUS:X  a#  [        R                  " S[
        [        5       S9  O%[        R                  " S[
        [        5       S9  OSnSSKJn	  Uc  Uc  [        S5      eU	" U UUUUUUUUS9	$ )	Nr   z\DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.r   z^The 'axis' keyword in DataFrame.groupby is deprecated and will be removed in a future version.r   r   z*You have to supply one of 'by' and 'level')	rt  r  r   r  as_indexr  
group_keysr  r  )
r   r  rB  r   r   r  r+   pandas.core.groupby.genericr   r  )
r   r  r   r  r  r  r  r  r  r   s
             r   r  DataFrame.groupbyQ#  s    l s~~%((.DqyC!/1	 ;!/1	 D@=RZHII!

 
	
r   al  
        Return reshaped DataFrame organized by given index / column values.

        Reshape data (produce a "pivot" table) based on column values. Uses
        unique values from specified `index` / `columns` to form axes of the
        resulting DataFrame. This function does not support data
        aggregation, multiple values will result in a MultiIndex in the
        columns. See the :ref:`User Guide <reshaping>` for more on reshaping.

        Parameters
        ----------%s
        columns : str or object or a list of str
            Column to use to make new frame's columns.
        index : str or object or a list of str, optional
            Column to use to make new frame's index. If not given, uses existing index.
        values : str, object or a list of the previous, optional
            Column(s) to use for populating new frame's values. If not
            specified, all remaining columns will be used and the result will
            have hierarchically indexed columns.

        Returns
        -------
        DataFrame
            Returns reshaped DataFrame.

        Raises
        ------
        ValueError:
            When there are any `index`, `columns` combinations with multiple
            values. `DataFrame.pivot_table` when you need to aggregate.

        See Also
        --------
        DataFrame.pivot_table : Generalization of pivot that can handle
            duplicate values for one index/column pair.
        DataFrame.unstack : Pivot based on the index values instead of a
            column.
        wide_to_long : Wide panel to long format. Less flexible but more
            user-friendly than melt.

        Notes
        -----
        For finer-tuned control, see hierarchical indexing documentation along
        with the related stack/unstack methods.

        Reference :ref:`the user guide <reshaping.pivot>` for more examples.

        Examples
        --------
        >>> df = pd.DataFrame({'foo': ['one', 'one', 'one', 'two', 'two',
        ...                            'two'],
        ...                    'bar': ['A', 'B', 'C', 'A', 'B', 'C'],
        ...                    'baz': [1, 2, 3, 4, 5, 6],
        ...                    'zoo': ['x', 'y', 'z', 'q', 'w', 't']})
        >>> df
            foo   bar  baz  zoo
        0   one   A    1    x
        1   one   B    2    y
        2   one   C    3    z
        3   two   A    4    q
        4   two   B    5    w
        5   two   C    6    t

        >>> df.pivot(index='foo', columns='bar', values='baz')
        bar  A   B   C
        foo
        one  1   2   3
        two  4   5   6

        >>> df.pivot(index='foo', columns='bar')['baz']
        bar  A   B   C
        foo
        one  1   2   3
        two  4   5   6

        >>> df.pivot(index='foo', columns='bar', values=['baz', 'zoo'])
              baz       zoo
        bar   A  B  C   A  B  C
        foo
        one   1  2  3   x  y  z
        two   4  5  6   q  w  t

        You could also assign a list of column names or a list of index names.

        >>> df = pd.DataFrame({
        ...        "lev1": [1, 1, 1, 2, 2, 2],
        ...        "lev2": [1, 1, 2, 1, 1, 2],
        ...        "lev3": [1, 2, 1, 2, 1, 2],
        ...        "lev4": [1, 2, 3, 4, 5, 6],
        ...        "values": [0, 1, 2, 3, 4, 5]})
        >>> df
            lev1 lev2 lev3 lev4 values
        0   1    1    1    1    0
        1   1    1    2    2    1
        2   1    2    1    3    2
        3   2    1    2    4    3
        4   2    1    1    5    4
        5   2    2    2    6    5

        >>> df.pivot(index="lev1", columns=["lev2", "lev3"], values="values")
        lev2    1         2
        lev3    1    2    1    2
        lev1
        1     0.0  1.0  2.0  NaN
        2     4.0  3.0  NaN  5.0

        >>> df.pivot(index=["lev1", "lev2"], columns=["lev3"], values="values")
              lev3    1    2
        lev1  lev2
           1     1  0.0  1.0
                 2  2.0  NaN
           2     1  4.0  3.0
                 2  NaN  5.0

        A ValueError is raised if there are any duplicates.

        >>> df = pd.DataFrame({"foo": ['one', 'one', 'two', 'two'],
        ...                    "bar": ['A', 'A', 'B', 'C'],
        ...                    "baz": [1, 2, 3, 4]})
        >>> df
           foo bar  baz
        0  one   A    1
        1  one   A    2
        2  two   B    3
        3  two   C    4

        Notice that the first two rows are the same for our `index`
        and `columns` arguments.

        >>> df.pivot(index='foo', columns='bar', values='baz')
        Traceback (most recent call last):
           ...
        ValueError: Index contains duplicate entries, cannot reshape
        pivot)r   r   c                   SSK Jn  U" XXS9$ )Nr   )r  )r   r   r   )pandas.core.reshape.pivotr  )r   r   r   r   r  s        r   r  DataFrame.pivott$  s    
 	4TGGr   a8  
        Create a spreadsheet-style pivot table as a DataFrame.

        The levels in the pivot table will be stored in MultiIndex objects
        (hierarchical indexes) on the index and columns of the result DataFrame.

        Parameters
        ----------%s
        values : list-like or scalar, optional
            Column or columns to aggregate.
        index : column, Grouper, array, or list of the previous
            Keys to group by on the pivot table index. If a list is passed,
            it can contain any of the other types (except list). If an array is
            passed, it must be the same length as the data and will be used in
            the same manner as column values.
        columns : column, Grouper, array, or list of the previous
            Keys to group by on the pivot table column. If a list is passed,
            it can contain any of the other types (except list). If an array is
            passed, it must be the same length as the data and will be used in
            the same manner as column values.
        aggfunc : function, list of functions, dict, default "mean"
            If a list of functions is passed, the resulting pivot table will have
            hierarchical columns whose top level are the function names
            (inferred from the function objects themselves).
            If a dict is passed, the key is column to aggregate and the value is
            function or list of functions. If ``margin=True``, aggfunc will be
            used to calculate the partial aggregates.
        fill_value : scalar, default None
            Value to replace missing values with (in the resulting pivot table,
            after aggregation).
        margins : bool, default False
            If ``margins=True``, special ``All`` columns and rows
            will be added with partial group aggregates across the categories
            on the rows and columns.
        dropna : bool, default True
            Do not include columns whose entries are all NaN. If True,
            rows with a NaN value in any column will be omitted before
            computing margins.
        margins_name : str, default 'All'
            Name of the row / column that will contain the totals
            when margins is True.
        observed : bool, default False
            This only applies if any of the groupers are Categoricals.
            If True: only show observed values for categorical groupers.
            If False: show all values for categorical groupers.

            .. deprecated:: 2.2.0

                The default value of ``False`` is deprecated and will change to
                ``True`` in a future version of pandas.

        sort : bool, default True
            Specifies if the result should be sorted.

            .. versionadded:: 1.3.0

        Returns
        -------
        DataFrame
            An Excel style pivot table.

        See Also
        --------
        DataFrame.pivot : Pivot without aggregation that can handle
            non-numeric data.
        DataFrame.melt: Unpivot a DataFrame from wide to long format,
            optionally leaving identifiers set.
        wide_to_long : Wide panel to long format. Less flexible but more
            user-friendly than melt.

        Notes
        -----
        Reference :ref:`the user guide <reshaping.pivot>` for more examples.

        Examples
        --------
        >>> df = pd.DataFrame({"A": ["foo", "foo", "foo", "foo", "foo",
        ...                          "bar", "bar", "bar", "bar"],
        ...                    "B": ["one", "one", "one", "two", "two",
        ...                          "one", "one", "two", "two"],
        ...                    "C": ["small", "large", "large", "small",
        ...                          "small", "large", "small", "small",
        ...                          "large"],
        ...                    "D": [1, 2, 2, 3, 3, 4, 5, 6, 7],
        ...                    "E": [2, 4, 5, 5, 6, 6, 8, 9, 9]})
        >>> df
             A    B      C  D  E
        0  foo  one  small  1  2
        1  foo  one  large  2  4
        2  foo  one  large  2  5
        3  foo  two  small  3  5
        4  foo  two  small  3  6
        5  bar  one  large  4  6
        6  bar  one  small  5  8
        7  bar  two  small  6  9
        8  bar  two  large  7  9

        This first example aggregates values by taking the sum.

        >>> table = pd.pivot_table(df, values='D', index=['A', 'B'],
        ...                        columns=['C'], aggfunc="sum")
        >>> table
        C        large  small
        A   B
        bar one    4.0    5.0
            two    7.0    6.0
        foo one    4.0    1.0
            two    NaN    6.0

        We can also fill missing values using the `fill_value` parameter.

        >>> table = pd.pivot_table(df, values='D', index=['A', 'B'],
        ...                        columns=['C'], aggfunc="sum", fill_value=0)
        >>> table
        C        large  small
        A   B
        bar one      4      5
            two      7      6
        foo one      4      1
            two      0      6

        The next example aggregates by taking the mean across multiple columns.

        >>> table = pd.pivot_table(df, values=['D', 'E'], index=['A', 'C'],
        ...                        aggfunc={'D': "mean", 'E': "mean"})
        >>> table
                        D         E
        A   C
        bar large  5.500000  7.500000
            small  5.500000  8.500000
        foo large  2.000000  4.500000
            small  2.333333  4.333333

        We can also calculate multiple types of aggregations for any given
        value column.

        >>> table = pd.pivot_table(df, values=['D', 'E'], index=['A', 'C'],
        ...                        aggfunc={'D': "mean",
        ...                                 'E': ["min", "max", "mean"]})
        >>> table
                          D   E
                       mean max      mean  min
        A   C
        bar large  5.500000   9  7.500000    6
            small  5.500000   9  8.500000    8
        foo large  2.000000   5  4.500000    4
            small  2.333333   6  4.333333    2
        pivot_tablemeanAllc                .    SSK Jn  U" U UUUUUUUUU	U
S9$ )Nr   )r  )
r   r   r   aggfuncr  marginsr  margins_namer  r  )r  r  )r   r   r   r   r  r  r  r  r  r  r  r  s               r   r  DataFrame.pivot_table%  s5     	:!%
 	
r   c                  ^  U(       d  SSK JnJn  U[        R                  Ld-  U[        R                  Ld  T R
                  R                  S:  a"  [        R                  " S[        [        5       S9  U[        R                  L a  SnU[        R                  L a  Sn[        U[        [        45      (       a	  U" T XUS9nOU" T XUS9nOSSK Jn  U[        R                  La  [        S	5      eU[        R                  La  [        S
5      e[        U[        [        45      (       a<  [!        U 4S jU 5       5      (       d"  [!        S U 5       5      (       d  [        S5      e[        U[        [        45      (       d  U/nU V	s/ s H  n	T R
                  R#                  U	5      PM      nn	U" T U5      nUR%                  T SS9$ s  sn	f )a[  
Stack the prescribed level(s) from columns to index.

Return a reshaped DataFrame or Series having a multi-level
index with one or more new inner-most levels compared to the current
DataFrame. The new inner-most levels are created by pivoting the
columns of the current dataframe:

  - if the columns have a single level, the output is a Series;
  - if the columns have multiple levels, the new index
    level(s) is (are) taken from the prescribed level(s) and
    the output is a DataFrame.

Parameters
----------
level : int, str, list, default -1
    Level(s) to stack from the column axis onto the index
    axis, defined as one index or label, or a list of indices
    or labels.
dropna : bool, default True
    Whether to drop rows in the resulting Frame/Series with
    missing values. Stacking a column level onto the index
    axis can create combinations of index and column values
    that are missing from the original dataframe. See Examples
    section.
sort : bool, default True
    Whether to sort the levels of the resulting MultiIndex.
future_stack : bool, default False
    Whether to use the new implementation that will replace the current
    implementation in pandas 3.0. When True, dropna and sort have no impact
    on the result and must remain unspecified. See :ref:`pandas 2.1.0 Release
    notes <whatsnew_210.enhancements.new_stack>` for more details.

Returns
-------
DataFrame or Series
    Stacked dataframe or series.

See Also
--------
DataFrame.unstack : Unstack prescribed level(s) from index axis
     onto column axis.
DataFrame.pivot : Reshape dataframe from long format to wide
     format.
DataFrame.pivot_table : Create a spreadsheet-style pivot table
     as a DataFrame.

Notes
-----
The function is named by analogy with a collection of books
being reorganized from being side by side on a horizontal
position (the columns of the dataframe) to being stacked
vertically on top of each other (in the index of the
dataframe).

Reference :ref:`the user guide <reshaping.stacking>` for more examples.

Examples
--------
**Single level columns**

>>> df_single_level_cols = pd.DataFrame([[0, 1], [2, 3]],
...                                     index=['cat', 'dog'],
...                                     columns=['weight', 'height'])

Stacking a dataframe with a single level column axis returns a Series:

>>> df_single_level_cols
     weight height
cat       0      1
dog       2      3
>>> df_single_level_cols.stack(future_stack=True)
cat  weight    0
     height    1
dog  weight    2
     height    3
dtype: int64

**Multi level columns: simple case**

>>> multicol1 = pd.MultiIndex.from_tuples([('weight', 'kg'),
...                                        ('weight', 'pounds')])
>>> df_multi_level_cols1 = pd.DataFrame([[1, 2], [2, 4]],
...                                     index=['cat', 'dog'],
...                                     columns=multicol1)

Stacking a dataframe with a multi-level column axis:

>>> df_multi_level_cols1
     weight
         kg    pounds
cat       1        2
dog       2        4
>>> df_multi_level_cols1.stack(future_stack=True)
            weight
cat kg           1
    pounds       2
dog kg           2
    pounds       4

**Missing values**

>>> multicol2 = pd.MultiIndex.from_tuples([('weight', 'kg'),
...                                        ('height', 'm')])
>>> df_multi_level_cols2 = pd.DataFrame([[1.0, 2.0], [3.0, 4.0]],
...                                     index=['cat', 'dog'],
...                                     columns=multicol2)

It is common to have missing values when stacking a dataframe
with multi-level columns, as the stacked dataframe typically
has more values than the original dataframe. Missing values
are filled with NaNs:

>>> df_multi_level_cols2
    weight height
        kg      m
cat    1.0    2.0
dog    3.0    4.0
>>> df_multi_level_cols2.stack(future_stack=True)
        weight  height
cat kg     1.0     NaN
    m      NaN     2.0
dog kg     3.0     NaN
    m      NaN     4.0

**Prescribing the level(s) to be stacked**

The first parameter controls which level or levels are stacked:

>>> df_multi_level_cols2.stack(0, future_stack=True)
             kg    m
cat weight  1.0  NaN
    height  NaN  2.0
dog weight  3.0  NaN
    height  NaN  4.0
>>> df_multi_level_cols2.stack([0, 1], future_stack=True)
cat  weight  kg    1.0
     height  m     2.0
dog  weight  kg    3.0
     height  m     4.0
dtype: float64
r   )stackstack_multipler   zThe previous implementation of stack is deprecated and will be removed in a future version of pandas. See the What's New notes for pandas 2.1.0 for details. Specify future_stack=True to adopt the new implementation and silence this warning.r   T)r  r  )stack_v3zdropna must be unspecified with future_stack=True as the new implementation does not introduce rows of NA values. This argument will be removed in a future version of pandas.zCannot specify sort with future_stack=True, this argument will be removed in a future version of pandas. Sort the result using .sort_index instead.c              3  T   >#    U  H  oTR                   R                  ;   v   M     g 7fr   )r   r  )r^  ru  r   s     r   r`  "DataFrame.stack.<locals>.<genexpr>%  s     G#4<<#5#55s   %(c              3  B   #    U  H  n[        U[        5      v   M     g 7fr   )r   rx  )r^  ru  s     r   r`  r  %  s     BESJsC00Es   zTlevel should contain all level names or all level numbers, not a mixture of the two.r  r  )pandas.core.reshape.reshaper  r  r   r  r   rg  r   r   r  r+   r   r.  r  r  r  r:  rm  r  )
r   r  r  r  future_stackr  r  r  r  ru  s
   `         r   r  DataFrame.stack3%  s   j  cnn,s~~-<<''!+G "/1 's~~%%%//'eNtUE<S^^+ N  3>>) +  55$-00GGGGBEBBB 9 
 eeT]33DIJEST\\33C8EEJdE*F""4"88 Ks   %Gc                   U R                   R                  (       dC  U R                   U R                   R                  5          R                  5       n[	        SU 35      e[        U5      (       d  [        U[        5      (       a  U/nOx[        U[        5      (       aX  [        S U 5       5      (       aA  U(       d  [	        S5      e[        U5      [        [        U5      5      :  a  [	        S5      eUnO[	        S5      eU R                  SS9n[        U5      S:X  a  XTS	      R                  5       nOS
 nXS	      R                  U5      nUSS  H2  n	[        XU	   R                  U5      :H  5      (       a  M)  [	        S5      e   [        U V	s0 s H  oXY   R                  5       _M     sn	5      nUR!                  USS9R#                  U5      nU(       a  [%        [        U5      5      Ul        O*U R&                  R)                  UR&                  5      Ul        UR+                  U R                   SS9nUR-                  U SS9$ s  sn	f )u  
Transform each element of a list-like to a row, replicating index values.

Parameters
----------
column : IndexLabel
    Column(s) to explode.
    For multiple columns, specify a non-empty list with each element
    be str or tuple, and all specified columns their list-like data
    on same row of the frame must have matching length.

    .. versionadded:: 1.3.0
        Multi-column explode

ignore_index : bool, default False
    If True, the resulting index will be labeled 0, 1, …, n - 1.

Returns
-------
DataFrame
    Exploded lists to rows of the subset columns;
    index will be duplicated for these rows.

Raises
------
ValueError :
    * If columns of the frame are not unique.
    * If specified columns to explode is empty list.
    * If specified columns to explode have not matching count of
      elements rowwise in the frame.

See Also
--------
DataFrame.unstack : Pivot a level of the (necessarily hierarchical)
    index labels.
DataFrame.melt : Unpivot a DataFrame from wide format to long format.
Series.explode : Explode a DataFrame from list-like columns to long format.

Notes
-----
This routine will explode list-likes including lists, tuples, sets,
Series, and np.ndarray. The result dtype of the subset rows will
be object. Scalars will be returned unchanged, and empty list-likes will
result in a np.nan for that row. In addition, the ordering of rows in the
output will be non-deterministic when exploding sets.

Reference :ref:`the user guide <reshaping.explode>` for more examples.

Examples
--------
>>> df = pd.DataFrame({'A': [[0, 1, 2], 'foo', [], [3, 4]],
...                    'B': 1,
...                    'C': [['a', 'b', 'c'], np.nan, [], ['d', 'e']]})
>>> df
           A  B          C
0  [0, 1, 2]  1  [a, b, c]
1        foo  1        NaN
2         []  1         []
3     [3, 4]  1     [d, e]

Single-column explode.

>>> df.explode('A')
     A  B          C
0    0  1  [a, b, c]
0    1  1  [a, b, c]
0    2  1  [a, b, c]
1  foo  1        NaN
2  NaN  1         []
3    3  1     [d, e]
3    4  1     [d, e]

Multi-column explode.

>>> df.explode(list('AC'))
     A  B    C
0    0  1    a
0    1  1    b
0    2  1    c
1  foo  1  NaN
2  NaN  1  NaN
3    3  1    d
3    4  1    e
z5DataFrame columns must be unique. Duplicate columns: c              3  f   #    U  H'  n[        U5      =(       d    [        U[        5      v   M)     g 7fr   )rF   r   r.  )r^  rq  s     r   r`  $DataFrame.explode.<locals>.<genexpr>i&  s&      .
:@QIaL0Jq%00&s   /1zcolumn must be nonemptyzcolumn must be uniquez/column must be a scalar, tuple, or list thereofT)rK  r   r   c                Z    [        U 5      (       a  [        U 5      S:  a  [        U 5      $ S$ )Nr   r   )rE   r  )r]  s    r   <lambda>#DataFrame.explode.<locals>.<lambda>x&  s"    aSVaZc!fOaOr   Nz)columns must have matching element countsr  Fr  exploder  )r   r  r   r  r  rF   r   r.  r  r:  r  r  re  r  r  r   rK  r  rh   r   rm  r  r  )
r   rd  r  duplicate_colsr   r   r  mylencounts0rq  s
             r   r  DataFrame.explode&  s   r ||%%!\\$,,*A*A*CDKKMNGGWX 
 V
65 9 9hG%%# .
:@.
 +
 +
  !:;;6{SV-- !899GNOO4(w<1
^++-FOE1:&,,U3GQR[71gmmE&::;;$%PQQ ! GDGq25==? 2GDEFq)..v6(V5FL::??6<<8FL5A""4	"::  Es   Ic                @    SSK Jn  U" XX#5      nUR                  U SS9$ )a  
Pivot a level of the (necessarily hierarchical) index labels.

Returns a DataFrame having a new level of column labels whose inner-most level
consists of the pivoted index labels.

If the index is not a MultiIndex, the output will be a Series
(the analogue of stack when the columns are not a MultiIndex).

Parameters
----------
level : int, str, or list of these, default -1 (last level)
    Level(s) of index to unstack, can pass level name.
fill_value : int, str or dict
    Replace NaN with this value if the unstack produces missing values.
sort : bool, default True
    Sort the level(s) in the resulting MultiIndex columns.

Returns
-------
Series or DataFrame

See Also
--------
DataFrame.pivot : Pivot a table based on column values.
DataFrame.stack : Pivot a level of the column labels (inverse operation
    from `unstack`).

Notes
-----
Reference :ref:`the user guide <reshaping.stacking>` for more examples.

Examples
--------
>>> index = pd.MultiIndex.from_tuples([('one', 'a'), ('one', 'b'),
...                                    ('two', 'a'), ('two', 'b')])
>>> s = pd.Series(np.arange(1.0, 5.0), index=index)
>>> s
one  a   1.0
     b   2.0
two  a   3.0
     b   4.0
dtype: float64

>>> s.unstack(level=-1)
     a   b
one  1.0  2.0
two  3.0  4.0

>>> s.unstack(level=0)
   one  two
a  1.0   3.0
b  2.0   4.0

>>> df = s.unstack(level=0)
>>> df.unstack()
one  a  1.0
     b  2.0
two  a  3.0
     b  4.0
dtype: float64
r   )unstackr  r  )r  r  r  )r   r  r  r  r  r  s         r   r  DataFrame.unstack&  s*    ~ 	8j7""4	"::r   r|   zdf.melt()callerr  c           
     <    [        U UUUUUUS9R                  U SS9$ )N)id_vars
value_varsvar_name
value_namera  r  r|   r  )r|   r  )r   r  r  r  r  ra  r  s          r   r|   DataFrame.melt&  s6     !!%
 ,tF,
+	,r   zcaxis : {0 or 'index', 1 or 'columns'}, default 0
    Take difference over rows (0) or columns (1).
a  
        Difference with previous row

        >>> df = pd.DataFrame({'a': [1, 2, 3, 4, 5, 6],
        ...                    'b': [1, 1, 2, 3, 5, 8],
        ...                    'c': [1, 4, 9, 16, 25, 36]})
        >>> df
           a  b   c
        0  1  1   1
        1  2  1   4
        2  3  2   9
        3  4  3  16
        4  5  5  25
        5  6  8  36

        >>> df.diff()
             a    b     c
        0  NaN  NaN   NaN
        1  1.0  0.0   3.0
        2  1.0  1.0   5.0
        3  1.0  1.0   7.0
        4  1.0  2.0   9.0
        5  1.0  3.0  11.0

        Difference with previous column

        >>> df.diff(axis=1)
            a  b   c
        0 NaN  0   0
        1 NaN -1   3
        2 NaN -1   7
        3 NaN -1  13
        4 NaN  0  20
        5 NaN  2  28

        Difference with 3rd previous row

        >>> df.diff(periods=3)
             a    b     c
        0  NaN  NaN   NaN
        1  NaN  NaN   NaN
        2  NaN  NaN   NaN
        3  3.0  2.0  15.0
        4  3.0  4.0  21.0
        5  3.0  6.0  27.0

        Difference with following row

        >>> df.diff(periods=-1)
             a    b     c
        0 -1.0  0.0  -3.0
        1 -1.0 -1.0  -5.0
        2 -1.0 -1.0  -7.0
        3 -1.0 -2.0  -9.0
        4 -1.0 -3.0 -11.0
        5  NaN  NaN   NaN

        Overflow in input dtype

        >>> df = pd.DataFrame({'a': [1, 0]}, dtype=np.uint8)
        >>> df.diff()
               a
        0    NaN
        1  255.0)r   r  other_klassr  c                   [         R                  " U5      (       d;  [        U5      (       a  UR                  5       (       d  [        S5      e[	        U5      nU R                  U5      nUS:X  a  US:w  a  X R                  XS9-
  $ SnU R                  R                  US9nU R                  X3R                  S9nUR                  U S5      $ )Nzperiods must be an integerr   r   r  )rX  r   r  )r   rB   r?   r  rx  rB  r@  r   r  r   r   r  )r   r=  r   r  rL  s        r   r  DataFrame.diff&  s    T ~~g&&W%%'*<*<*>*> !=>>'lG$$T*19!| jjj<<<D99>>G>,++H==+I""400r   c                @    Uc  U nX1   $ UR                   S:X  a  U$ X1   $ )z
Sub-classes to define. Return a sliced object.

Parameters
----------
key : string / list of selections
ndim : {1, 2}
    requested ndim of result
subset : object, default None
    subset to act on
r   r  )r   r  r  r  s       r   _gotitemDataFrame._gotitemC'  s5    " >F
 {	 [[AM {r   a!  
    See Also
    --------
    DataFrame.apply : Perform any type of operations.
    DataFrame.transform : Perform transformation type operations.
    pandas.DataFrame.groupby : Perform operations over groups.
    pandas.DataFrame.resample : Perform operations over resampled bins.
    pandas.DataFrame.rolling : Perform operations over rolling window.
    pandas.DataFrame.expanding : Perform operations over expanding window.
    pandas.core.window.ewm.ExponentialMovingWindow : Perform operation over exponential
        weighted window.
    a  
    Examples
    --------
    >>> df = pd.DataFrame([[1, 2, 3],
    ...                    [4, 5, 6],
    ...                    [7, 8, 9],
    ...                    [np.nan, np.nan, np.nan]],
    ...                   columns=['A', 'B', 'C'])

    Aggregate these functions over the rows.

    >>> df.agg(['sum', 'min'])
            A     B     C
    sum  12.0  15.0  18.0
    min   1.0   2.0   3.0

    Different aggregations per column.

    >>> df.agg({'A' : ['sum', 'min'], 'B' : ['min', 'max']})
            A    B
    sum  12.0  NaN
    min   1.0  2.0
    max   NaN  8.0

    Aggregate different functions over the columns and rename the index of the resulting
    DataFrame.

    >>> df.agg(x=('A', 'max'), y=('B', 'min'), z=('C', 'mean'))
         A    B    C
    x  7.0  NaN  NaN
    y  NaN  2.0  NaN
    z  NaN  NaN  6.0

    Aggregate over the columns.

    >>> df.agg("mean", axis="columns")
    0    2.0
    1    5.0
    2    8.0
    3    NaN
    dtype: float64
    	aggregate)r   r   see_alsor  c                |    SSK Jn  U R                  U5      nU" XX#US9nUR                  5       n[	        Xq40 UD6nU$ Nr   frame_apply)r  r   r  r  )pandas.core.applyr  rB  aggrV   r   r  r   r  r  r  r  r  s           r   r  DataFrame.aggregate'  sD     	2$$T*tvN/GGr   	transform)r   r   c                p    SSK Jn  U" XX#US9nUR                  5       n[        U[        5      (       d   eU$ r  )r  r  r  r   r   r  s           r   r  DataFrame.transform'  s8     	2tvN&),,,,r   c	                h    SSK Jn
  U
" U UUUUUUUUU	S9
nUR                  5       R                  U SS9$ )at  
Apply a function along an axis of the DataFrame.

Objects passed to the function are Series objects whose index is
either the DataFrame's index (``axis=0``) or the DataFrame's columns
(``axis=1``). By default (``result_type=None``), the final return type
is inferred from the return type of the applied function. Otherwise,
it depends on the `result_type` argument.

Parameters
----------
func : function
    Function to apply to each column or row.
axis : {0 or 'index', 1 or 'columns'}, default 0
    Axis along which the function is applied:

    * 0 or 'index': apply function to each column.
    * 1 or 'columns': apply function to each row.

raw : bool, default False
    Determines if row or column is passed as a Series or ndarray object:

    * ``False`` : passes each row or column as a Series to the
      function.
    * ``True`` : the passed function will receive ndarray objects
      instead.
      If you are just applying a NumPy reduction function this will
      achieve much better performance.

result_type : {'expand', 'reduce', 'broadcast', None}, default None
    These only act when ``axis=1`` (columns):

    * 'expand' : list-like results will be turned into columns.
    * 'reduce' : returns a Series if possible rather than expanding
      list-like results. This is the opposite of 'expand'.
    * 'broadcast' : results will be broadcast to the original shape
      of the DataFrame, the original index and columns will be
      retained.

    The default behaviour (None) depends on the return value of the
    applied function: list-like results will be returned as a Series
    of those. However if the apply function returns a Series these
    are expanded to columns.
args : tuple
    Positional arguments to pass to `func` in addition to the
    array/series.
by_row : False or "compat", default "compat"
    Only has an effect when ``func`` is a listlike or dictlike of funcs
    and the func isn't a string.
    If "compat", will if possible first translate the func into pandas
    methods (e.g. ``Series().apply(np.sum)`` will be translated to
    ``Series().sum()``). If that doesn't work, will try call to apply again with
    ``by_row=True`` and if that fails, will call apply again with
    ``by_row=False`` (backward compatible).
    If False, the funcs will be passed the whole Series at once.

    .. versionadded:: 2.1.0

engine : {'python', 'numba'}, default 'python'
    Choose between the python (default) engine or the numba engine in apply.

    The numba engine will attempt to JIT compile the passed function,
    which may result in speedups for large DataFrames.
    It also supports the following engine_kwargs :

    - nopython (compile the function in nopython mode)
    - nogil (release the GIL inside the JIT compiled function)
    - parallel (try to apply the function in parallel over the DataFrame)

      Note: Due to limitations within numba/how pandas interfaces with numba,
      you should only use this if raw=True

    Note: The numba compiler only supports a subset of
    valid Python/numpy operations.

    Please read more about the `supported python features
    <https://numba.pydata.org/numba-doc/dev/reference/pysupported.html>`_
    and `supported numpy features
    <https://numba.pydata.org/numba-doc/dev/reference/numpysupported.html>`_
    in numba to learn what you can or cannot use in the passed function.

    .. versionadded:: 2.2.0

engine_kwargs : dict
    Pass keyword arguments to the engine.
    This is currently only used by the numba engine,
    see the documentation for the engine argument for more information.
**kwargs
    Additional keyword arguments to pass as keywords arguments to
    `func`.

Returns
-------
Series or DataFrame
    Result of applying ``func`` along the given axis of the
    DataFrame.

See Also
--------
DataFrame.map: For elementwise operations.
DataFrame.aggregate: Only perform aggregating type operations.
DataFrame.transform: Only perform transforming type operations.

Notes
-----
Functions that mutate the passed object can produce unexpected
behavior or errors and are not supported. See :ref:`gotchas.udf-mutation`
for more details.

Examples
--------
>>> df = pd.DataFrame([[4, 9]] * 3, columns=['A', 'B'])
>>> df
   A  B
0  4  9
1  4  9
2  4  9

Using a numpy universal function (in this case the same as
``np.sqrt(df)``):

>>> df.apply(np.sqrt)
     A    B
0  2.0  3.0
1  2.0  3.0
2  2.0  3.0

Using a reducing function on either axis

>>> df.apply(np.sum, axis=0)
A    12
B    27
dtype: int64

>>> df.apply(np.sum, axis=1)
0    13
1    13
2    13
dtype: int64

Returning a list-like will result in a Series

>>> df.apply(lambda x: [1, 2], axis=1)
0    [1, 2]
1    [1, 2]
2    [1, 2]
dtype: object

Passing ``result_type='expand'`` will expand list-like results
to columns of a Dataframe

>>> df.apply(lambda x: [1, 2], axis=1, result_type='expand')
   0  1
0  1  2
1  1  2
2  1  2

Returning a Series inside the function is similar to passing
``result_type='expand'``. The resulting column names
will be the Series index.

>>> df.apply(lambda x: pd.Series([1, 2], index=['foo', 'bar']), axis=1)
   foo  bar
0    1    2
1    1    2
2    1    2

Passing ``result_type='broadcast'`` will ensure the same shape
result, whether list-like or scalar is returned by the function,
and broadcast it along the axis. The resulting column names will
be the originals.

>>> df.apply(lambda x: [1, 2], axis=1, result_type='broadcast')
   A  B
0  1  2
1  1  2
2  1  2
r   r  )	r  r   rawresult_typeby_rowr  r  r  r  r  r  )r  r  r  r  )r   r  r   r  r  r  r  r  r  r  r  r  s               r   r  DataFrame.apply'  sN    | 	2#'
 xxz&&tG&<<r   c                   ^^ TS;  a  [        S[        T5       35      eU R                  (       a  U R                  5       $ [        R
                  " T40 UD6mUU4S jnU R                  U5      R                  U S5      $ )a  
Apply a function to a Dataframe elementwise.

.. versionadded:: 2.1.0

   DataFrame.applymap was deprecated and renamed to DataFrame.map.

This method applies a function that accepts and returns a scalar
to every element of a DataFrame.

Parameters
----------
func : callable
    Python function, returns a single value from a single value.
na_action : {None, 'ignore'}, default None
    If 'ignore', propagate NaN values, without passing them to func.
**kwargs
    Additional keyword arguments to pass as keywords arguments to
    `func`.

Returns
-------
DataFrame
    Transformed DataFrame.

See Also
--------
DataFrame.apply : Apply a function along input axis of DataFrame.
DataFrame.replace: Replace values given in `to_replace` with `value`.
Series.map : Apply a function elementwise on a Series.

Examples
--------
>>> df = pd.DataFrame([[1, 2.12], [3.356, 4.567]])
>>> df
       0      1
0  1.000  2.120
1  3.356  4.567

>>> df.map(lambda x: len(str(x)))
   0  1
0  3  4
1  5  5

Like Series.map, NA values can be ignored:

>>> df_copy = df.copy()
>>> df_copy.iloc[0, 0] = pd.NA
>>> df_copy.map(lambda x: len(str(x)), na_action='ignore')
     0  1
0  NaN  4
1  5.0  5

It is also possible to use `map` with functions that are not
`lambda` functions:

>>> df.map(round, ndigits=1)
     0    1
0  1.0  2.1
1  3.4  4.6

Note that a vectorized version of `func` often exists, which will
be much faster. You could square each number elementwise.

>>> df.map(lambda x: x**2)
           0          1
0   1.000000   4.494400
1  11.262736  20.857489

But it's better to avoid map in that case.

>>> df ** 2
           0          1
0   1.000000   4.494400
1  11.262736  20.857489
>   Nr  z(na_action must be 'ignore' or None. Got c                $   > U R                  TTS9$ )N)	na_action)_map_values)r]  r  r  s    r   r  DataFrame.map.<locals>.infer(  s    ===;;r   r  )r  reprrA  r   	functoolspartialr  r  )r   r  r  r  r  s    ``  r   r  DataFrame.map(  sx    ^ ,,:4	?:KL  ::99;  00	< zz% --dE::r   c                p    [         R                  " S[        [        5       S9  U R                  " U4SU0UD6$ )a  
Apply a function to a Dataframe elementwise.

.. deprecated:: 2.1.0

   DataFrame.applymap has been deprecated. Use DataFrame.map instead.

This method applies a function that accepts and returns a scalar
to every element of a DataFrame.

Parameters
----------
func : callable
    Python function, returns a single value from a single value.
na_action : {None, 'ignore'}, default None
    If 'ignore', propagate NaN values, without passing them to func.
**kwargs
    Additional keyword arguments to pass as keywords arguments to
    `func`.

Returns
-------
DataFrame
    Transformed DataFrame.

See Also
--------
DataFrame.apply : Apply a function along input axis of DataFrame.
DataFrame.map : Apply a function along input axis of DataFrame.
DataFrame.replace: Replace values given in `to_replace` with `value`.

Examples
--------
>>> df = pd.DataFrame([[1, 2.12], [3.356, 4.567]])
>>> df
       0      1
0  1.000  2.120
1  3.356  4.567

>>> df.map(lambda x: len(str(x)))
   0  1
0  3  4
1  5  5
zBDataFrame.applymap has been deprecated. Use DataFrame.map instead.r   r  )r   r   r  r+   r  )r   r  r  r  s       r   applymapDataFrame.applymap(  s8    ^ 	P')	

 xx<	<V<<r   c                   [        U[        [        45      (       a  [        U[        5      (       a  U(       d  [        S5      e[        U5      nUR                  c  U(       d  [        S5      e[        UR                  /[        U R                  [        5      (       a  U R                  R                  OU R                  R                  S9nUR                  5       R                  nUR                  SS9R                  UR                  SS9nO[        U[        5      (       an  U(       d  Of[        US   [        5      (       dN  [        U5      nU R                  R                  b,  U(       d%  U R                  R                  UR                  l        SSKJn  [        U[        ["        45      (       a  U /UQnOX/nU" UUUUS9n	U	R%                  U S	S
9$ )Nz+Can only append a dict if ignore_index=TruezICan only append a Series if ignore_index=True or if the Series has a namer  Fr  r   r;  )r  ry  r  r  r  )r   r}   r  r  r   rf   r   rk   r  to_framerQ  infer_objectsrename_axisr  r   rC  r<  r.  r  )
r   r  r  ry  r  r   row_dfr<  	to_concatr  s
             r   r  DataFrame._append)  s    efd^,,%&&##$QRRuzz!,2 
 djj*55 ZZ%%ZZ__	E ^^%''F ((e(4@@% A E t$$a)44!%(::??.|'+zzEKK$5edE]++II%-	
 ""4"99r   c                j   SSK Jn  SSKJn	  [	        U[
        5      (       a/  UR                  c  [        S5      e[        UR                  U05      n[	        U[        5      (       a$  US:X  a  U	" U UUUXE4UUS9$ U	" U UUUUSL SXE4UUS	9	$ Ub  [        S
5      eU(       d  U(       a  [        S5      e[        SU 5      /[        U5      -   n
[        S U
 5       5      nU(       a4  US:X  a$  U" U
SSSUS9nUR                  U R                  SS9$ U" U
SUSUS9$ U
S   nU
SS  H  nU	" UUUSSUS9nM     U$ )a  
Join columns of another DataFrame.

Join columns with `other` DataFrame either on index or on a key
column. Efficiently join multiple DataFrame objects by index at once by
passing a list.

Parameters
----------
other : DataFrame, Series, or a list containing any combination of them
    Index should be similar to one of the columns in this one. If a
    Series is passed, its name attribute must be set, and that will be
    used as the column name in the resulting joined DataFrame.
on : str, list of str, or array-like, optional
    Column or index level name(s) in the caller to join on the index
    in `other`, otherwise joins index-on-index. If multiple
    values given, the `other` DataFrame must have a MultiIndex. Can
    pass an array as the join key if it is not already contained in
    the calling DataFrame. Like an Excel VLOOKUP operation.
how : {'left', 'right', 'outer', 'inner', 'cross'}, default 'left'
    How to handle the operation of the two objects.

    * left: use calling frame's index (or column if on is specified)
    * right: use `other`'s index.
    * outer: form union of calling frame's index (or column if on is
      specified) with `other`'s index, and sort it lexicographically.
    * inner: form intersection of calling frame's index (or column if
      on is specified) with `other`'s index, preserving the order
      of the calling's one.
    * cross: creates the cartesian product from both frames, preserves the order
      of the left keys.
lsuffix : str, default ''
    Suffix to use from left frame's overlapping columns.
rsuffix : str, default ''
    Suffix to use from right frame's overlapping columns.
sort : bool, default False
    Order result DataFrame lexicographically by the join key. If False,
    the order of the join key depends on the join type (how keyword).
validate : str, optional
    If specified, checks if join is of specified type.

    * "one_to_one" or "1:1": check if join keys are unique in both left
      and right datasets.
    * "one_to_many" or "1:m": check if join keys are unique in left dataset.
    * "many_to_one" or "m:1": check if join keys are unique in right dataset.
    * "many_to_many" or "m:m": allowed, but does not result in checks.

    .. versionadded:: 1.5.0

Returns
-------
DataFrame
    A dataframe containing columns from both the caller and `other`.

See Also
--------
DataFrame.merge : For column(s)-on-column(s) operations.

Notes
-----
Parameters `on`, `lsuffix`, and `rsuffix` are not supported when
passing a list of `DataFrame` objects.

Examples
--------
>>> df = pd.DataFrame({'key': ['K0', 'K1', 'K2', 'K3', 'K4', 'K5'],
...                    'A': ['A0', 'A1', 'A2', 'A3', 'A4', 'A5']})

>>> df
  key   A
0  K0  A0
1  K1  A1
2  K2  A2
3  K3  A3
4  K4  A4
5  K5  A5

>>> other = pd.DataFrame({'key': ['K0', 'K1', 'K2'],
...                       'B': ['B0', 'B1', 'B2']})

>>> other
  key   B
0  K0  B0
1  K1  B1
2  K2  B2

Join DataFrames using their indexes.

>>> df.join(other, lsuffix='_caller', rsuffix='_other')
  key_caller   A key_other    B
0         K0  A0        K0   B0
1         K1  A1        K1   B1
2         K2  A2        K2   B2
3         K3  A3       NaN  NaN
4         K4  A4       NaN  NaN
5         K5  A5       NaN  NaN

If we want to join using the key columns, we need to set key to be
the index in both `df` and `other`. The joined DataFrame will have
key as its index.

>>> df.set_index('key').join(other.set_index('key'))
      A    B
key
K0   A0   B0
K1   A1   B1
K2   A2   B2
K3   A3  NaN
K4   A4  NaN
K5   A5  NaN

Another option to join using the key columns is to use the `on`
parameter. DataFrame.join always uses `other`'s index but we can use
any column in `df`. This method preserves the original DataFrame's
index in the result.

>>> df.join(other.set_index('key'), on='key')
  key   A    B
0  K0  A0   B0
1  K1  A1   B1
2  K2  A2   B2
3  K3  A3  NaN
4  K4  A4  NaN
5  K5  A5  NaN

Using non-unique key values shows how they are matched.

>>> df = pd.DataFrame({'key': ['K0', 'K1', 'K1', 'K3', 'K0', 'K1'],
...                    'A': ['A0', 'A1', 'A2', 'A3', 'A4', 'A5']})

>>> df
  key   A
0  K0  A0
1  K1  A1
2  K1  A2
3  K3  A3
4  K0  A4
5  K1  A5

>>> df.join(other.set_index('key'), on='key', validate='m:1')
  key   A    B
0  K0  A0   B0
1  K1  A1   B1
2  K1  A2   B1
3  K3  A3  NaN
4  K0  A4   B0
5  K1  A5   B1
r   r;  mergeNzOther Series must have a namecross)r  onsuffixesr  validateT)left_onr  
left_indexright_indexr  r  r  z?Joining multiple DataFrames only supported for joining on indexz7Suffixes not supported when joining multiple DataFramesDataFrame | Seriesc              3  L   #    U  H  oR                   R                  v   M     g 7fr   )r   r  )r^  r   s     r   r`  !DataFrame.join.<locals>.<genexpr>!*  s     A&BXX//&s   "$r  r   r  )r   r  ry  r  Fr  )r  r  r  r  )rC  r<  pandas.core.reshape.merger  r   r}   r   r  r   r   r  r:  r  r   )r   r  r  r  lsuffixrsuffixr  r  r<  r  frames
can_concatr  joinedr_  s                  r   r  DataFrame.joinT)  s   | 	63eV$$zz! !@AAuzz512EeY''g~%/%  : !+!
 
 ~ U  ' M  /67$u+EFA&AAJ &= QWtRVC ;;tzz;>>!QS4d  AYF# $% $ Mr   r   )indentsc                2    SSK Jn  U" U UUUUUUUUU	U
UUS9$ )Nr   r  )r  r  r  right_onr  r  r  r  r   	indicatorr  )r   r  )r   r  r  r  r  r)  r  r  r  r  r   r*  r  r  s                 r   r  DataFrame.merge=*  s;    " 	4!#
 	
r   c                   ^ SSK Jn  SU4S jjnSS jm[        R                  " X#5        [	        U[
        [        45      (       a  [	        U[        5      (       a&  UR                  R                  (       d  [        S5      e[        U5      (       a0  [        S UR                  5        5       5      (       d  [        S5      e[        U" X5      5      nOd[        U5      (       aI  U R                   R#                  U[%        5       S9nU R'                  XwR(                  S	9R+                  U S
S9$ [        S5      eUbG  [-        U5      S:  a8  U R/                  U" USS9U R                  U R0                  S9R+                  U S
S9$ U R3                  SS9$ )a  
Round a DataFrame to a variable number of decimal places.

Parameters
----------
decimals : int, dict, Series
    Number of decimal places to round each column to. If an int is
    given, round each column to the same number of places.
    Otherwise dict and Series round to variable numbers of places.
    Column names should be in the keys if `decimals` is a
    dict-like, or in the index if `decimals` is a Series. Any
    columns not included in `decimals` will be left as is. Elements
    of `decimals` which are not columns of the input will be
    ignored.
*args
    Additional keywords have no effect but might be accepted for
    compatibility with numpy.
**kwargs
    Additional keywords have no effect but might be accepted for
    compatibility with numpy.

Returns
-------
DataFrame
    A DataFrame with the affected columns rounded to the specified
    number of decimal places.

See Also
--------
numpy.around : Round a numpy array to the given number of decimals.
Series.round : Round a Series to the given number of decimals.

Examples
--------
>>> df = pd.DataFrame([(.21, .32), (.01, .67), (.66, .03), (.21, .18)],
...                   columns=['dogs', 'cats'])
>>> df
    dogs  cats
0  0.21  0.32
1  0.01  0.67
2  0.66  0.03
3  0.21  0.18

By providing an integer each column is rounded to the same number
of decimal places

>>> df.round(1)
    dogs  cats
0   0.2   0.3
1   0.0   0.7
2   0.7   0.0
3   0.2   0.2

With a dict, the number of places for specific columns can be
specified with the column names as key and the number of decimal
places as value

>>> df.round({'dogs': 1, 'cats': 0})
    dogs  cats
0   0.2   0.0
1   0.0   1.0
2   0.7   0.0
3   0.2   0.0

Using a Series, the number of places for specific columns can be
specified with the column names as index and the number of
decimal places as value

>>> decimals = pd.Series([0, 1], index=['cats', 'dogs'])
>>> df.round(decimals)
    dogs  cats
0   0.2   0.0
1   0.0   1.0
2   0.7   0.0
3   0.2   0.0
r   r;  c              3     >#    U R                  5        H  u  p# T" X1U   5      v   M     g ! [         a    Uv    M)  f = f7fr   )r  rT  )r   decimalsr_  r  _series_rounds       r   _dict_round$DataFrame.round.<locals>._dict_round*  sA     XXZ	'sm<< (   Js    A,A>A>Ac                    [        U R                  5      (       d  [        U R                  5      (       a  U R                  U5      $ U $ r   )rC   r   r@   round)r   r.  s     r   r/  &DataFrame.round.<locals>._series_round*  s3    		**nSYY.G.Gyy**Jr   z Index of decimals must be uniquec              3  <   #    U  H  u  p[        U5      v   M     g 7fr   )rB   )r^  r  rq  s      r   r`  "DataFrame.round.<locals>.<genexpr>*  s      22Bha
5!!2Bs   z#Values in decimals must be integers)r.  r  r   r3  r  z4decimals must be an integer, a dict-like or a Seriesr   r  r   Fr   )r   r   )r   r}   r.  rx  rI  r}   )rC  r<  r  validate_roundr   r  r}   r   r  r  r>   r:  r  r  r  rB   r   r3  r   r   r   r  r  r   r   r   )	r   r.  r  r  r<  r0  new_colsr  r/  s	           @r   r3  DataFrame.round`*  sn   ^ 	6		
 	$'hv//(F++HNN4L4L !CDDH%%c 22:..2B2 / /   EFFK78H!! iioo!-/ & G --gLL-IVVW W   RSSCMA$5$$xa(

DLL % l4l01 99%9((r   c                   U(       a  U R                  5       OU nUR                  nUR                  5       nUR                  [        [
        R                  SS9nUS:X  a  [        R                  " XrS9nGOCUS:X  a  [        R                  " XrS9nGO'US:X  d  [        U5      (       Ga  Uc  SnUR                  n[        R                  " U5      n	[        U5      n
[
        R                  " X4[        S9n[
        R                   " U5      n[#        U5       H  u  p[#        U5       H{  u  pX:  a  M  X   X   -  nUR%                  5       U:  a  [
        R                  nO5X:X  a  S	nO-UR'                  5       (       d  U	" UU   UU   5      nOU	" X5      nUXU4'   UXU4'   M}     M     O[)        S
U S35      eU R+                  XUSS9nUR-                  U SS9$ )aZ  
Compute pairwise correlation of columns, excluding NA/null values.

Parameters
----------
method : {'pearson', 'kendall', 'spearman'} or callable
    Method of correlation:

    * pearson : standard correlation coefficient
    * kendall : Kendall Tau correlation coefficient
    * spearman : Spearman rank correlation
    * callable: callable with input two 1d ndarrays
        and returning a float. Note that the returned matrix from corr
        will have 1 along the diagonals and will be symmetric
        regardless of the callable's behavior.
min_periods : int, optional
    Minimum number of observations required per pair of columns
    to have a valid result. Currently only available for Pearson
    and Spearman correlation.
numeric_only : bool, default False
    Include only `float`, `int` or `boolean` data.

    .. versionadded:: 1.5.0

    .. versionchanged:: 2.0.0
        The default value of ``numeric_only`` is now ``False``.

Returns
-------
DataFrame
    Correlation matrix.

See Also
--------
DataFrame.corrwith : Compute pairwise correlation with another
    DataFrame or Series.
Series.corr : Compute the correlation between two Series.

Notes
-----
Pearson, Kendall and Spearman correlation are currently computed using pairwise complete observations.

* `Pearson correlation coefficient <https://en.wikipedia.org/wiki/Pearson_correlation_coefficient>`_
* `Kendall rank correlation coefficient <https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient>`_
* `Spearman's rank correlation coefficient <https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient>`_

Examples
--------
>>> def histogram_intersection(a, b):
...     v = np.minimum(a, b).sum().round(decimals=1)
...     return v
>>> df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
...                   columns=['dogs', 'cats'])
>>> df.corr(method=histogram_intersection)
      dogs  cats
dogs   1.0   0.3
cats   0.3   1.0

>>> df = pd.DataFrame([(1, 1), (2, np.nan), (np.nan, 3), (4, 4)],
...                   columns=['dogs', 'cats'])
>>> df.corr(min_periods=3)
      dogs  cats
dogs   1.0   NaN
cats   NaN   1.0
Fr   r  r   pearson)minpspearmankendallr   r  g      ?zHmethod must be either 'pearson', 'spearman', 'kendall', or a callable, 'z' was suppliedr
  corrr  )_get_numeric_datar   r   r  r  r  r  libalgosnancorrnancorr_spearmancallablerQ  rR   get_corr_funcr  rA  isfiniter  r  r:  r  r   r  )r   r  min_periodsnumeric_onlyr  r  rO  matcorrelcorrfKr  r  acr  bcvalidrq  r  s                      r   r@  DataFrame.corr*  s   N ,8t%%'T||iikmm%"&&umEY%%c<Fz!..sEFy HV$4$4"%%C((0ED	AXXqfE2F;;s#D"3&s^EAu  Gdg-Eyy{[0FF"YY[[!"U)RY7!"M#$Fa4L#$Fa4L , (" 8>+  ""6d"O""4"77r   c                   U(       a  U R                  5       OU nUR                  nUR                  5       nUR                  [        [
        R                  SS9n[        U5      R                  5       (       a  Uba  U[        U5      :  aR  [
        R                  " UR                  S   UR                  S   45      nUR                  [
        R                  5        O[
        R                  " UR                  US9nUR                  [        U5      [        U5      45      nO[         R"                  " USUS9nU R%                  XUSS9n	U	R'                  U SS	9$ )
a  
Compute pairwise covariance of columns, excluding NA/null values.

Compute the pairwise covariance among the series of a DataFrame.
The returned data frame is the `covariance matrix
<https://en.wikipedia.org/wiki/Covariance_matrix>`__ of the columns
of the DataFrame.

Both NA and null values are automatically excluded from the
calculation. (See the note below about bias from missing values.)
A threshold can be set for the minimum number of
observations for each value created. Comparisons with observations
below this threshold will be returned as ``NaN``.

This method is generally used for the analysis of time series data to
understand the relationship between different measures
across time.

Parameters
----------
min_periods : int, optional
    Minimum number of observations required per pair of columns
    to have a valid result.

ddof : int, default 1
    Delta degrees of freedom.  The divisor used in calculations
    is ``N - ddof``, where ``N`` represents the number of elements.
    This argument is applicable only when no ``nan`` is in the dataframe.

numeric_only : bool, default False
    Include only `float`, `int` or `boolean` data.

    .. versionadded:: 1.5.0

    .. versionchanged:: 2.0.0
        The default value of ``numeric_only`` is now ``False``.

Returns
-------
DataFrame
    The covariance matrix of the series of the DataFrame.

See Also
--------
Series.cov : Compute covariance with another Series.
core.window.ewm.ExponentialMovingWindow.cov : Exponential weighted sample
    covariance.
core.window.expanding.Expanding.cov : Expanding sample covariance.
core.window.rolling.Rolling.cov : Rolling sample covariance.

Notes
-----
Returns the covariance matrix of the DataFrame's time series.
The covariance is normalized by N-ddof.

For DataFrames that have Series that are missing data (assuming that
data is `missing at random
<https://en.wikipedia.org/wiki/Missing_data#Missing_at_random>`__)
the returned covariance matrix will be an unbiased estimate
of the variance and covariance between the member Series.

However, for many applications this estimate may not be acceptable
because the estimate covariance matrix is not guaranteed to be positive
semi-definite. This could lead to estimate correlations having
absolute values which are greater than one, and/or a non-invertible
covariance matrix. See `Estimation of covariance matrices
<https://en.wikipedia.org/w/index.php?title=Estimation_of_covariance_
matrices>`__ for more details.

Examples
--------
>>> df = pd.DataFrame([(1, 2), (0, 3), (2, 0), (1, 1)],
...                   columns=['dogs', 'cats'])
>>> df.cov()
          dogs      cats
dogs  0.666667 -1.000000
cats -1.000000  1.666667

>>> np.random.seed(42)
>>> df = pd.DataFrame(np.random.randn(1000, 5),
...                   columns=['a', 'b', 'c', 'd', 'e'])
>>> df.cov()
          a         b         c         d         e
a  0.998438 -0.020161  0.059277 -0.008943  0.014144
b -0.020161  1.059352 -0.008543 -0.024738  0.009826
c  0.059277 -0.008543  1.010670 -0.001486 -0.000271
d -0.008943 -0.024738 -0.001486  0.921297 -0.013692
e  0.014144  0.009826 -0.000271 -0.013692  0.977795

**Minimum number of periods**

This method also supports an optional ``min_periods`` keyword
that specifies the required minimum number of non-NA observations for
each column pair in order to have a valid result:

>>> np.random.seed(42)
>>> df = pd.DataFrame(np.random.randn(20, 3),
...                   columns=['a', 'b', 'c'])
>>> df.loc[df.index[:5], 'a'] = np.nan
>>> df.loc[df.index[5:10], 'b'] = np.nan
>>> df.cov(min_periods=12)
          a         b         c
a  0.316741       NaN -0.150812
b       NaN  1.248003  0.191417
c -0.150812  0.191417  0.895202
Fr;  r   )ddofT)covr=  r
  rT  r  )rA  r   r   r  r  r  r  rO   r:  r  rA  rC  fillrT  rQ  rP  rB  rC  r   r  )
r   rH  rS  rI  r  r  rO  rJ  base_covr  s
             r   rT  DataFrame.covQ+  s
   ` ,8t%%'T||iikmm%"&&umE:>>&;S+A88SYYq\399Q<$@Abff%66#%%d3''TCI(>?H''KHH""85"Q""4"66r   c           	       ^^ U R                  U5      nU(       a  U R                  5       OU n[        T[        5      (       a  UR	                  UU4S jUS9$ U(       a  TR                  5       mUR                  TSSS9u  pxUS:X  a  UR                  nUR                  nTS:X  az  XxS-  -   nXS-  -   nXwR                  US	9-
  n	XR                  US	9-
  n
X-  R                  5       nUR                  5       S-
  UR                  US	9-  UR                  US	9-  nX-  nOTS
;   d  [        T5      (       a^  U4S jnU R                  [        U[        UR                  R                  UR                  R                  5      5      UR                   SS9nO[#        ST S35      eU(       d  US:X  a  SOSnUR%                  U5      R'                  TR%                  U5      5      nUR)                  UR*                  5      n[-        U5      S:  a4  UR/                  [        [0        R2                  /[-        U5      -  US95      nU$ )a]  
Compute pairwise correlation.

Pairwise correlation is computed between rows or columns of
DataFrame with rows or columns of Series or DataFrame. DataFrames
are first aligned along both axes before computing the
correlations.

Parameters
----------
other : DataFrame, Series
    Object with which to compute correlations.
axis : {0 or 'index', 1 or 'columns'}, default 0
    The axis to use. 0 or 'index' to compute row-wise, 1 or 'columns' for
    column-wise.
drop : bool, default False
    Drop missing indices from result.
method : {'pearson', 'kendall', 'spearman'} or callable
    Method of correlation:

    * pearson : standard correlation coefficient
    * kendall : Kendall Tau correlation coefficient
    * spearman : Spearman rank correlation
    * callable: callable with input two 1d ndarrays
        and returning a float.

numeric_only : bool, default False
    Include only `float`, `int` or `boolean` data.

    .. versionadded:: 1.5.0

    .. versionchanged:: 2.0.0
        The default value of ``numeric_only`` is now ``False``.

Returns
-------
Series
    Pairwise correlations.

See Also
--------
DataFrame.corr : Compute pairwise correlation of columns.

Examples
--------
>>> index = ["a", "b", "c", "d", "e"]
>>> columns = ["one", "two", "three", "four"]
>>> df1 = pd.DataFrame(np.arange(20).reshape(5, 4), index=index, columns=columns)
>>> df2 = pd.DataFrame(np.arange(16).reshape(4, 4), index=index[:4], columns=columns)
>>> df1.corrwith(df2)
one      1.0
two      1.0
three    1.0
four     1.0
dtype: float64

>>> df2.corrwith(df1, axis=1)
a    1.0
b    1.0
c    1.0
d    1.0
e    NaN
dtype: float64
c                $   > TR                  U TS9$ )Nr  )r@  )r]  r  r  s    r   r  $DataFrame.corrwith.<locals>.<lambda>,  s    

1V
(Dr   r  r  F)r  r   r   r<  r   )rI  )r?  r>  c                <   > [         R                  " U S   U S   TS9$ )Nr   r   r  )rR   rC  )r]  r  s    r   rq  DataFrame.corrwith.<locals>.c=,  s    ~~adAaD@@r   r  zInvalid method zM was passed, valid methods are: 'pearson', 'kendall', 'spearman', or callabler$  )rB  rA  r   r}   r  r1  rQ  r  r  r  stdrE  r   r  r  r   r   r  r  r  r  r   r  r  r  r  )r   r  r   rK  r  rI  r  r  r  ldemrdemnumdomrK  rq  raxisrD  idx_diffs    `  `             r   corrwithDataFrame.corrwith+  s"   P $$T*+7t%%'TeV$$::D4:PP++-EjjW5jA1966DGGEY!)#D1H$E )))>>D::<:@@D;##%C!(((56)))67  YF..(62B2BA --As4;;==%,,..9:ll . F !& ** *   #'!)QE>>%066uu7MNL#..v||<H8}q BFF8c(m38D r   c                @   U R                  U5      nU(       a  U R                  5       nOU n[        UR                  U5      5      S:X  a   U R	                  SUR                  U5      S9nO[        U5      R                  US9nUR                  SSS9R                  U SS9$ )	a|  
Count non-NA cells for each column or row.

The values `None`, `NaN`, `NaT`, ``pandas.NA`` are considered NA.

Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
    If 0 or 'index' counts are generated for each column.
    If 1 or 'columns' counts are generated for each row.
numeric_only : bool, default False
    Include only `float`, `int` or `boolean` data.

Returns
-------
Series
    For each column/row the number of non-NA/null entries.

See Also
--------
Series.count: Number of non-NA elements in a Series.
DataFrame.value_counts: Count unique combinations of columns.
DataFrame.shape: Number of DataFrame rows and columns (including NA
    elements).
DataFrame.isna: Boolean same-sized DataFrame showing places of NA
    elements.

Examples
--------
Constructing DataFrame from a dictionary:

>>> df = pd.DataFrame({"Person":
...                    ["John", "Myla", "Lewis", "John", "Myla"],
...                    "Age": [24., np.nan, 21., 33, 26],
...                    "Single": [False, True, True, True, False]})
>>> df
   Person   Age  Single
0    John  24.0   False
1    Myla   NaN    True
2   Lewis  21.0    True
3    John  33.0    True
4    Myla  26.0   False

Notice the uncounted NA values:

>>> df.count()
Person    5
Age       4
Single    5
dtype: int64

Counts for each **row**:

>>> df.count(axis='columns')
0    3
1    2
2    3
3    3
4    3
dtype: int64
r   r$  r  r  Fr  r  r  )
rB  rA  r  r  r   _get_agg_axisrO   r  r  r  )r   r   rI  r_  r  s        r   r  DataFrame.count^,  s    | $$T***,EE ut$%*--au7J7J47P-QF5\%%4%0F}}W5}1>>tG>TTr   r   skipnarI  filter_typec          	     .	  ^ ^^^^^^^ Tb  TS:X  d   T5       eTS:X  a  SOS nTb  T R                  T5      mSUUUU4S jjn	0 mSS UUUUU U4S jjjn
S!UU 4S jjnT nU(       a  U" 5       nTc  [        UR                  R                   Vs/ s H  oR                  PM     sn5      n[        U[        5      (       aH  UR                  USS9n[        [        UR                  5       5      5      nUR                  " T4TSS.TD6$ U	" UR                  5      $ TS:X  GaZ  [        UR                  5      S	:X  a9  UR                  " TT4S	TSTS
.TD6R                  S S	 nUR                  Ul        U$ UR                   S   (       Ga  TS:w  Ga  [        UR                  R                   Vs/ s H  oR                  PM     sn5      n[        U[        5      (       Ga  SSS.R#                  TT5      mUR                  USS9n[        [        UR                  5       5      5      nUR                   u  nn[$        R&                  " [$        R(                  " U5      U5      n[$        R*                  " [$        R(                  " U5      U5      n[-        UUSS9n[/        ST S3[0        S[3        T 5      R4                   ST S3S9   UR7                  U5      R8                  " T40 TD6nS S S 5        UR                  Wl        T(       dh  TS;  ab  UR;                  5       R=                  [$        R>                  S9RA                  SS9nTS;   a  SO[B        RD                  nURG                  UU5      nU$ URH                  nUR                  RK                  U
5      nURM                  UURN                  S9R                  S	   nUb#  UR                  S:w  a  UR                  U5      nU$ UR                  RQ                  5       [R        :H  RA                  5       (       a  TS;  a  UR                  [R        5      nU$ [        T 5      S	:X  a9  UR                  [R        :X  a%  TS;   a  UR                  [$        RT                  5      nU$ s  snf s  snf ! , (       d  f       GN= f)"Nr#  c                   > T" U 4TTS.TD6$ )Nr   rj  r{  )r   r   kwdsr  rj  s    r   r  DataFrame._reduce.<locals>.func,  s    f?4?$??r   r   c                v  > [        U [        5      (       Ga  [        U R                  5      (       d5  [        T	R                  [
        5      (       d  U R                  " T4ST
S.TD6$ TR                  U R                  5      nUc3  [        U R                  5      nSUR                  ;   nUTU R                  '   U(       a  U R                  " T4T
SS.TD6$ [        R                  " [        U 5       S3[        [        5       S9  U R                  " T4ST
0TD6n[        R                   " U/5      $ T" U 4UT
S.TD6$ )	Nr   rn  keepdimsTrj  rr  z:._reduce will require a `keepdims` parameter in the futurer   rj  )r   r[   r:   r   r   ro   _reducer  r
   
parametersr   r   r   r  r+   r  r   )r   r   has_keepdimssignr  dtype_has_keepdimsro  r   r  r   rj  s        r   blk_func#DataFrame._reduce.<locals>.blk_func,  s!   &.11*6<<88II|B B ">>$NQvNNN155fllC'$V^^4D#-#@L7C&v||4!>>$UvUPTUUMM<. )( (%#3#5	 $^^DHH4HF88VH--&CtFCdCCr   c                 b   > Tc  TR                  5       n U $ TS:X  d   eTR                  5       n U $ )Nr#  )rA  _get_bool_data)r  rk  r   s    r   	_get_data$DataFrame._reduce.<locals>._get_data,  sA    "--/
 K #f,,,**,Kr   Fr  rs  r   ri  kurtidxmaxidxmin)argmaxargminr  zThe behavior of SeriesGroupBy.z with all-NA valuesThe behavior of r  zn with all-NA values, or any-NA and skipna=False, is deprecated. In a future version this will raise ValueError)target_messagetarget_categorynew_message)rU  r:  r  r  )r  r  rN  r   boolean)r  prod)r   
np.ndarray)r   r   r   rI  r   )+rB  r4   r   r  r   r   rM   r  rJ   r  r  rt  r   r  r   r  rC  r  r  r  r  repeatr}   r,   r  r   r   r  r  rN   r  bool_rU  r   r  r  rQ  reducer   r   
get_dtypesr  r  )r   r  r   r   rj  rI  rk  ro  	out_dtyper  ry  r}  r   rF  r   r  rX  rI  	row_index	col_indexr   r  r  r  r<  rx  s   ````` ``                 @r   rt  DataFrame._reduce,  s	    "kV&;H[H;)V3F	((.D	@ 	@ :<	D 	D2	 	 B<$277>>%J>Cii>%JKE%00YYu5Y1#D)?)?)A$BC{{4OO$OO		?"QY288}!  !!& +  $r  "xx xx{{tv~(rww~~)N~))~)NOe^44 '/(CGGdSD5u5B'R-C-C-E(FGC#%88LE5 "		%(8% @I "		"))E*:E BI IEBC )<TFBUV(5.tDz/B/B.C1TF KJ J
 "%Y!7!;!;D!ID!I
 $&88FL!d.&@!wwy111AEE1EM&*.B&B!'T5!9!MB ggnnX&&&s&:??B SYY)%;**Y'C 
 gg  "f,1133N8R**V$C 
 Y!^		V 38O **RZZ(C
Y &K2 *O"
 
s   Q;)R ?#R
Rc                   US:X  a3  [         R                  " [        U 5      [        S9n[         R                  nODUS:X  a3  [         R
                  " [        U 5      [        S9n[         R                  nO[        U5      eU R                  R                   H  nU" USUS9nU" XG5      nM     U R                  X@R                  SS9nU$ )z
Special case for _reduce to try to avoid a potentially-expensive transpose.

Apply the reduction block-wise along axis=1 and then reduce the resulting
1D arrays.
r:  r  rU  r   rn  Fr  )r  onesr  r#  logical_andzeros
logical_orrz  r   r  r   r   )	r   r   r  rj  r  ufuncrF  middleres_sers	            r   _reduce_axis1DataFrame._reduce_axis17-  s     5=WWSYd3FNNEU]XXc$it4F MME%d++99##C#Af5F6*F $ **6%*Pr   rU  r  )r   r  rj  c                   U R                   " S[        R                  XU40 UD6n[        U[        5      (       a  UR                  U SS9nU$ )NrU  r  )_logical_funcrR   nananyr   r}   r  r   r   r  rj  r  r  s         r   rU  DataFrame.anyS-  sR     ##6==$6
=C
 ff%%((e(<Fr   r:  c                    U R                   " S[        R                  XU40 UD6n[        U[        5      (       a  UR                  U SS9nU$ )Nr:  r  )r  rR   nanallr   r}   r  r  s         r   r:  DataFrame.alld-  sR     ##6==$6
=C
 ff%%((e(<Fr   rg  c                v   > [         TU ]  " XU40 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nrg  r  )r  rg  r   r}   r  r   r   rj  rI  r  r  r  s         r   rg  DataFrame.mins-  A     T<B6Bff%%((e(<Fr   rj  c                v   > [         TU ]  " XU40 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nrj  r  )r  rj  r   r}   r  r  s         r   rj  DataFrame.max-  r  r   r  c                H   > [         TU ]  " XX440 UD6nUR                  U SS9$ )Nr  r  )r  r  r  r   r   rj  rI  	min_countr  r  r  s          r   r  DataFrame.sum-  s0     T<MfM""4"66r   r  c                H   > [         TU ]  " XX440 UD6nUR                  U SS9$ )Nr  r  )r  r  r  r  s          r   r  DataFrame.prod-  s0     dLNvN""4"77r   c                v   > [         TU ]  " XU40 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nr  r  )r  r  r   r}   r  r  s         r   r  DataFrame.mean-  A     dLCFCff%%((f(=Fr   medianc                v   > [         TU ]  " XU40 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nr  r  )r  r  r   r}   r  r  s         r   r  DataFrame.median-  sA     lEfEff%%((h(?Fr   semc                v   > [         TU ]  " XX440 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nr  r  )r  r  r   r}   r  r   r   rj  rS  rI  r  r  r  s          r   r  DataFrame.sem-  A     T4HHff%%((e(<Fr   varc                v   > [         TU ]  " XX440 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nr  r  )r  r  r   r}   r  r  s          r   r  DataFrame.var-  r  r   r]  c                v   > [         TU ]  " XX440 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nr]  r  )r  r]  r   r}   r  r  s          r   r]  DataFrame.std-  r  r   skewc                v   > [         TU ]  " XU40 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nr  r  )r  r  r   r}   r  r  s         r   r  DataFrame.skew-  r  r   r  c                v   > [         TU ]  " XU40 UD6n[        U[        5      (       a  UR	                  U SS9nU$ )Nr  r  )r  r  r   r}   r  r  s         r   r  DataFrame.kurt-  r  r   cumminc                8    [         R                  " XU/UQ70 UD6$ r   )rb   r  r   r   rj  r  r  s        r   r  DataFrame.cummin.      ~~d&B4B6BBr   cummaxc                8    [         R                  " XU/UQ70 UD6$ r   )rb   r  r  s        r   r  DataFrame.cummax
.  r  r   cumsumc                8    [         R                  " XU/UQ70 UD6$ r   )rb   r  r  s        r   r  DataFrame.cumsum.  r  r   cumprodc                8    [         R                  " XU/UQ70 UD6$ r   )rb   r  r  s        r   r  DataFrame.cumprod.  s    t6CDCFCCr   c                >    U R                  [        R                  XS9$ )a  
Count number of distinct elements in specified axis.

Return Series with number of distinct elements. Can ignore NaN
values.

Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
    The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for
    column-wise.
dropna : bool, default True
    Don't include NaN in the counts.

Returns
-------
Series

See Also
--------
Series.nunique: Method nunique for Series.
DataFrame.count: Count non-NA cells for each column or row.

Examples
--------
>>> df = pd.DataFrame({'A': [4, 5, 6], 'B': [4, 1, 1]})
>>> df.nunique()
A    3
B    2
dtype: int64

>>> df.nunique(axis=1)
0    1
1    2
2    2
dtype: int64
)r   r  )r  r}   nunique)r   r   r  s      r   r  DataFrame.nunique.  s    L zz&..tzCCr   r  False)numeric_only_defaultc                   U R                  U5      nU R                  (       aE  [        U R                  U   5      (       a(  U R                  U   R                  nU R                  US9$ U(       a  U R                  5       nOU nUR                  [        R                  SXSS9nUR                  nUS:H  R                  5       (       a9  [        R                  " S[        U 5      R                   S3[         [#        5       S9  UR%                  U5      n[&        R(                  " UR                  US	UR*                  S
9n	UR                  XR-                  U5      S9n
U
R/                  U SS9$ )Nr  r  Fr   rj  rI  rN  r  zu.idxmin with all-NA values, or any-NA and skipna=False, is deprecated. In a future version this will raise ValueErrorr   Trk  r$  r  r  )rB  rA  r  r   r   r   rA  rt  rR   	nanargminrR  rU  r   r   r   r   r  r+   r  rP   rm  rs  rg  r  r   r   rj  rI  
axis_dtyper  r  r  r   r  final_results              r   r  DataFrame.idxmin>.  E    $$T*::#diio..4..J++*+==))+DDllhTu  
 ++ rM  MM"4:#6#6"7 85 5 +- t$MM7t
 //>P>PQU>V/W((h(??r   r  c                   U R                  U5      nU R                  (       aE  [        U R                  U   5      (       a(  U R                  U   R                  nU R                  US9$ U(       a  U R                  5       nOU nUR                  [        R                  SXSS9nUR                  nUS:H  R                  5       (       a9  [        R                  " S[        U 5      R                   S3[         [#        5       S9  UR%                  U5      n[&        R(                  " UR                  US	UR*                  S
9n	UR                  XR-                  U5      S9n
U
R/                  U SS9$ )Nr  r  Fr  rN  r  zu.idxmax with all-NA values, or any-NA and skipna=False, is deprecated. In a future version this will raise ValueErrorr   Trk  r$  r  r  )rB  rA  r  r   r   r   rA  rt  rR   	nanargmaxrR  rU  r   r   r   r   r  r+   r  rP   rm  rs  rg  r  r  s              r   r  DataFrame.idxmaxc.  r  r   c                z    US:X  a  U R                   $ US:X  a  U R                  $ [        S[        U5       S35      e)z
Let's be explicit about this.
r   r   zAxis must be 0 or 1 (got r  )r   r   r  r  )r   axis_nums     r   rg  DataFrame._get_agg_axis.  s@     q=<<]::8h8HJKKr   c                   ^ U(       d  U OU R                  5       nU4S jnUR                  XQS9nUR                  (       a  [        S5      Ul        U$ )a  
Get the mode(s) of each element along the selected axis.

The mode of a set of values is the value that appears most often.
It can be multiple values.

Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
    The axis to iterate over while searching for the mode:

    * 0 or 'index' : get mode of each column
    * 1 or 'columns' : get mode of each row.

numeric_only : bool, default False
    If True, only apply to numeric columns.
dropna : bool, default True
    Don't consider counts of NaN/NaT.

Returns
-------
DataFrame
    The modes of each column or row.

See Also
--------
Series.mode : Return the highest frequency value in a Series.
Series.value_counts : Return the counts of values in a Series.

Examples
--------
>>> df = pd.DataFrame([('bird', 2, 2),
...                    ('mammal', 4, np.nan),
...                    ('arthropod', 8, 0),
...                    ('bird', 2, np.nan)],
...                   index=('falcon', 'horse', 'spider', 'ostrich'),
...                   columns=('species', 'legs', 'wings'))
>>> df
           species  legs  wings
falcon        bird     2    2.0
horse       mammal     4    NaN
spider   arthropod     8    0.0
ostrich       bird     2    NaN

By default, missing values are not considered, and the mode of wings
are both 0 and 2. Because the resulting DataFrame has two rows,
the second row of ``species`` and ``legs`` contains ``NaN``.

>>> df.mode()
  species  legs  wings
0    bird   2.0    0.0
1     NaN   NaN    2.0

Setting ``dropna=False`` ``NaN`` values are considered and they can be
the mode (like for wings).

>>> df.mode(dropna=False)
  species  legs  wings
0    bird     2    NaN

Setting ``numeric_only=True``, only the mode of numeric columns is
computed, and columns of other types are ignored.

>>> df.mode(numeric_only=True)
   legs  wings
0   2.0    0.0
1   NaN    2.0

To compute the mode over columns and not rows, use the axis parameter:

>>> df.mode(axis='columns', numeric_only=True)
           0    1
falcon   2.0  NaN
horse    4.0  NaN
spider   0.0  8.0
ostrich  2.0  NaN
c                "   > U R                  TS9$ )N)r  )r  )r  r  s    r   r  DataFrame.mode.<locals>.f.  s    666((r   r  r   )rA  r  rA  rh   r   )r   r   rI  r  r  r  s      `  r   r  DataFrame.mode.  sG    ` (tT-C-C-E	) zz!z'::&q)DJr   c                    g r   r{  r   qr   rI  interpolationr  s         r   quantileDataFrame.quantile.  r  r   c                    g r   r{  r  s         r   r  r  .  r  r   c                    g r   r{  r  s         r   r  r  /  r  r   c                   [        U5        U R                  U5      n[        U5      (       d  U R                  U/UUUUS9nUS:X  a  UR                  S   nOUR
                  R                  SS2S4   nUS:X  aN  [        U 5      S:X  a?  [        [        U R                  5      5      n[        U5      (       a  UR                  U5      $ U$ [        U[        R                  S9nU(       a  U R                  5       OU n	US:X  a  U	R
                  n	[        U	R                   5      S:X  a  [        / U R                   R"                  S9n
[        R                  nUS:X  a0  [        [        U R                  5      5      n[        U5      (       a  UnU R%                  / XUS9nUR'                  U S	S
9$ SS1nX\;  a  [)        SU SU S35      eUS:X  a  U	R*                  R                  XS9nGOJUS:X  GaC  1 SknXM;  a  [)        SU SU 35      e[        U	5      S:X  aV  U	R,                  S:X  a  [        [        U R                  5      5      nOU R.                  nU R%                  / XR                   US9$ [        R                  " [        R0                  " [        U	5      5      XS
9nU	R                   n[        U5      S:  a-  U Vs/ s H  nU	R3                  U5      PM     nn[5        U5      nOU	R3                  US   5      n[7        U5      nU	R*                  R9                  UU   SS9nXR:                  S'   U R=                  WUR:                  S9nUR'                  U S	S
9$ s  snf )au
  
Return values at the given quantile over requested axis.

Parameters
----------
q : float or array-like, default 0.5 (50% quantile)
    Value between 0 <= q <= 1, the quantile(s) to compute.
axis : {0 or 'index', 1 or 'columns'}, default 0
    Equals 0 or 'index' for row-wise, 1 or 'columns' for column-wise.
numeric_only : bool, default False
    Include only `float`, `int` or `boolean` data.

    .. versionchanged:: 2.0.0
        The default value of ``numeric_only`` is now ``False``.

interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
    This optional parameter specifies the interpolation method to use,
    when the desired quantile lies between two data points `i` and `j`:

    * linear: `i + (j - i) * fraction`, where `fraction` is the
      fractional part of the index surrounded by `i` and `j`.
    * lower: `i`.
    * higher: `j`.
    * nearest: `i` or `j` whichever is nearest.
    * midpoint: (`i` + `j`) / 2.
method : {'single', 'table'}, default 'single'
    Whether to compute quantiles per-column ('single') or over all columns
    ('table'). When 'table', the only allowed interpolation methods are
    'nearest', 'lower', and 'higher'.

Returns
-------
Series or DataFrame

    If ``q`` is an array, a DataFrame will be returned where the
      index is ``q``, the columns are the columns of self, and the
      values are the quantiles.
    If ``q`` is a float, a Series will be returned where the
      index is the columns of self and the values are the quantiles.

See Also
--------
core.window.rolling.Rolling.quantile: Rolling quantile.
numpy.percentile: Numpy function to compute the percentile.

Examples
--------
>>> df = pd.DataFrame(np.array([[1, 1], [2, 10], [3, 100], [4, 100]]),
...                   columns=['a', 'b'])
>>> df.quantile(.1)
a    1.3
b    3.7
Name: 0.1, dtype: float64
>>> df.quantile([.1, .5])
       a     b
0.1  1.3   3.7
0.5  2.5  55.0

Specifying `method='table'` will compute the quantile over all columns.

>>> df.quantile(.1, method="table", interpolation="nearest")
a    1
b    1
Name: 0.1, dtype: int64
>>> df.quantile([.1, .5], method="table", interpolation="nearest")
     a    b
0.1  1    1
0.5  3  100

Specifying `numeric_only=False` will also compute the quantile of
datetime and timedelta data.

>>> df = pd.DataFrame({'A': [1, 2],
...                    'B': [pd.Timestamp('2010'),
...                          pd.Timestamp('2011')],
...                    'C': [pd.Timedelta('1 days'),
...                          pd.Timedelta('2 days')]})
>>> df.quantile(0.5, numeric_only=False)
A                    1.5
B    2010-07-02 12:00:00
C        1 days 12:00:00
Name: 0.5, dtype: object
)r   rI  r  r  singler   Nr   r  r  r  r  r  r>  zInvalid method: z. Method must be in r  )qsr  >   r  highernearestzInvalid interpolation: z. Interpolation must be in r   F)r  r   )r/   rB  rE   r  r  rQ  r  r4   r  r  rH   r  rf   r  r  rA  r   r   r   r  r  r   r  r   r  r  r   r   rm  r   r   )r   r  r   rI  r  r  rL  r  r   r  r  cdtypevalid_methodvalid_interpolationq_idxr  r]  r  r  r  r  s                        r   r  r  /  s#   v 	A$$T*A ]])+ # F !kk!n hhmmAqD)qySY!^(dkk):;&u--::e,,J!2::&+7t%%'T1966Dt||!$,,"3"34DJJEqy)$t{{*;<&v.."E##BaU#KC##D#<< '*%"6(*>|nAN  X))$$$GCw"@7 -m_ =00C/DF 
 4yA~99>,T$++->?E JJE((1llRW(XXKK		#d) 4aNEB2w{DFGBq77:BG)$/33BqE:"1+))...>CHHQK++Cchh+?""4
";; Hs   >Mc                *   U R                  U=(       a    [        5       (       + S9nU R                  U5      n[        X5      n[	        U[
        5      (       d!  [        S[        U5      R                   35      eUR                  XS9n[        XVU5        U$ )as  
Cast to DatetimeIndex of timestamps, at *beginning* of period.

Parameters
----------
freq : str, default frequency of PeriodIndex
    Desired frequency.
how : {'s', 'e', 'start', 'end'}
    Convention for converting period to timestamp; start of period
    vs. end.
axis : {0 or 'index', 1 or 'columns'}, default 0
    The axis to convert (the index by default).
copy : bool, default True
    If False then underlying input data is not copied.

    .. note::
        The `copy` keyword will change behavior in pandas 3.0.
        `Copy-on-Write
        <https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
        will be enabled by default, which means that all methods with a
        `copy` keyword will use a lazy copy mechanism to defer the copy and
        ignore the `copy` keyword. The `copy` keyword will be removed in a
        future version of pandas.

        You can already get the future behavior and improvements through
        enabling copy on write ``pd.options.mode.copy_on_write = True``

Returns
-------
DataFrame
    The DataFrame has a DatetimeIndex.

Examples
--------
>>> idx = pd.PeriodIndex(['2023', '2024'], freq='Y')
>>> d = {'col1': [1, 2], 'col2': [3, 4]}
>>> df1 = pd.DataFrame(data=d, index=idx)
>>> df1
      col1   col2
2023     1      3
2024     2      4

The resulting timestamps will be at the beginning of the year in this case

>>> df1 = df1.to_timestamp()
>>> df1
            col1   col2
2023-01-01     1      3
2024-01-01     2      4
>>> df1.index
DatetimeIndex(['2023-01-01', '2024-01-01'], dtype='datetime64[ns]', freq=None)

Using `freq` which is the offset that the Timestamps will have

>>> df2 = pd.DataFrame(data=d, index=idx)
>>> df2 = df2.to_timestamp(freq='M')
>>> df2
            col1   col2
2023-01-31     1      3
2024-01-31     2      4
>>> df2.index
DatetimeIndex(['2023-01-31', '2024-01-31'], dtype='datetime64[ns]', freq=None)
r   unsupported Type )r>  r  )r   r   _get_axis_namer   r   rg   r  r   r   to_timestampsetattr)	r   r>  r  r   r   rt  	axis_nameold_axnew_axs	            r   r  DataFrame.to_timestamp/  s    L ))!C.A.C*C)D''-	)&+../V0E0E/FGHH$$$$8F+r   c                *   U R                  U=(       a    [        5       (       + S9nU R                  U5      n[        X5      n[	        U[
        5      (       d!  [        S[        U5      R                   35      eUR                  US9n[        XEU5        U$ )a  
Convert DataFrame from DatetimeIndex to PeriodIndex.

Convert DataFrame from DatetimeIndex to PeriodIndex with desired
frequency (inferred from index if not passed).

Parameters
----------
freq : str, default
    Frequency of the PeriodIndex.
axis : {0 or 'index', 1 or 'columns'}, default 0
    The axis to convert (the index by default).
copy : bool, default True
    If False then underlying input data is not copied.

    .. note::
        The `copy` keyword will change behavior in pandas 3.0.
        `Copy-on-Write
        <https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
        will be enabled by default, which means that all methods with a
        `copy` keyword will use a lazy copy mechanism to defer the copy and
        ignore the `copy` keyword. The `copy` keyword will be removed in a
        future version of pandas.

        You can already get the future behavior and improvements through
        enabling copy on write ``pd.options.mode.copy_on_write = True``

Returns
-------
DataFrame
    The DataFrame has a PeriodIndex.

Examples
--------
>>> idx = pd.to_datetime(
...     [
...         "2001-03-31 00:00:00",
...         "2002-05-31 00:00:00",
...         "2003-08-31 00:00:00",
...     ]
... )

>>> idx
DatetimeIndex(['2001-03-31', '2002-05-31', '2003-08-31'],
dtype='datetime64[ns]', freq=None)

>>> idx.to_period("M")
PeriodIndex(['2001-03', '2002-05', '2003-08'], dtype='period[M]')

For the yearly frequency

>>> idx.to_period("Y")
PeriodIndex(['2001', '2002', '2003'], dtype='period[Y-DEC]')
r   r  )r>  )r   r   r   r   r   re   r  r   r   	to_periodr  )r   r>  r   r   rt  r  r  r  s           r   r  DataFrame.to_period0  s    r ))!C.A.C*C)D''-	)&-00/V0E0E/FGHH!!t!,F+r   c                ^  ^ ^ [        T[        5      (       aH  SSKJn  [        R
                  " [        T5      mU" U U4S j[        T R                  5       5       SS9nGO?[        T[        5      (       aF  TR                  R                  (       d  [        S5      eT R                  TR                  T 5      SS9nO[        T[        5      (       ab  TR                  R                  (       a  TR                  R                  (       d  [        S5      eT R                  TR                  T 5      5      nOm[!        T5      (       d"  [#        S[%        T5      R&                   S	35      eU4S
 jnT R(                  R+                  U5      nT R-                  UUR.                  S9nUR1                  T SS9$ )a  
Whether each element in the DataFrame is contained in values.

Parameters
----------
values : iterable, Series, DataFrame or dict
    The result will only be true at a location if all the
    labels match. If `values` is a Series, that's the index. If
    `values` is a dict, the keys must be the column names,
    which must match. If `values` is a DataFrame,
    then both the index and column labels must match.

Returns
-------
DataFrame
    DataFrame of booleans showing whether each element in the DataFrame
    is contained in values.

See Also
--------
DataFrame.eq: Equality test for DataFrame.
Series.isin: Equivalent method on Series.
Series.str.contains: Test if pattern or regex is contained within a
    string of a Series or Index.

Examples
--------
>>> df = pd.DataFrame({'num_legs': [2, 4], 'num_wings': [2, 0]},
...                   index=['falcon', 'dog'])
>>> df
        num_legs  num_wings
falcon         2          2
dog            4          0

When ``values`` is a list check whether every value in the DataFrame
is present in the list (which animals have 0 or 2 legs or wings)

>>> df.isin([0, 2])
        num_legs  num_wings
falcon      True       True
dog        False       True

To check if ``values`` is *not* in the DataFrame, use the ``~`` operator:

>>> ~df.isin([0, 2])
        num_legs  num_wings
falcon     False      False
dog         True      False

When ``values`` is a dict, we can pass values to check for each
column separately:

>>> df.isin({'num_wings': [0, 3]})
        num_legs  num_wings
falcon     False      False
dog        False       True

When ``values`` is a Series or DataFrame the index and column must
match. Note that 'falcon' does not match based on the number of legs
in other.

>>> other = pd.DataFrame({'num_legs': [8, 3], 'num_wings': [0, 2]},
...                      index=['spider', 'falcon'])
>>> df.isin(other)
        num_legs  num_wings
falcon     False       True
dog        False      False
r   r;  c              3  t   >#    U  H-  u  pTR                   S S 2U/4   R                  TU   5      v   M/     g 7fr   )r  isin)r^  r  r_  r   r   s      r   r`  !DataFrame.isin.<locals>.<genexpr>0  s;      "9 IIa!f%**6#;77"9s   58r   r  z*cannot compute isin with a duplicate axis.r   z`only list-like or dict-like objects are allowed to be passed to DataFrame.isin(), you passed a 'r  c                   > [         R                  " U R                  5       T5      nUR                  U R                  5      $ r   )rP   r  ravelrP  rC  )r]  r  r   s     r   isin_DataFrame.isin.<locals>.isin_0  s4    
 $GGI ~~agg..r   r   r  r  )r   r  rC  r<  r  defaultdictr  r  r   r}   r   r  r  rK  reindex_liker   rE   r  r   r   r   r  r   r   r  )r   r   r<  r  r  r  s   ``    r   r  DataFrame.isinV0  sa   J fd##9 ,,T6:F"+DLL"9 F ''<<)) !MNNWWV006WWEF	**NN,,1G1G !MNNWWV0067F''%%)&\%:%:$;1> 	/ iiooe,G//\\ 0 F ""4"77r   z!list[Literal['index', 'columns']]_AXIS_ORDERS)r   r   zdict[Axis, int]_AXIS_TO_AXIS_NUMBERz
Literal[1]_info_axis_numberzLiteral['columns']_info_axis_namea  
        The index (row labels) of the DataFrame.

        The index of a DataFrame is a series of labels that identify each row.
        The labels can be integers, strings, or any other hashable type. The index
        is used for label-based access and alignment, and can be accessed or
        modified using this attribute.

        Returns
        -------
        pandas.Index
            The index labels of the DataFrame.

        See Also
        --------
        DataFrame.columns : The column labels of the DataFrame.
        DataFrame.to_numpy : Convert the DataFrame to a NumPy array.

        Examples
        --------
        >>> df = pd.DataFrame({'Name': ['Alice', 'Bob', 'Aritra'],
        ...                    'Age': [25, 30, 35],
        ...                    'Location': ['Seattle', 'New York', 'Kona']},
        ...                   index=([10, 20, 30]))
        >>> df.index
        Index([10, 20, 30], dtype='int64')

        In this example, we create a DataFrame with 3 rows and 3 columns,
        including Name, Age, and Location information. We set the index labels to
        be the integers 10, 20, and 30. We then access the `index` attribute of the
        DataFrame, which returns an `Index` object containing the index labels.

        >>> df.index = [100, 200, 300]
        >>> df
            Name  Age Location
        100  Alice   25  Seattle
        200    Bob   30 New York
        300  Aritra  35    Kona

        In this example, we modify the index labels of the DataFrame by assigning
        a new list of labels to the `index` attribute. The DataFrame is then
        updated with the new labels, and the output shows the modified DataFrame.
        )r   r*   ap  
                The column labels of the DataFrame.

                Examples
                --------
                >>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
                >>> df
                     A  B
                0    1  3
                1    2  4
                >>> df.columns
                Index(['A', 'B'], dtype='object')
                plotc           
        U R                   n[        [        [        US5      5      nUR	                  5       R                  5        VVs0 s H-  u  p#X R                  X3R                  S9R                  U 5      _M/     snn$ s  snnf )z|
Return a dict of dtype -> Constructor Types that
each is a homogeneous dtype.

Internal ONLY - only works for BlockManager
blockr   )	r   r   rp   rt   r(  r  r   r   r  )r   r   r  r  s       r   _to_dict_of_blocksDataFrame._to_dict_of_blocks1  sx     ii<C!9: ,,.
. ))!&&)9FFtLL.
 	
 
s   4B c                6    U R                   R                  5       $ )a  
Return a Numpy representation of the DataFrame.

.. warning::

   We recommend using :meth:`DataFrame.to_numpy` instead.

Only the values in the DataFrame will be returned, the axes labels
will be removed.

Returns
-------
numpy.ndarray
    The values of the DataFrame.

See Also
--------
DataFrame.to_numpy : Recommended alternative to this method.
DataFrame.index : Retrieve the index labels.
DataFrame.columns : Retrieving the column names.

Notes
-----
The dtype will be a lower-common-denominator dtype (implicit
upcasting); that is to say if the dtypes (even of numeric types)
are mixed, the one that accommodates all will be chosen. Use this
with care if you are not dealing with the blocks.

e.g. If the dtypes are float16 and float32, dtype will be upcast to
float32.  If dtypes are int32 and uint8, dtype will be upcast to
int32. By :func:`numpy.find_common_type` convention, mixing int64
and uint64 will result in a float64 dtype.

Examples
--------
A DataFrame where all columns are the same type (e.g., int64) results
in an array of the same type.

>>> df = pd.DataFrame({'age':    [ 3,  29],
...                    'height': [94, 170],
...                    'weight': [31, 115]})
>>> df
   age  height  weight
0    3      94      31
1   29     170     115
>>> df.dtypes
age       int64
height    int64
weight    int64
dtype: object
>>> df.values
array([[  3,  94,  31],
       [ 29, 170, 115]])

A DataFrame with mixed type columns(e.g., str/object, int64, float32)
results in an ndarray of the broadest type that accommodates these
mixed types (e.g., object).

>>> df2 = pd.DataFrame([('parrot',   24.0, 'second'),
...                     ('lion',     80.5, 1),
...                     ('monkey', np.nan, None)],
...                   columns=('name', 'max_speed', 'rank'))
>>> df2.dtypes
name          object
max_speed    float64
rank          object
dtype: object
>>> df2.values
array([['parrot', 24.0, 'second'],
       ['lion', 80.5, 1],
       ['monkey', nan, None]], dtype=object)
)r   r  r   s    r   r   DataFrame.values.1  s    T yy!!##r   )r   r   )rI  zCallable[..., DataFrame]r  )rI  r}   )NNNNN)
r   Axes | Noner   r   r   Dtype | Noner   bool | NonerI  None)FT)r(  r#  r&  r#  rI  DataFrameXchg)r,  
str | NonerI  r   r   )rI  zlist[Index])rI  ztuple[int, int])rI  r#  )rI  rO  )rI  r  )rI  r%  )...................)(r\  r#  r   r   r  ,int | list[int] | dict[Hashable, int] | Noner  bool | SequenceNotStr[str]r   r#  r  r  r  fmt.FormattersType | Noner  fmt.FloatFormatType | Noner  r"  r  r#  r  r%  rV  
int | Noner  r*  r  r#  r  r  r  r*  r  r*  r  r*  r  r%  rI  r  )..................)(r\  FilePath | WriteBuffer[str]r   r   r  r&  r  r'  r   r#  r  r  r  r(  r  r)  r  r"  r  r#  r  r%  rV  r*  r  r*  r  r#  r  r  r  r*  r  r*  r  r*  r  r%  rI  r#  )NNNTTr  NNNTNNNFr  NNNN)(r\  "FilePath | WriteBuffer[str] | Noner   r   r  r&  r  r'  r   r#  r  r  r  r(  r  r)  r  r"  r  r#  r  r%  rV  r*  r  r*  r  r#  r  r  r  r*  r  r*  r  r*  r  r%  rI  r%  )
r  FloatFormatType | Noner  r%  r  r  r  r  rI  r   )rI  r   )rI  z!Iterable[tuple[Hashable, Series]])TPandas)r   r#  r   r%  rI  zIterable[tuple[Any, ...]])rI  rx  )r  r}   rI  r}   )r  zDataFrame | Index | ArrayLikerI  r   )r  zAnyArrayLike | DataFramerI  r  )r   NN)
r  r  r   r   r   r!  r   r   rI  r   )r   znpt.DTypeLike | Noner   r#  r  r  rI  r  )r  r#  r  z	list[int]rI  r  ).)r   <Literal['dict', 'list', 'series', 'split', 'tight', 'index']r'  'type[MutableMappingT] | MutableMappingTr   r#  rI  r   )r   Literal['records']r'  r0  r   r#  rI  zlist[MutableMappingT])r   r/  r'  
type[dict]r   r#  rI  r  )r   r1  r'  r2  r   r#  rI  z
list[dict])r   zGLiteral['dict', 'list', 'series', 'split', 'tight', 'records', 'index']r'  r0  r   r#  rI  z'MutableMappingT | list[MutableMappingT])	NNFfailTNNTN)r1  r  r5  r%  r6  r*  r7  r#  r8  r   r9  r#  r:  zlist[dict[str, str]] | Noner;  r%  r<  r#  rI  r#  )NNNFN)rW  r#  rX  r*  rI  r   )TNN)r   r#  rI  znp.rec.recarray)NT)r   r!  ry  r#  rI  r   )r~  FilePath | WriteBuffer[bytes]r  dict[Hashable, str] | Noner  r#  r  zToStataByteorder | Noner  zdatetime.datetime | Noner  r%  r  r5  r  r*  r  zSequence[Hashable] | Noner  r   r|  StorageOptions | Noner  z'dict[Hashable, dict[float, str]] | NonerI  r#  )r~  r4  rI  r#  )NwtTN)
r\  r,  r  r  r   r#  r|  r6  rI  r%  )......)r~  r#  r  )Literal['auto', 'pyarrow', 'fastparquet']r  r%  r   r"  r  list[str] | Noner|  r   rI  bytes).....)r~  r4  r  r8  r  r%  r   r"  r  r9  r|  r   rI  r#  )NautosnappyNNN)r~  $FilePath | WriteBuffer[bytes] | Noner  r8  r  r%  r   r"  r  r9  r|  r6  rI  bytes | None)
r~  r=  r  zLiteral['pyarrow']r   r"  r  zdict[str, Any] | NonerI  r>  )......................)0r\  r+  r   r   r  ColspaceArgType | Noner  r#  r   r#  r  r  r  FormattersType | Noner  r-  r  r"  r  r#  r  r%  rV  r*  r  r*  r  
bool | strr  r  r  r#  r  str | list | tuple | Noner  r#  r  r#  r  int | bool | Noner  r%  r  r#  r  r%  rI  r#  ).......................)0r\  r#  r   r   r  r?  r  r#  r   r#  r  r  r  r@  r  r-  r  r"  r  r#  r  r%  rV  r*  r  r*  r  rA  r  r  r  r#  r  rB  r  r#  r  r#  r  rC  r  r%  r  r#  r  r%  rI  r  )NNNTTr  NNNTNNNFr  TNTFNNFN)0r\  r,  r   r   r  r?  r  r#  r   r#  r  r  r  r@  r  r-  r  r"  r  r#  r  r%  rV  r*  r  r*  r  rA  r  r  r  r#  r  rB  r  r#  r  r#  r  rC  r  r%  r  r#  r  r%  rI  r%  )"r  r#  r   r#  r  r%  r  r%  r  r%  r  r9  r  r9  r  dict[str | None, str] | Noner  r%  r  r  r  r"  r  r"  r  XMLParsers | Noner  5FilePath | ReadBuffer[str] | ReadBuffer[bytes] | Noner  r   r|  r6  rI  r  )"r  z0FilePath | WriteBuffer[bytes] | WriteBuffer[str]r   r#  r  r%  r  r%  r  r%  r  r9  r  r9  r  rD  r  r%  r  r  r  r"  r  r"  r  rE  r  rF  r  r   r|  r6  rI  r#  )NTr  r!  NNNNNzutf-8TTr  Nr  N)"r  z7FilePath | WriteBuffer[bytes] | WriteBuffer[str] | Noner   r#  r  r%  r  r%  r  r%  r  r9  r  r9  r  rD  r  r%  r  r  r  r"  r  r"  r  rE  r  rF  r  r   r|  r6  rI  r%  )r  r"  r\  zWriteBuffer[str] | Noner  r*  r  zbool | str | Noner  r"  rI  r#  )TF)r   r#  r   r#  rI  r}   )r   r#  rI  r   )r   )r  rx  r   r   rI  r}   )r  rx  rI  r   )rI  zIterator[ArrayLike])r  r  )F)rF  r#  rI  r   )rI  r#  )r  r)  rI  r#  )rq  r   rI  r#  )FN)r?  zint | slice | np.ndarrayr   r#  rL  BlockValuesRefs | NonerI  r#  )rq  r   rL  rG  rI  r#  )T)r?  rx  rq  r}   r   r#  rI  r#  )r   r   rq  r   rF  r#  rI  r#  )r   r   r?  rx  rI  r}   )r  r   rI  r}   )rq  r}   r   r#  rI  r#  )r  r  r   Literal[False]rI  r   )r  r  r   Literal[True]rI  r#  )r  r  r   r#  rI  DataFrame | None)r  r  r   rH  rI  r   )r  r  r   r#  rI  z
Any | None)NN)rI  r   )
r?  rx  rd  r   rq  zScalar | AnyArrayLiker  bool | lib.NoDefaultrI  r#  )rI  (tuple[ArrayLike, BlockValuesRefs | None])r   zdict[str, Index]r   r#  rI  r   )r   r   r   r"  rI  r   )r   Axis | Noner  zReindexMethod | Noner   r"  r  Level | Noner  zScalar | Noner  r*  rI  r   )r  r   r   r   r   r   r   r   r  r   r   rI  r  r   rI  r#  )r  r   r   r   r   r   r   r   r  r   r   rH  r  r   rI  r   )r  r   r   r   r   r   r   r   r  r   r   r#  r  r   rI  rJ  )r  IndexLabel | Noner   r   r   rO  r   rO  r  rN  r   r#  r  r   rI  rJ  )r)  Renamer | Noner   rP  r   rP  r   rM  r   r"  r   rI  r  r   r  r   rI  r#  )r)  rP  r   rP  r   rP  r   rM  r   r"  r   rH  r  r   r  r   rI  r   )r)  rP  r   rP  r   rP  r   rM  r   r"  r   r#  r  r   r  r   rI  rJ  )r)  rP  r   rP  r   rP  r   rM  r   r"  r   r#  r  rN  r  r   rI  rJ  )r4  zdict[Hashable, tuple[Any, Any]]r   r#  )r=  zint | Sequence[int]r>  Frequency | Noner   r   r  r   rF  r%  rI  r   )
rK  r#  r  r#  r   rH  ry  r#  rI  r   )
rK  r#  r  r#  r   rI  ry  r#  rI  r#  )
rK  r#  r  r#  r   r#  ry  r#  rI  rJ  )r  r   rK  r#  r   rH  ra  r   rb  r   r  rK  r  $Hashable | Sequence[Hashable] | NonerI  r   )r  r   rK  r#  r   rI  ra  r   rb  r   r  rK  r  rR  rI  r#  )r  r   rK  r#  r   r#  ra  r   rb  r   r  rK  r  rR  rI  rJ  )r  rO  rK  r#  r   r#  ra  r   rb  r   r  rK  r  rR  rI  rJ  )r   r   r  AnyAll | lib.NoDefaultr  int | lib.NoDefaultr  r   r   rH  r  r#  rI  r   )r   r   r  rS  r  rT  r  r   r   rI  r  r#  rI  r#  )r   r   r  rS  r  rT  r  rO  r   r#  r  r#  rI  rJ  )
r  rR  r$  r   r   rI  r  r#  rI  r#  )
r  rR  r$  r   r   rH  r  r#  rI  r   )
r  rR  r$  r   r   r#  r  r#  rI  rJ  )Nr  )r  rR  r$  r   rI  r}   )r  r   r   r   r   rH  rZ  r   r  r   r  r#  r  r   rI  r   )r  r   r   r   r   rI  rZ  r   r  r  r  r#  r  r   rI  r#  )r  r   r   r   r  z$bool | list[bool] | tuple[bool, ...]r   r#  rZ  r   r  r  r  r#  r  zValueKeyFunc | NonerI  rJ  )r   r   r  r   r  bool | Sequence[bool]r   rI  rZ  r   r  r   r  r#  r  r#  r  r   rI  r#  )r   r   r  r   r  rU  r   rH  rZ  r   r  r   r  r#  r  r#  r  r   rI  r   )r   r   r  r   r  rU  r   r#  rZ  r   r  r   r  r#  r  r#  r  r   rI  rJ  )r   r   r  rO  r  rU  r   r#  rZ  r   r  r   r  r#  r  r#  r  zIndexKeyFunc | NonerI  rJ  )NFTFT)r  rO  r  r#  r  r#  r  r#  r  r#  rI  r}   )r  )rX  rx  r   r   r$  r   rI  r   )rN  r   )r  r   r  r   r   r   rI  r   )r  zSequence[int | str]r   r   rI  r   )r  r   r   zAxisInt | NonerI  r   )r  r   )r  r   rI  r   )r   rx  rI  r#  )r   r   r  r"  r  rN  )rG  r}   r   r   r  )rI  ztuple[DataFrame, DataFrame])r   N)r   r   rI  r   )r   FFr  )r  r   r  r   r  r#  r  r#  r  r   rI  r   )r  r   r  z-Callable[[Series, Series], Series | Hashable]r  r#  rI  r   )r  r   rI  r   )r  TNr  )r  r   r  r#  r  r   rI  r#  )r   zAxis | lib.NoDefaultr  rO  r  r#  r  r#  r  r#  r  rK  r  r#  rI  r   )r  r   r  r#  r  r#  r  r   r  rK  r  r#  rI  r   )r  r   r  rK  r  rK  r  r#  )rd  r   r  r#  rI  r   )rN  NT)r  r   r  r#  )NNNrq  NT)r  r   ra  rN  r  r#  rI  r   )r   r   )r=  rx  r   r   rI  r   )r  r   r  rx  r  zDataFrame | Series | NonerI  r  )Nr   )r  r   r   r   rI  r   )r   FNr{  compatpythonN)r  r   r   r   r  r#  r  z/Literal['expand', 'reduce', 'broadcast'] | Noner  zLiteral[False, 'compat']r  zLiteral['python', 'numba']r  zdict[str, bool] | None)r  r   r  r%  rI  r   )r  r   r  zNaAction | NonerI  r   )FFF)r  r#  ry  r#  r  r#  rI  r   )Nr  r>  r>  FN)r  z1DataFrame | Series | Iterable[DataFrame | Series]r  rO  r  r   r!  r  r"  r  r  r#  r  zJoinValidate | NonerI  r   )r  NNNFFF)_x_yNFN)r  r  r  r   r   IndexLabel | AnyArrayLike | Noner  r[  r)  r[  r  r#  r  r#  r  r#  r  r   r   r"  r*  z
str | boolr  zMergeValidate | NonerI  r   )r.  z$int | dict[IndexLabel, int] | SeriesrI  r   )r<  r   F)r  r   rH  rx  rI  r#  rI  r   )Nr   F)rH  r*  rS  r*  rI  r#  rI  r   )r   Fr<  F)r  r  r   r   rK  r#  r  r   rI  r#  rI  r}   )r   F)r   r   rI  r#  )r   r  r   r   rj  r#  rI  r#  )r   r  rj  r#  rI  r}   )r   rM  r  r#  rj  r#  rI  zSeries | bool)r   FT)r   TF)r   rM  rj  r#  rI  r#  )r   TFr   )r   rM  rj  r#  rI  r#  r  rx  )r   Tr   F)r   rM  rj  r#  rS  rx  rI  r#  )r   rM  rj  r#  )r   T)r   r   r  r#  rI  r}   )r   r   rj  r#  rI  r#  rI  r}   )r  rx  rI  rf   )r   r   rI  r#  r  r#  rI  r   )r  r  r   r   rI  r#  r  r   r  Literal['single', 'table']rI  r}   )....)r  zAnyArrayLike | Sequence[float]r   r   rI  r#  r  r   r  r\  rI  Series | DataFrame)r  z&float | AnyArrayLike | Sequence[float]r   r   rI  r#  r  r   r  r\  rI  r]  )g      ?r   Flinearr  )Nr  r   N)
r>  rQ  r  r   r   r   r   r"  rI  r   )Nr   N)r>  rQ  r   r   r   r"  rI  r   )r   z'Series | DataFrame | Sequence | MappingrI  r   )rI  r  (  r   
__module____qualname____firstlineno____doc__rb   _internal_names_set_typr}   rf   r[   r  r  _HANDLED_TYPESr   __annotations__r   r  __pandas_priority__propertyr   r   r   r   r   r)  r1  r;  r   rC  rG  rK  rR  rW  rs  rx  r  r  r   rh  r)   r(   r|  common_docstringreturn_docstringr  r  r~   r'   r  r  r  r  r  r  r  classmethodr  r   r  r  r"  r(  r  r2  ra  rv  rz  r*   r  r  r  _shared_doc_kwargsr  r  r  r  r   r   rv  r  r  rQ  r  r  r  r   r3  r-  r(  rH  rQ  re  r^  r`  rn  r_  ra  rN  r  r  rc  r  r  r  r  r  r  r  r  r  r  r  r  rM  r  r  r  r  r  rK  r  r  r8  r@  rJ  re  rN   r  rO   r  r  r'  r   r  r  r  r  r  r  r   r  r  r  _logical_methodr  r  r  r  r  r2  r9  r  rB  rE  rI  rS   make_flex_docrK  rQ  rT  rW  rZ  r]  rR  re  ri  subtractrl  ro  multiplyrr  ru  r@  dividerx  rdivr{  r~  rA  r  r   r!  r  r  r  rS  r  r  r  r  r  r  r|   r  r  _agg_see_also_doc_agg_examples_docr  r  r  r  r  r
  r  r  
_merge_docr  r3  r@  rT  rd  r  rt  r  rc   rU  r:  rg  rj  r  r  r  r  r  r  r]  r  r  kurtosisproductr  r  r  r  r  r  r  rg  r  r  r  r  r  r  r  r  	_AXIS_LENr  r  r   AxisPropertyr   r   rU   r  plottingPlotAccessorr  
hist_framehistboxplot_frameboxplotr^   r   r  r   __static_attributes____classcell__)r  s   @r   r   r     s>   DL %g.1L1LLDe^RZZ@N$:J%$+$9$9IbM$IM>I
%%  %" 28.7-$ !#" r r 	r
 r r 
rn =A,@,@59,@	,@^ ,0V(V	V*: * *  2 2* A A4 . .  :%-"^

-*X  "BE-00336 #!"" #!$"#&")  @	
 +   . 1        !" #$ %& !'( )* 
+ 0   #BE-00336 #!"" #!$"#&")(  @	
 +   . 1        !" #$ %& !'( )* 
+ 0 $VUO+ ) 2K	  4 4c>R>RS 37#BF-10437 $ "## %!%##'#)J/J J @	J
 +J J J .J 1J J J J J J J  !J" #J$ %J& !'J( )J* 
+J T	JX> ->  	>
 > > 
>,  2.	 d l7#$. %.4n 6>RR(2R	"Rh    t@l    +   "+"#}L}L }L 	}L
 }L 
}L }LB '+>>	@#@ @ 	@
 
@D)-EN	,  PS
 L 6	
  
   " 6	
  
   PS L 	
  
  
 " 	
  
  $VX$6Y  p=
p=
p= p= 
1p=p=d $V-@$A "& $"(%)48#!E
E
 E
 	E

 E
  E
 #E
 2E
 E
 E
 
E
E
N  " a1 a1 a1 
a1 a1H DH^U^U	^U@  #!%/1
 /1 /1 
/1 /1b 	$%67()>?&H 59 -1/3!%6:!26*115@DS+S 2	S
 S +S -S S 4S S 0S (S /S >S 
S	Sj)> $VUO- 	 )$%67,	8 3715/  	
 / 
5:.  <?"% +.*-

 :
  	

 
 )
 (
 

 
  =@"% +.*-
+
 :
  	

 
 )
 (
 

 
 $VV$4< 	&789 6:<B"*!+/15d
2d
 :d
  	d

 d
 )d
 /d
 
d
 :d
P 6:V
 &/!/3V
2V
 #	V

 V
 -V
 
V
p   #,/,//2 #!""&)-0$'" "1(  *	
    * -      $  !" #$ +%& '( )* "+, -. /0 12 
3 8  ",/,//2 #!""&)-0$'" "1  *	
    * -      $  !" #$ +%& '( )* "+, -. /0 12 
3 8 $VUO) =?4	  4 4c>R>RS 37#,0,0/3 $ "##&+-1$(#"#1l
/l
 l
 *	l

 l
 l
 l
 *l
 -l
 l
 l
 l
 l
 l
 $l
  !l
" #l
$ +%l
& 'l
( )l
* "+l
, -l
. /l
0 1l
2 
3l
 Tl
\   #  #" &)&)36 '*$'$'LO*-14% 	
    $ $ 1   % " "  J!" (#$ /%& 
' , 
  #" &)&)36 '*$'$'LO*-14%H 	
    $ $ 1   % " "  J!" (#$ /%& 
' , $V-=$>X 	$%67()>?BRR SW &$!&*&*37!'+$($*LP*115#G,OG, G, 	G,
 G, G, $G, $G, 1G, G, G, %G, "G, "G, JG,  (!G," /#G,$ 
%G,	G,T 	,+,  $'+#*.#'

 %
 	

 (
 !
 

 -
&c cJ -2 v= v=p    >   D(0*BH86 *D$# $#L(FT('T&3P*,X/ 0,l '+	!%	! 		!
 %	! 
	! EI'#'+A'	'"' ' -6 GL++-3+?C+	+ZV.
&!*8" <?     25   38 \ \| ;>     27 g6 g6RNQ NQj 25M8M8 M8 %	M8
 /M8 
M8^BH(T W W$,0	8 	.  )*+<=)=" g&&'
  > 	>
 > 
> > (/>> 	 )+,>? 
  '+ "$&FF 
 
 %
 
 
 "
 
 

 


6  ! !! 	
      
   ! !"%! 	
       
   ! !! 	
      
  %)\
 #'%)"%\
!\
 	\

 !\
 #\
 \
 \
 \
 
\
 \
|  "% !$"%! 	
        
   "% !$"%"%! 	
         
   "% !$"%! 	
        
   "&L
 !%"&  "&L
L
 	L

  L
 L
 L
 L
 L
 L
 
L
 L
\)& )&V &6 &AE &D 	09: ()!%"~~!o
$o
 o
 	o

 o
 o
 
o
 o
 ;o
b 
 "%!$	 		
 	  	 	 
	 	 
 !$	 		
 	 	 	 
	 	 !&J 	J
 J J J 
JX    "%! 146: 	
     / 4 
     ! 146: 	
    / 4 
     ! 146: 	
    / 4 
  $(t 146:t t 	t
 t t t /t 4t 
tr 	/898 :8
 	/89 : 	09: ; 	09: ;  &)&) "% 
 
 $	

 $
 
  
 
 

 
  &)&)  
 
 $	

 $
 
 
 
 

 
 &)nn&)nn$("^ ^ $	^
 $^ "^ ^ ^ 
^@  8;  4 	
   
   8; "% 4 	
    
   8;  4 	
   
  8<_ !"_4_ 	_
 _ _ 
_F 8< F>4F> F> 
	F>V 
 "%"%  	        
  
   	      
 $ :>$!"#'kCkC 	kC
 8kC kC kC kC kC !kC 
kCZ  +."%"   	
 )        
   +."%"%"   	
 )         
   +."%"   	
 )        
 $ #'+/$"(#"#'k
 k
 !	k

 )k
 k
 k
  k
 k
 k
 !k
 
k
 k
^ %)D!D D 	D
 D D 
DN JQwVwV)wV1FwV	wVt JQnWnW)nW1FnW	nW` 	 )*

 254
=|}=| 5 5t00 $O =AJ
#J
+9J
	J
X (*X< ""H H 	H
 HT
: *3$40"&0@& ;D4 0 0 ck23Q Q 4Q ck23Q Q 4Q ck23Q Q 4Q ck23Q Q 4Q ck23Q Q 4Q ck23Q Q 4Q c{34DH

	
 5
 c45DH

	
 6
 c{34DH

	
 5
 Hc45DH

	
 6
 c{34DH

	
 5
 Hc45DH

	
 6
 c	;78DH

	
 9
 CFc
K89DH

	
 :
 Dc
K89DH

	
 :
 c[9:DH

	
 ;
 c{34DH

	
 5
 c45DH

	
 6
 c{34DH

	
 5
 c45DH

	
 6
 	Ymo	
` !)esn   !2

 
 	

 
 
 

 
ish
( qAqA <qA
 qA 
qAfOCh "&p? p? 	p? p? 
p?h eg	
iT l9%(::; %(^^#'),-
 #-
 !	-

 -
 -
 -
 '-
 -
 
-
 <UiV-
bE	 R "l7#$ #s~~H	H % HS	 n "l=)* %#),

 
 
 
 
 '
 
 

 + 
> '*~~%(^^"R9R9 %R9 #	R9
 R9n #~;~; ~; 
	~;@C; C;J l6"
V%LLM &"&!,
 ,  , , 
, N,, 	:?A
HR1 1SHR16 -1	  *	
 
2 	 )	+Z 	[! )'""  C[! )' /0'+	
 GK+3-504L=L= L= 	L=
 EL= )L= +L= .L=^ =A\;"\;/9\;	\;~ BF4="4=/>4=	4=x #!&3: 3: 	3:
 3: 
3:p !%(,g@g g 	g
 g g g &g 
gR "j!$  /34859 !)  %)-
!
 
 -	

 2
 3
 
 
 
 
 
 
 '
 

 % 
D @Az)<z)	z)B %."	p8!p8 p8 	p8
 
p8h #'"	@7@7 @7 	@7
 
@7J $-"F!F F 	F
 "F F 
FVKU KUd "J J
 J J JX8 	%a	 !
   	
  
 " 	%a	 ! 	  	 
 " 	%a	 ! "	

 
 	
 
 "
 	%a	 ! "	

 
 	
 
 "
 	%a	 ! "	7	7 	7 		7
 	7 	7 "	7 	&q	!" "	8	8 	8 		8
 	8 	8 #	8 	&q	!" "	

 
 	
 
 #
 	(	#$ "	

 
 	
 
 %
 	%a	 ! "  	
   " 	%a	 ! "  	
   " 	%a	 ! "  	
   " 	&q	!" "	

 
 	
 
 #
 	&q	!" "	

 
 	
 
 #
 HG(	#$C C %C 	(	#$C C %C 	(	#$C C %C 	)Q	 D D !D&D &DP 	h	g>HM"@"@&*"@AE"@	"@ ?"@H 	h	g>HM"@"@&*"@AE"@	"@ ?"@H	L JNZZ,0ZBFZ	Zx   /2-0  	
 - + 
    /2-0)  	
 - + 
   58 /2-01  	
 - + 
  58"/7-5m<1m< m< 	m<
 -m< +m< 
m<b "&% PP P 	P
 P 
Pf RVC$C37CCNC	CJp8h 8?	6JL3J-

&
&--/ 
 L!I$%z%*3O'3##*-E\ %%
G* &&//">">?D??%%Doo++GH&9:F

 I$ I$ I$r   c                    [         R                  " [        5      nU R                  5        H%  u  p#UR                  5        H  u  pEXQU   U'   M     M'     U$ r   )r  r  r  r  )r  r  r   r  r_  r  s         r   r  r  {1  sI    (3(?(?(EHJJLggiFC#$SM%    ! Or   c                   U R                   R                  U5      (       d  [        U5      (       dX  [        5       (       a-  [	        U [
        5      (       a  U R                  U R                  4$ U R                  R                  5       S 4$  U R                  U5      R                  nUS 4$ ! [         a.  nU R                   R                  (       d  Ue[        S5      UeS nAff = f)Nz6incompatible index of inserted column with frame index)r   r8  r  r   r   r}   rR  r  r   r  r  r  r  )rq  r   reindexed_valuer  s       r   r  r  1  s    
 {{%  E

  Zv%>%>==%"3"333}}!!#T))
--.66 D    {{$$ID
	s   
B) )
C!3)CC!)rI  zcollections.defaultdict)rq  r  r   rf   rI  rL  (  rb  
__future__r   r  r   collections.abcr   r   r   r   r	   r  inspectr
   ior   rM  r  r[  textwrapr   typingr   r   r   r   r   r   r   numpyr  r   pandas._configr   r   r   pandas._config.configr   pandas._libsr   rB  r   r   pandas._libs.hashtabler   pandas._libs.libr   pandas.compatr   pandas.compat._constantsr   pandas.compat._optionalr   pandas.compat.numpyr    r  pandas.errorsr!   r"   r#   r$   r%   r&   pandas.util._decoratorsr'   r(   r)   r*   pandas.util._exceptionsr+   r,   pandas.util._validatorsr-   r.   r/   pandas.core.dtypes.castr0   r1   r2   r3   r4   r5   r6   r7   r8   pandas.core.dtypes.commonr9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   pandas.core.dtypes.concatrJ   pandas.core.dtypes.dtypesrK   rL   rM   pandas.core.dtypes.missingrN   rO   pandas.corerP   rQ   ri  rR   rS   rT   pandas.core.accessorrU   r  rV   pandas.core.array_algos.takerW   pandas.core.arraylikerX   pandas.core.arraysrY   rZ   r[   r\   r]   pandas.core.arrays.sparser^   pandas.core.constructionr_   r`   ra   pandas.core.genericrb   rc   pandas.core.indexersrd   pandas.core.indexes.apire   rf   rg   rh   ri   rj   pandas.core.indexes.multirk   rl   pandas.core.indexingrm   rn   pandas.core.internalsro   rp   "pandas.core.internals.constructionrq   rr   rs   rt   ru   rv   rw   rx   ry   rz   pandas.core.methodsr{   pandas.core.reshape.meltr|   pandas.core.seriesr}   pandas.core.shared_docsr~   pandas.core.sortingr   r   r   pandas.io.commonr   pandas.io.formatsr   r   r|  pandas.io.formats.infor   r   r   pandas.plottingr  datetimepandas._libs.internalsr   pandas._typingr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   *pandas.core.interchange.dataframe_protocolr   r$  r   r  r   rl  ru  r  r  r{  r   r   <module>r     s,  	 #         
      
 . 
 . -  . > .   
 
 
    & 4 

  0 < 6 *  : 
 2    ( ) % 0  ( 
 61 1 1 1 1 1 1 1 1 1 1 1 1f =U7. 7:K%% @F
Z{}$ {}$|{!!&+!-!r   