Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/core/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/core/__pycache__/frame.cpython-312.pyc

�

Mٜg����F�dZddlmZddlZddlmZddlmZmZmZm	Z	m
Z
ddlZddlm
Z
ddlmZddlZddlZddlZddlmZdd	lmZmZmZmZmZmZddlZddlZdd
lmZddl m!Z!m"Z"m#Z#ddl$m%Z%dd
l&m'Z(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z7ddl8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>ddl?m@Z@mAZAmBZBmCZCddlDmEZEmFZFddlGmHZHmIZImJZJddlKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTddlUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZemfZfddlgmhZhddlimjZjmkZkmlZlddlmmnZnmoZoddlpmqZqmrZsmtZtmuZumvZvddlwmxZxddlymzZzdd l{m|Z|dd!l}m~Z~dd"lm�Z�m�Z�m�Z�m�Z�m�Z�dd#l�m�Z�dd$l�m�Z�m�Z�m�Z�dd%l�m�Z�m�Z�dd&l�m�Z�dd'l�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�dd(l�m�Z�m�Z�dd)l�m�Z�m�Z�dd*l�m�Z�m�Z�dd+l�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�dd,l�m�Z�dd-l�m�Z�dd.l�m�Z�dd/l�m�Z�dd0l�m�Z�m�Z�m�Z�dd1l�m�Z�dd2l�m�Z�m�Z�dd3l�m�Z�m�Z�m�Z�ddl�Z�er�ddl�Z�dd4l�m�Z�dd5l�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�dd6l�m�Z�dd7l�m�Z�dd8l�m�Z�dd9l�m�Z�d:d;d<d=d>d?d@dA�Z�dB�ZGdC�d;e�e~�Z�dFdD��Z						dGdE��Zy)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��Stylerzindex, columnsr�z{0 or 'index', 1 or 'columns'}z�axis : {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�X2��eZdZUdZddhej
zZdZeee	e
jfZdhZ
ded<ejeg�zZded	<d
ed<dZe�d�d
��Z�d�d�ZeZded<�d�d�Z					�d�									�d�d�Z	�d�					�d�d�Zdd�			�d�d�Z�d�d�Ze�d�d��Ze�d�d��Ze�d�d��Ze�d�d��Ze�d�d ��Z�d�d!�Z �d�d"�Z!�d�d#�Z"�d�d$�Z#�d�d%�Z$e%																			�d�																																							�d�d(��Z&e%																		�d�																																							�d�d)��Z&e'd*d+d'gd,�-�e(d.d/d0d1�2�e(e)jTe)jV�3�																			�d�																																							�d�d4����Z&										�d�d5�Z,e�d�d6��Z-d7e.d8<e/e.d8��d�d9��Z0�d�d:�Z1	�d�					�d�d;�Z2�d�d<�Z3e%�d�d=��Z4e%�d�d>��Z4�d�d?�Z4e%�d�d@��Z5e%�d�dA��Z5�d�dB�Z5�d�dC�Z6e7			�d�									�d�dF��Z8dde9jtf							�d�dG�Z;						�d�dH�Z<e%	�d�d&dI�							�d�dJ��Z=e%d&dI�							�d�dK��Z=e%	�d�d&d&dL�							�d�dM��Z=e%d&d&dL�							�d�dN��Z=e'd*d+dEgdO�-�dDe>df							�d�dP��Z=e'd*d+dQgdR�-�									�d�																			�d�dS��Z?e7					�d�					�d�dT��Z@	�d�			�d�dU�ZAe7		�d�					�d�dV��ZBeCe.dWe.dXdYz�Z�ddddddd[dd\ddd]�																									�d�d^��ZD�d�d_�ZEe'd*d+d'gd`�-�eCej�eGdae.dWdb�c�				�d�									�d�dd���ZFe%						�d�													�d�de��ZHe%					�d�													�d�df��ZHe'd*d+dYgdg�-�eCe.dW�h�						�d�													�d�di���ZH	�d�djdddk�									�d�dl�ZIe%																						�d�																																															�d�dm��ZJe%																							�d�																																															�d�dn��ZJe'd*d+d'gdo�-�e(ddpdqdr�2�e(e)jTe)jV�3�																							�d�																																															�d�ds����ZJe%	�d�d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dt�																																	�d�dv��ZKe%d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dt�																																	�d�dw��ZKe'd*d+dugdx�-�eCe.dWe.dXduz�Z�																�d�																																	�d�dy���ZKeCeLfieM��					�d�											�d�dz��ZN�d�d�d{�ZOdd|��d�d}�ZPe�d�d~��ZQ�d�d�d��ZR�d�d��ZS�d�d��ZT�d�d��ZUd��ZVd��ZWd��ZX�d��d�d��ZY�d�d��ZZ�d�d��Z[�d�d��Z\d��Z]d��Z^d��Z_�d�d��Z`		�d�							�d�d��Za	�d�					�d�d��Zb�d�dd��Zc�d�d��Zd	�d�							�dd��Ze�d�d��Zf�dd��Zg�d�d��Zh�dd��Zi�d�d��Zj�dd��Zke%d&d���dd���Zle%�dd���Zle%d&d���dd���Zldd���dd��Zle%d&d���d	d���Zme%�dd���Zmdd���d
d��Zm�d�dd��Zne9jtf									�d
d��Zo�d�d��Zp�dd��Zqed���Zr						�dd��Zse/d��e(eGdaeGd�d�d�d����e/ej�j�ddd��					�d�fd�����ZteCej�eGdaeGd����	�d�dddddde
j�ddd��														�d�fd���Zue%	�d�d&d&d&d&d&d��															�dd���Zwe%	�d�d&d&d&d&d&d&d��															�dd���Zwe%	�d�d&d&d&d&d&d&d��															�dd���Zw	�d�dddddd�d��															�d�fd��Zwe%	�d�d&d&d&d&d&d&d��																	�dd���Zxe%	�d�d&d&d&d&d&d&d&d��																	�dd���Zxe%	�d�d&d&d&d&d&d&d&d��																	�dd���Zx	�d�ddddddd�d��																	�d�fd„Zx�d�fdÄZy				�ddĄZzeCej�eGda�ūd�dde9jtdf											�d�fdDŽ
�Z{e%d&d&d&d&dȜ									�ddɄ�Z|e%d&d&d&dʜ									�dd˄�Z|dddddȜ									�dd̄Z|e%	�d�d&d&d&d&d&dd͜															�dd΄�Z}e%	�d�d&d&d&d&ddϜ															�d dЄ�Z}e%	�d�d&d&d&d&d&dd͜															�d!dф�Z}	�d�dddd�e9jtdd͜															�d"dӄZ}eCej�eGda�ū�d�dԄ�Z~eCej�eGda�ū�d�dՄ�ZeCe�jeGda�ū�d�dք�Z�eCe�jeGda�ū�d�dׄ�Z�e%d&d&d&d&d&d&d؜													�d#dل�Z�e%d&d&d&d&d&dڜ													�d$dۄ�Z�de9jte9jtdddd؜													�d%d܄Z�e%	�d�d&d&dݜ									�d&dބ�Z�e%	�d�d&d&d&dߜ									�d'd��Z�e%	�d�d&d&d&dߜ									�d(d��Z�	�d�d�dddߜ									�d(d�Z�		�d)					�d*d�Z�e%d&d&d&d&d&d&d&d�															�d+d��Z�e%d&d&d&d&d&d&d�															�d,d��Z�dddd�d�ddd�																	�d-d�Z�e%d&d&d&d&d&d&d&d&d�																			�d.d��Z�e%d&d&d&d&d&d&d&d&d&d�																				�d/d��Z�e%d&d&d&d&d&d&d&d&d&d�																				�d0d��Z�ddddd�d�dddd�																				�d1�fd�Z�					�d2											�d3d�Z�	�d4							�d5d�Z�	�d4							�d5d�Z�eCe�jeGdae�d��e�d������d6�d7d���Z��d�d8d��Z�d��Z�d��Z�e�Z�	�d�					�d9d��Z��d��d:d��Z��d;d��Z��d<�d�Z�		�d�					�d=�d�Z��d>�d�Z�ddd�d�	�d?�d�Z��d��d�Z��d@�d�Z��d@�d�Z�dd�d��d?�d	�Z�e/e��j8�d
d���dA�dB�d��Z�e/e��j8�dd���dA�dB�d
��Z�e/e��j8�dd���dA�dB�d��Z�e/e��j8�dd���dA�dB�d��Z�e/e��j8�dd���dA�dB�d��Z�e/e��j8�dd���dA�dB�d��Z�e/e��j8�dd��	�d�			�dB�d��Z�e/e��j8�dd��	�d�			�dB�d��Z�e/e��j8�dd��	�d�			�dB�d��Z�e�Z�e/e��j8�dd��	�d�			�dB�d��Z�e/e��j8�dd��	�d�			�dB�d��Z�e�Z�e/e��j8�d d��	�d�			�dB�d!��Z�e/e��j8�d"d��	�d�			�dB�d#��Z�e�Z�e�Z�e/e��j8�d$d��	�d�			�dB�d%��Z�e�Z�e/e��j8�d&d��	�d�			�dB�d'��Z�e/e��j8�d(d��	�d�			�dB�d)��Z�e/e��j8�d*d��	�d�			�dB�d+��Z�e/e��j8�d,d��	�d�			�dB�d-��Z�e/e��j8�d.d��	�d�			�dB�d/��Z�e/e��j8�d0d��	�d�			�dB�d1��Z�eCe.�d2e��d3�eGda�ū				�dC											�dD�f�d4�
�Z�		�d�							�dE�d5�Z��dF�d6�Z�				�dG							�dH�d7�Z�e/e��d8��e/e.�d9eGz�de9jtdddde9jtdf															�dI�d:���Z��d;e.�d<<e(dҫe/e.�d<�e9jte9jt�d=�	�d��d>���Z��d?e.�d@<e(dҫe/e.�d@�ddd�dAddd�dBe9jtdf
													�dJ�dC���Z�d�e9jte9jtdf							�dK�dD�Z�	�d�					�dL�dE�Z��dM�dN�dF�Z�e/e.�dG�dH�dG�dI�z�						�dO							�dP�dJ��Z�eCe�j�d�dKde��dL���M��dQ�dR�dN��Z�	�d�							�dS�dO�Z�e��dP�Z�e��dQ�Z�eCe.�dReGdaeGd�e�eĐ�S��dT�d?�dT��Z�e�Z�eCe.�dUeGdaeGd���V�	�d�					�dU�dW��Z�							�dV													�dW�dX�Z�	�d�					�dX�dY�Z�	�d�					�dY�dZ�Z�			�dZ							�d[�d[�Z�						�d\															�d]�d\�Z�e(dҫe/e͐d]��^�											�d^																									�d_�d_���Z�	�d�			�d`�d`�Z�			�da							�db�da�Z�			�dc							�dd�db�Z�				�de											�df�dc�ZҐdg�dh�dd�Z�dddd�de�							�di�df�ZԐdj�dg�Z�eCe֐dh�d]��i��ddd�dj�							�dk�dk��Z�eCe֐dl�d]��i��			�dl							�dk�dm��Z�eCe֐dn�d]��i��			�dm					�dn�f�do�
�Z�eCe֐dp�d]��i��			�dm					�dn�f�dq�
�Z�eCe֐dr�d]��i��				�do							�dp�f�ds�
�Z�eCe֐dt�d]��i��				�do							�dp�f�du�
�Z�eCe֐dA�d]��i��			�dm					�dn�f�dv�
�Z�eCe֐dw�d]��i��			�dm					�dn�f�dx�
�Z�eCe֐dy�d]��i��				�dq							�dr�f�dz�
�Z�eCe֐d{�d]��i��				�dq							�dr�f�d|�
�Z�eCe֐d}�d]��i��				�dq							�dr�f�d~�
�Z�eCe֐d�d]��i��			�dm					�dn�f�d��
�Z�eCe֐d��d]��i��			�dm					�dn�f�d��
�Z�e�Z�e�Z�eCe֐d��d]��i���dؐds�d���Z�eCe֐d��d]��i���dؐds�d���Z�eCe֐d��d]��i���dؐds�d���Z�eCe֐d��d]���dؐds�d���Z�dt�du�d��Z�eCe.�d��d�����	�dm							�dv�d���Z�eCe.�d��d�����	�dm							�dv�d���Z�dw�d��Z�	�dl							�dx�d��Z�e%					�d�											�dy�d���Z�e%				�dz											�d{�d���Z�e%					�d�											�d|�d���Z�					�d}											�d|�d��Z�				�d~									�d�d��Z�	�d�							�d��d��Z�d��d��Z�ddgZ�d�e�d�<ie�j��d�dƐd���Z�d�e�d�<e�e�Z�d�Z��d�e�d�<dZ��d�e�d�<e��j�dƐd�����Z�e��j�de��d������Z�e��d�e��j��j��Ze��j��j�Ze��j��j�Ze�d�e��Z�d���Ze�d��d����Z	�x�Z
S(�r�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�sparsezset[str]�
_accessorszfrozenset[str]�
_hidden_attrszBlockManager | ArrayManager�_mgri�c��tS�Nr���selfs �</usr/local/lib/python3.12/site-packages/pandas/core/frame.py�_constructorzDataFrame._constructor�s����c���tj||��}t|�tur|St|�jdk(r|j	|�S|j	|�S)N�r��GeoDataFrame)r��	_from_mgr�type�__name__r�)r��mgrr��dfs    r��_constructor_from_mgrzDataFrame._constructor_from_mgr�sb��
�
 �
 ��4�
 �
0����:��"��I�
�$�Z�
 �
 �N�
2��$�$�S�)�)�� � ��$�$r�zCallable[..., Series]�_constructor_slicedr}c��tj||�}d|_t|�tur|S|j|�Sr�)r}r��_namer�r�r�)r�r�r��sers    r��_constructor_sliced_from_mgrz&DataFrame._constructor_sliced_from_mgr�sA�����s�D�)����	���:��"��J��'�'��,�,r�Nc	�R�d}|�|j|�}t|t�r"|j}d}|s|j	d��}t|t
tf�r�|sItjdt|�j�dt|�j�d�td��t�r|j	d��}|�|�|�|stj||�ytd	d�
�}t|t t"t$f�}t'|dd�}	|}
t|t(�rt+d��t|t(�rt+d
��|�tt|t,�rd}na|dk(r2t|t.j0t$f�r|j2dk(rd}n*t�rt|t"tt f�sd}nd}|�3|�|n
t5d�}|�|n
t5d�}|�|nt7t8�}g}t|t
tf�r|j;|||d�||��}�nt|t,�rt=||||||��}�n�t|t>j@�rEddl!m"}t||jF�rtId��tK|�}tM||||||��}�nt|t.j0t t"t$f�r�|jNjPr-tSt.j0|�}tU||||||��}�nt'|dd��-t�r|nd}
t=|jV|i|||||
��}�n�tM||||||��}�n�tY|�r�t|tZj\�s-t_|d�rt/j`|�}ntc|�}te|�dkDr�tg|d�rti|�}t|t.j0�s;tk|�r0|�tm|�}to||||�\}}}tq|||||��}n�tM||||||��}n�t=i||�|n
t5d�||��}n�|�|�t+d��tm|�}tm|�}|sts|�\}}t|tt�rFtwte|��D�cgc]}ty|te|�|���}}tq|||d|��}n<t{|te|�te|�||�}tM||||jNd|��}t}||��}tj||�|
�Q|rN|	t.j~k(r:|j�j�d|	k7rtjdt�d��yyyyycc}w)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�dtypezindex cannot be a setzcolumns 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!z�Dtype 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�rpro�warnings�warnr�r��DeprecationWarningrrb�__init__rr}rfr[�getattr�set�
ValueError�dict�np�ndarray�ndimrhrI�object�	_init_mgrrsr�MaskedArray�numpy.mar��
MaskedRecords�	TypeErrorrarur��namesrrwr�rErr	�hasattr�asarray�list�lenr=rrrzrirvrqr5rM�ranger2r3rt�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�zDataFrame.__init__�s����	����(�(��/�E��d�I�&��9�9�D��I���y�y�e�y�,���d�\�<�8�9���
�
� ��d��!4�!4� 5�T�$�t�*�:M�:M�9N�O/�/�'� ��#�$��y�y�e�y�,���}���U�]�4�� � ��t�,���1�$�?��%�d�V�U�N�,K�L���T�7�D�1�
����e�S�!��4�5�5��g�s�#��6�7�7��<��$��%����7�"��t�b�j�j�.�%A�B��I�I��N���$�&�z��u�i��0�0������<�"�.�E�M�!�4D�E�!(�!4�g�-��:J�G�"�.�E�L��4H�E��D��d�\�<�8�9��.�.��U�w�?�u�SW�!��C���d�
#��d�E�7�%�d�PW�X�C�
��b�n�n�
-�)��$�� 6� 6�7�����)��.�D� �������
�C���r�z�z�6�5�.�I�
J��z�z����B�J�J��-��&�������
����v�t�,�8� 3� 5��4��!��Y�Y��%������	��%�������
���$�
��d�C�L�L�1��4��-��:�:�d�+�D���:�D��4�y�1�}���Q��(�/��5�D�!�$��
�
�3���8M��*�".�w�"7��-B�����
.�*�F�G�U�(����#�#��C�)����#�!�#�
�C�"���&�2�G�
�a�8H������}��� �!M�N�N� ��'�E�"�7�+�G��2�4�8���q��%��0�
#�3�w�<�0��0��7�t�S��Z��O�0���$�F�G�U�$�G�T��:����J���L�����%�����+�+���
����'�*������s�#��!�&6�:����;S��{�{����"�j�0��
�
� �
"� ��1�<T�&6�!��9s�V$FT�boolc�"�ddlm}|||��S)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__zDataFrame.__dataframe__�s��T	J�"�4�J�?�?r���api_versionc�X�td�}|jj}|||��S)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)r+s    r��!__dataframe_consortium_standard__z+DataFrame.__dataframe_consortium_standard__�s3�� :�:P�Q�� �0�0�X�X�	0�7�t��U�Ur�c��tdd��}|�|jj|�}|jj	||��}|j�S)a�
        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
        �pyarrowz14.0.0)�min_version)�schema)r�Schema�_import_from_c_capsule�Table�from_pandas�__arrow_c_stream__)r��requested_schema�pa�tables    r�r5zDataFrame.__arrow_c_stream__�sU��*(�	�x�
H���'�!�y�y�?�?�@P�Q�����$�$�T�2B�$�C���'�'�)�)r�c�2�|j|jgS)a�
        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�zDataFrame.axess���
�
�D�L�L�)�)r�c�V�t|j�t|j�fS)a�
        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)
        )rr�r�r�s r��shapezDataFrame.shapes ��(�4�:�:���D�L�L� 1�1�1r�c��t|jjD�chc]}|j��c}�dkScc}w)aQ
        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�)rr�rr�)r��arrs  r��_is_homogeneous_typezDataFrame._is_homogeneous_type-s6��2����)9�)9�:�)9�#�C�I�I�)9�:�;�q�@�@��:s�;c��t|jt�ry|jj}t	|�dk7ry|dj
}t
|�S)zY
        Can we transpose this DataFrame without creating any new array objects.
        Fr�r)r�r�ro�blocksrr�r:)r�r@r�s   r��_can_fast_transposezDataFrame._can_fast_transposeHsN��
�d�i�i��.�����!�!���v�;�!����q�	����&�u�-�-�-r�c��|j}t|t�rnt|j�dk(rAt|jdj�s|jdjdd�St|j�S|j}t|�dk7rt|j�S|dj}|jdk(r|jStd|�}|jS)zK
        Analogue to ._values that may return a 2D ExtensionArray.
        r�r����9np.ndarray | DatetimeArray | TimedeltaArray | PeriodArray)r�r�rorrr:r��reshaper_rr@rr�T)r�r�r@r=s    r��_valueszDataFrame._valuesWs���
�i�i���c�<�(��3�:�:��!�#�,?��
�
�1�
�@S�@S�,T��z�z�!�}�,�,�R��3�3�1�$�+�+�>�>������v�;�!��1�$�+�+�>�>��Q�i�����8�8�q�=��;�;���N�PS�T���u�u�r�c�4�td�}t|�|kS)z0
        Check length against max_rows.
        �display.max_rows)rr)r��max_rowss  r��_repr_fits_vertical_zDataFrame._repr_fits_vertical_us���0�1���4�y�H�$�$r�c��tj�\}}td�}t|j�}|r||kDs
|r	||dzkDry|�tj
�sytd��tj�rd}ntd�}t�}|}|�#|jdt|t|��}ny|j|�	�|j�}td
�|jd�D��}	|	|kS)z�
        Check if full repr fits in horizontal boundaries imposed by the display
        options width and max_columns.
        �display.max_columnsr�FNTz
display.widthr�rI��bufc3�2K�|]}t|����y�wr�)r)�.0�lines  r��	<genexpr>z3DataFrame._repr_fits_horizontal_.<locals>.<genexpr>�s����A�/@�t��T��/@����
)r��get_console_sizerrr��in_interactive_session�in_ipython_frontendrr�min�	to_string�getvalue�max�split)
r��width�height�max_columns�
nb_columnsrJrO�d�value�
repr_widths
          r��_repr_fits_horizontal_z DataFrame._repr_fits_horizontal_|s���
 �0�0�2�
��v� �!6�7������&�
�
�J��4��j�E�Q�J�/���=�� >� >� @���o�&�2�g�6Q�6Q�6S��H�!�"4�5�H�
�j��
�������.��X�s�1�v�.�/�A��	������������A�u�{�{�4�/@�A�A�
��E�!�!r�c�l�td�dk(}|xr#|j�xr|j�S)z=
        True if the repr should show the info view.
        zdisplay.large_repr�info)rrerK)r��info_repr_options  r��
_info_reprzDataFrame._info_repr�sA��&�&:�;�v�E���
��'�'�)�I�d�.G�.G�.I�%
�	
r�c���|j�r,t�}|j|��|j�St	j
�}|jdi|��S)zL
        Return a string representation for a particular DataFrame.
        rN�)rirrgr[�fmt�get_dataframe_repr_paramsrZ)r�rO�repr_paramss   r��__repr__zDataFrame.__repr__�sQ���?�?���*�C��I�I�#�I���<�<�>�!��3�3�5���t�~�~�,��,�,r�c��|j�rVt�}|j|��|j�j	ddd�}|j	ddd�}d|�d�Std	�r�td
�}td�}td�}td
�}t
j|fidd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�d|�d|�d|�d |�d!d"��}t
j|�jd�#�Sy)$zp
        Return a html representation for a particular DataFrame.

        Mainly for IPython notebook.
        rN�<z&lt;r��>z&gt;z<pre>z</pre>zdisplay.notebook_repr_htmlrIzdisplay.min_rowsrMzdisplay.show_dimensionsr�N�	col_space�na_rep�NaN�
formatters�float_format�sparsify�justify�index_namesT�headerr��	bold_rows�escaperJ�min_rows�max_cols�show_dimensions�decimal�.)�notebook)
rirrgr[�replacerrl�DataFrameFormatter�DataFrameRenderer�to_html)r�rO�valrJr~rr��	formatters        r��_repr_html_zDataFrame._repr_html_�sr���?�?���*�C��I�I�#�I���,�,�.�(�(��g�q�9�C��+�+�c�7�A�.�C��3�%�v�&�&��2�3�!�"4�5�H�!�"4�5�H�!�"7�8�H�(�)B�C�O��.�.��������	�
 ��"�
�����!����������"��"�� "�!�"!0�#�$�%�I�(�(�(��3�;�;�T�;�J�J�r�.rOc��yr�rk�r�rOr�rsr{r�rtrvrwrxrzryrJrr�r��
line_widthr~�max_colwidth�encodings                    r�rZzDataFrame.to_string����.	r�c��yr�rkr�s                    r�rZzDataFrame.to_stringr�r�z3.0r�rZ)�version�allowed_argsr�zbool or list of strzkWrite out the column names. If a list of columns is given, it is assumed to be aliases for the column nameszint, list or dict of intz�The 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_typers)�
shared_params�returnsc���ddlm}|d|�5tj|f||||||	||
|||||
||d��}tj|�j|||��cddd�S#1swYyxYw)ax
        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_contextzdisplay.max_colwidth)r�rsrtrvrwrxryrzr{r�r~rJrr�r�)rOr�r�N)�pandasr�rlr�r�rZ)r�rOr�rsr{r�rtrvrwrxrzryrJrr�r�r�r~r�r�r�r�s                      r�rZzDataFrame.to_strings���~	*�
�2�L�
A��.�.����#��%�)�!��'���!�!�!� /��!�I�$�(�(��3�=�=��!�%�>��'B�
A�
A�s�AA%�%A.c�|�|jj|||||��}|j||j��S)N)rw�date_formatr�rt�quotingr�)r��get_values_for_csvr�r�)r�rwr�r�rtr�r�s       r��_get_values_for_csvzDataFrame._get_values_for_csvxsH���i�i�*�*�%�#����+�
���)�)�#�C�H�H�)�=�=r�c��ddlm}||�S)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.
        rr�)�pandas.io.formats.styler�)r�r�s  r��stylezDataFrame.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#�K�|jjr3t|d�r'|jD]}||j|�f���yt	|j�D]\}}||j|d��f���y�w)N�_item_cacher��r�)r��	is_uniquer�_get_item_cache�	enumerate�_ixs)r��k�is   r�r�zDataFrame.items�sq�����<�<�!�!�g�d�M�&B��\�\����-�-�a�0�0�0�"�"�$�,�,�/���1�����1�1��-�-�-�0�s�A?Bc#�ZK�|j}|j}t�}t|j|j
�D]b\}}||||��j
|�}|r;|jjr%|jj|j�||f���dy�w)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��iterrowszDataFrame.iterrows�s�����Z�,�,���(�(��'�)�	���
�
�D�K�K�0�D�A�q��a�w�Q�/�<�<�T�B�A��T�Y�Y�6�6����%�%�d�i�i�0��Q�$�J�	1�s�B)B+c�x��g}t�j�}|r-|j�j�|j	dd�|j�fd�t
t�j��D��|�4tj||d��}t|jt|��St|�S)a�
        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)
        rrfc3�D�K�|]}�jdd�|f���y�wr�)r)rQr�r�s  �r�rSz'DataFrame.itertuples.<locals>.<genexpr>^s �����H�/G�!�d�i�i��1��o�/G�s� T)�rename)
r
r��appendr��insert�extendrr�collections�
namedtuple�map�_maker�)r�r�r�r�fields�	itertuples`     r��
itertupleszDataFrame.itertupless����@���d�l�l�#����M�M�$�*�*�%��M�M�!�W�%�	�
�
�H�u�S����5F�/G�H�H���$�.�.��f�T��I��y����V��5�5��F�|�r�c�,�t|j�S)zI
        Returns length of info axis, but here we use the index.
        )rr�r�s r��__len__zDataFrame.__len__ks���4�:�:��r�c��yr�rk�r��others  r��dotz
DataFrame.dotq���r�c��yr�rkr�s  r�r�z
DataFrame.dotur�r�c�p�t|ttf�r�|jj	|j
�}t
|�t
|j�kDs!t
|�t
|j
�kDrtd��|j|d��}|j|d��}|j}|j}ng|}|j}tj|�}|jd|jdk7r%td|j�d|j����t|t�rrtt|j �t|j �z�}|j#tj$||�|j
|jd|�	�St|t�r_tt|j �|j gz�}|j'tj$||�|j
d|�
�St|tj(t*f�ratj$||�}|j,dk(r|j#||j
d��S|j'||j
d��St/dt1|�����)
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
        zmatrices are not alignedF�r�r��r�r�r�rzDot product shape mismatch, z vs �r�r�r�r�)r�r�r�r�zunsupported type: )r�r}r�r��unionr�rr��reindexrrGrrr;r4r
rr�r�r�rrfrr	r�)	r�r�rQ�left�right�lvals�rvals�common_type�results	         r�r�z
DataFrame.dotys1��Z�e�f�i�0�1��\�\�'�'����4�F��6�{�S����.�.�#�f�+��E�K�K�@P�2P� �!;�<�<��<�<��U�<�;�D��M�M��U�M�;�E��K�K�E��M�M�E��D��K�K�E��J�J�u�%�E��{�{�1�~����Q��/� �2�5�;�;�-�t�E�K�K�=�Q����e�Y�'�*�4����+<�t�E�L�L�?Q�+Q�R�K��$�$����u�e�$��j�j��
�
��!�%��
���v�
&�*�4����+<����~�+M�N�K��+�+����u�e�$�D�J�J�U�+�,��
����
�
�E�2�
3��V�V�E�5�)�F��{�{�a���(�(��t�z�z��(�N�N��/�/��d�j�j�u�/�U�U��0��e��
�>�?�?r�c��yr�rkr�s  r��
__matmul__zDataFrame.__matmul__�r�r�c��yr�rkr�s  r�r�zDataFrame.__matmul__�r�r�c�$�|j|�S)�B
        Matrix multiplication using binary `@` operator.
        )r�r�s  r�r�zDataFrame.__matmul__�s���x�x���r�c��	|jjtj|��jS#t$rE}dt|�vr�dtj|��d|j�d�}t	|�|�d}~wwxYw)r�zshape mismatchzshapes z and z not alignedN)rFr�r�	transposer��strr;)r�r��err�msgs    r��__rmatmul__zDataFrame.__rmatmul__�su��	+��6�6�:�:�b�l�l�5�1�2�4�4�4���	+��s�3�x�/���B�H�H�U�O�,�E�$�*�*��\�J�C��S�/�s�*��	+�s�7:�	B�AB�Br�orientc��d}|j�}|dk(r�t|�dkDr�ttt	|j���ttf�rt|�}nWt|j��}t|j��}n$|dvr|�td|�d���td|�d���|d	k7r|||||�
�S|d}d�}||d|d
�}||d|d�}|||||�
�S)aZ
        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�rc�t�t|�dkDrtj||��}|St||d��}|S)Nr��r
r�r�)rrk�from_tuplesrf)�	indexlist�namelistr�s   r��create_indexz)DataFrame.from_dict.<locals>.create_index�s>���x�=�1�$�&�2�2�9�H�M�E���"�)�(�1�+�>�E��r�rzr��column_names)�lowerrr��next�iterrr}r�_from_nested_dictr
�keysr�)�clsrr�r�r�r��realdatar�s        r��	from_dictzDataFrame.from_dict
s��t��������W���4�y�1�}��d�4����
�#6�7�&�$��H�,�T�2�D� �����-�E� ����
�.�D�
�+�
+��"� �#M�f�X�UV�!W�X�X����x�y�*��
�
�W���t�5�'��G�G��F�|�H�
�!��g���]�0C�D�E�"�4�	�?�D��4H�I�G��x�u�g�U�K�Kr�c��|�tj|�}|jj|||��}|j|urtj||��}|S)a1
        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�)rr�r��as_arrayr)r�r�r�r�r�s     r��to_numpyzDataFrame.to_numpy�sT��t���H�H�U�O�E����#�#�%�d�X�#�N���<�<�u�$��Z�Z��e�4�F��
r�c	�$�|r9|jdd��D�cgc]}ttt|����}}|S|jdd��D�cgc]
}t|���}}|r|D]}|D]}t||�||<��|Scc}wcc}w)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_dictz2DataFrame._create_data_for_split_and_tight_to_dict�s���%����u�4��@��@�A��S�)�1�-�.�@�
����&*�_�_�5�t�_�%L�M�%L��D��G�%L�D�M�#� �C�1��!1�#�a�&�!9��A��2� ������
Ns� B�B
�r�c��yr�rk�r�r��intor�s    r��to_dictzDataFrame.to_dict����	r�c��yr�rkrs    r�rzDataFrame.to_dict�rr��rr�c��yr�rkrs    r�rzDataFrame.to_dict�rr�c��yr�rkrs    r�rzDataFrame.to_dictrr�rc�&�ddlm}|||||��S)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)rr
)�pandas.core.methods.to_dictr)r�r�rr�rs     r�rzDataFrame.to_dicts��b	8��t�V�$�e�<�<r��destination_table�to_gbqc
�H�ddlm}|j||||||||||	|
��y)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.iorr)r�rrrrrrrrrrrs            r�rzDataFrame.to_gbq�s:��t	"��
�
���!����!5�%��%�#�	�	
r�c�\�t|t�rrtjdtt���|�t
|�r|g}||}|�|j|�}|�|j|��}|jd��Sd}|�t|�}								dd�}t|�r�|dk(r|�S	t|�}	d}
t|	d
�r"|	jj r|	j}
|	g}|�||z
}n(|j#t%j&||dz
��|
�t)j*||
��}n|}t|t,�r�|�)tt/|��x}}|D�
cgc]}
||
��	}}
n�g}g}|j1�D],\}
}|
|vs�|j3|
�|j3|��.t5|�}|||||�\}}}n�t|t(j6�rt9||�\}}|}nqt9||�\}}|rAt;|�D]3\}}|jt<k(s�t?j@|d
��||<�5t|�}|�|}n|||||�\}}}|�tC�}ntC|�}|��t|tD�st|d�sO|jG|�}|jI|�tK|�dkDrt5|||��}nNt5g|��}n@	|D�cgc]}||jG|���}}tM||��}|jO|�tU|�re|D�cgc]	}||vs�|��}}|D�cgc]}|jG|���}}t;|�D��cgc]\}}||vs�|��}}}|j|�}tWdd
��}tY||||��}|j[||j\��S#t$r
|||�	�cYSwxYwcc}
wcc}w#tPtRf$r|}Y��wxYwcc}wcc}wcc}}w)a`

        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��t|�rt|d�}nd}d}t|�dk(r|�|dk(rtd�}t||||�\}}|||fS)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.
            rN)rrhrx)r�arr_columnsr�r��length�result_indexs      r��
maybe_reorderz-DataFrame.from_records.<locals>.maybe_reorderz	sd���6�{��V�A�Y������L��6�{�a��E�M�f��k�,�Q�/��"0���g�v�"V��F�K��;��4�4r�rr�r�r�r�T)�	try_float�__iter__r�r�r�r�r�r�)rzlist[ArrayLike]rrfr�rf�returnz+tuple[list[ArrayLike], Index, Index | None])/r�r�r�r�rr+rF�	set_index�dropr�rirDr��
StopIterationrr�r
r��	itertools�islicerr�r�sortedr�r�rfrryr�rr�maybe_convert_objectsr�r��get_loc�addrrj�update�KeyErrorr	�anyrrqr�r�)r�rr��excluder��coerce_float�nrowsr!r"�	first_rowr�rrr�r�arr_columns_listr�r�r=�field�
index_data�x�arr_exclude�col�	to_removerr�s                           r��from_recordszDataFrame.from_records	sM��j�d�I�&��M�M�I��+�-�	
��"��W�%�&�i�G��G�}��� ��~�~�e�,���"��y�y��y�1���9�9�%�9�(�(�����"�7�+�G�	5�#�	5�27�	5�BG�	5�
8�	5�&�t����z��u��
9� ��J�	��E��y�'�*�y���/D�/D�!�����[�F��}��$����
�
�i�.�.�t�U�Q�Y�?�@�� ��x�x��e�4�����d�D�!���(4�V�D�\�(B�B��+�+2�3�7�a�$�q�'�7��3���#%� � �J�J�L�D�A�q��G�|�(�/�/��2��
�
�a�(�)�
$�$4�5��4A��K��%�5�1���\���b�j�j�
)�'��g�6�O�F�G�!�K�"+�D�'�":��F�K��'��/�F�A�s��y�y�F�*�%(�$=�$=��&*�%��q�	�0�'�{�3�K���%��4A��K��%�5�1���\��?��e�G��'�l�G����%��%�W�U�J�-G��O�O�E�*�����E�"��v�;��?�#(�����#?�L�#(��%�#8�L�*�RW�!X�RW��&��)<�)<�U�)C�"D�RW�J�!X�
$?�z�QV�#W�L��N�N�5�)��w�<�&-�B�g���k�1A�1�g�K�B�=H�I�[�c��,�,�S�1�[�I�I�$-�f�$5�L�$5�D�A�q��)�9K�a�$5�F�L��l�l�7�+�G��1�$�?���F�G�\�w�G���}�}�S�s�x�x�}�0�0��{!�
9����8�8�
9��,4��j"Y�� �)�,�)�#(�L�)��C��I��LsZ�6O$�,O=�<P�P�P�
	P�P�P#�P(�P(�$O:�9O:�P�P�Pc	��|�r9t|jj�D�cgc]0}tj|jj|����2}}|tt
|j��D�cgc](}tj|jdd�|f���*c}z}t|jj�}t|jt�rtj|�}n|d�dg}tj ||j�D�cgc]
}t#|���}	}nstt
|j��D�cgc](}tj|jdd�|f���*}}|jD�
cgc]
}
t#|
���}	}
g}t
|�}g}t%|�D]�\}}
|}||kr|}||}n||z}|}|j|}t'|�r||vr||}n||vr||}nd}|�|j)|
j*��jt|t,tj*t"f�r|j)|���||krdnd}d|�d|�d|��}t/|��tj0j3||	|d	��
�Scc}wcc}wcc}wcc}wcc}
w)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')])
        Nrr�r�columnzInvalid dtype z specified for � )r
�formatsr�)rr��nlevelsrr�get_level_valuesrr�rr
r
r�rk�com�fill_missing_namesr)�chainr�r�r>r�r�r�r��rec�
fromarrays)r�r��
column_dtypes�index_dtypesr��ix_valsrrzr�r
�c�	index_lenrAr��	index_int�
dtype_mapping�elementr�s                  r��
to_recordszDataFrame.to_records�	s���f��t�z�z�1�1�2��2�A��
�
�4�:�:�6�6�q�9�:�2�
��
�5:�3�t�|�|�;L�5M� �5M���
�
�4�9�9�Q��T�?�+�5M� ��F��t�z�z�/�/�0�K��$�*�*�j�1�!�4�4�[�A���Q��'�&�i��+4�?�?�;����+U�V�+U�4�S��Y�+U�E�V�;@��T�\�\�AR�;S�T�;S�a�b�j�j����1�a�4��1�;S�F�T�%)�\�\�2�\��S��V�\�E�2��K���$�	����f�%�D�A�q��I��9�$� ,�
�"�9�-���Y�&�	� -�
��|�|�I�.���M�*��=�(�$1�$�$7�M��-�/�$1�)�$<�M�$(�M��$����q�w�w�'��M�D�"�(�(�C�+@�A����}�-�#$�y�=�%�h��&�}�o�_�W�I�Q�t�f�U�� ��o�%�_&�b�v�v� � ���7�/S� �T�T��U��
 ��W��T��2s�5J-�=-J2�(J7�-J<�Kc���|�t|�}tdd��}t|�}t|�t|�k7rt	d��t||||||��}|j
||j��S)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�)rIrrirr�rqr�r�)r�rr�r�r�rSrr�s        r��_from_arrayszDataFrame._from_arrays�
s}��B�� ��'�E��1�$�?���w�'���w�<�3�v�;�&��B�C�C������-��

���}�}�S�s�x�x�}�0�0r��storage_options�compression_options�path)rUrV�r�infer)�
convert_dates�write_index�	byteorder�
time_stamp�
data_label�variable_labelsr��convert_strl�compressionrU�value_labelsc
���|dvrtd��|dk(r|	�td��ddlm}
n|dk(rdd	lm}
ndd
lm}
i}|�|dk\r|	|d<|�|dk\r||d
<|
||f|||||||
||d�	|��}|j�y)a3
        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
        )rX�u�v�wNz1Only formats 114, 117, 118 and 119 are supported.rXNz#strl is not supported in format 114r)�StataWriterrd)�StataWriter117)�StataWriterUTF8r`rer�)	rZr\r]r^r[r_rarUrb)r��pandas.io.statargrhri�
write_file)r�rWrZr[r\r]r^r_r�r`rarUrb�statawriter�kwargs�writers                r��to_statazDataFrame.to_stata�
s���\�4�4��P�Q�Q��c�>��'� �!F�G�G�B�
��^�
�
�"$���?�g��n�%1�F�>�"��?�g��n� '�F�9�����

�(��!�!�#�+�#�+�%�

��

��	���r�c�$�ddlm}|||fi|��y)a5
        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_formatrq)r�rWrmrqs    r�rqzDataFrame.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�rU�examplesc�N�d|vrtd��|jdd�|jdd�|jd|�td�}|j|fi|��}|�|St	|||��5}|j
j
|�ddd�y#1swYyxYw)	N�	showindexz"Pass 'index' instead of 'showindex�headersr��tablefmt�pipe�tabulate�rU)r��
setdefaultrrzr��handle�write)	r�rO�moder�rUrmrzr��handless	         r�rszDataFrame.to_markdown|s���J�&� ��A�B�B����)�V�,����*�f�-����+�u�-�-�j�9��"��"�"�4�2�6�2���;��M�
��T�?�
C�w��N�N� � ��(�D��D��s�6B�B$c��yr�rk�r�rW�enginerar��partition_colsrUrms        r��
to_parquetzDataFrame.to_parquet����	r�c��yr�rkr�s        r�r�zDataFrame.to_parquet�r�r�r�r{c�.�ddlm}||||f||||d�|��S)aL

        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�)rar�r�rU)�pandas.io.parquetr�)	r�rWr�rar�r�rUrmr�s	         r�r�zDataFrame.to_parquet�s;��z	1�����	
�$��)�+�	
��	
�		
r�r.�r�r��
engine_kwargsc�(�ddlm}||||||��S)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�rWr�r�r�r�s      r�r�zDataFrame.to_orc4s ��d	)���$�v�U�-�
�	
r�c��yr�rk�r�rOr�rsr{r�rtrvrwrxrzryrJrr�r�r|�classesr}r��border�table_id�render_linksr�s                        r�r�zDataFrame.to_html����6	r�c��yr�rkr�s                        r�r�zDataFrame.to_html�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	��|�|tjvrtd��tj|fid|�d|�d|�d|�d|�d|�d|�d	|�d
|	�d|�d|
�d
|�d|�d|�d|
�d|��}tj|�j|||||||��S)a
        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�rsrtr{r�rvrwr|rxryrzr}r�rJrr�)rOr�r�r�r�r�r�)rl�VALID_JUSTIFY_PARAMETERSr�r�r�r�)r�rOr�rsr{r�rtrvrwrxrzryrJrr�r�r|r�r}r�r�r�r�r�r�s                         r�r�zDataFrame.to_html�s��p��7�#�2N�2N�#N��B�C�C��*�*��
��
� �
��	
�
�
��

�"�
�&�
� �
��
��
�$�
��
��
��
� �!
�",�#
�	�(�$�$�Y�/�7�7�������%�8�
�	
r�)r��	root_name�row_namert�	attr_cols�	elem_cols�
namespaces�prefixr��xml_declaration�pretty_print�parser�
stylesheetrarU�path_or_bufferc��yr�rk�r�r�r�r�r�rtr�r�r�r�r�r�r�r�r�rarUs                 r��to_xmlzDataFrame.to_xml?
���*	r�c��yr�rkr�s                 r�r�zDataFrame.to_xmlV
r�r�r�c���ddlm}m}tdd��}|
dk(r|�|}nt	d��|
dk(r|}ntd	��||f|||||||||	|
|||||d
��}|j
�S)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�rtr�r�r�r�r�r�r�r�rarU)�pandas.io.formats.xmlr�r�r�ImportErrorr��write_output)r�r�r�r�r�rtr�r�r�r�r�r�r�r�r�rarUr�r�r��TreeBuilder�
xml_formatters                      r�r�zDataFrame.to_xmlm
s���H	
�
*�,�x�H���V����.��!�M����w�
�+�K��K�L�L�#��
�)�������!���+�%�!�#�+�!
�
�&�)�)�+�+r�c�H�t||��}|j||||��y)N)r�memory_usage)rOr�verbose�show_counts)r��render)r�r�rOrr�r�rgs       r�rgzDataFrame.info>s3����%�
��	
������#�		�	
r�c
�P�|j|j�D��cgc]\}}|jd|����c}}|jtj
��}|r?|j|jj|��dg��}|j|�}|Scc}}w)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�rfr)r�r�r�r�r�intpr��_append)r�r�r�r;rLr��index_memory_usages       r�r�zDataFrame.memory_usageRs���r�)�)�BF�*�*�,�O�,���Q�Q�^�^�%�d�^�
3�,�O��,�,��'�'�*�
��
�!%�!9�!9��
�
�'�'�T�'�2�7�)�":�"��(�/�/��7�F��
��
Ps�B"
�r�c��tj|i�t|j�}|jr�|j
j}|rt�s|j�}|j||j|jd|j��}t��r�t|�dkD�r�|jj|j��n�|j �r|�rt#|dt$�r�t#|dt&�r2ddlm}|t-t.t0|j3���}n�t#|dt4�r0ddlm}m}	|	t-t.||j3���}nA|d}
|
j=�}|j>}|D�
cgc]}
|jA|
|
����}}
tC|�jE||j|jd��}nf|j>j}|rt�s|j�}|j||j|j|jd��}|jG|d	�
�Scc}
w)a?

        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�rS)r�r�r�r�r���method)$�nv�validate_transposer
rrArGrFrr�r�r�r�r�rr�r�r>r�rMrL�pandas.core.arrays.maskedr�rr	rY�_iter_column_arraysrK�pandas.core.arrays.arrow.arrayr�r��construct_array_typer�_from_sequencer�rTr�)r�r��argsr�new_valsr�r��
new_valuesr�r��dtyp�arr_typrr�new_arrs               r�r�zDataFrame.transpose�s��Z	���d�B�'��d�k�k�"���#�#��|�|�~�~�H��/�1�#�=�=�?���&�&���l�l��
�
���n�n�'��F�#�$��T��Q�����*�*�4�9�9�5�
�%�%���6�!�9�n�5��&��)�_�5��A���/�2�D�4L�4L�4N�O��
��F�1�I�z�2��
;���"5�6��8P�8P�8R�S��
�
�a�y���3�3�5������QW�X�QW�#�g�4�4�S��4�E�QW�
�X��$�Z�,�,���l�l��
�
�!&�	-��F��k�k�m�m�G��/�1�!�,�,�.���&�&���l�l��
�
��m�m��
'��F��"�"�4��"�<�<��-Ys�/I7c�"�|j�S)a�
        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�rFzDataFrame.Tos��6�~�~��r�rr�c��|dk(r�|jj|�}t|jtj
�xr|jjdu}|j||j��}|j||_
|j|�}|j||��|S|j|}|jj|�}|j||�}|j!||�|S)z�
        Parameters
        ----------
        i : int
        axis : int

        Returns
        -------
        Series
        rNr�r�)r��fast_xsr�r�rr�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�zDataFrame._ixs�s����1�9��i�i�'�'��*�G��g�m�m�R�Z�Z�8�W�W�]�]�=O�=O�SW�=W�D��6�6�w�W�\�\�6�R�F��:�:�a�=�F�L��(�(��.�F�����4��0��M��L�L��O�E��i�i�n�n�Q�'�G��)�)�'�1�5�F�
�!�!�%��.��Mr�c�8�|jj|�S)a
        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_arrayzDataFrame._get_column_array�s���y�y�$�$�Q�'�'r�c#��K�t|jt�r|jjEd{���yt	t|j��D]}|j|����y7�<�w)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�rorrrr�r�r�s  r�r�zDataFrame._iter_column_arrays�sW�����d�i�i��.��y�y�'�'�'�'��3�t�|�|�,�-���,�,�Q�/�/�.�
(�s�4A5�A3�=A5c��|jj|d�d}|j|}|jj||dddd��}|j	||j
��}|j
|�}|S)zt
        Behaves like __getitem__, but returns a view in cases where __getitem__
        would make a copy.
        r�r�rTF)r��
allow_dupsr��
only_slicer�)r��_get_indexer_strictr��reindex_indexerr�r�r�)r��key�indexer�new_axisr�r�s      r��_getitem_nocopyzDataFrame._getitem_nocopy�s����,�,�2�2�3�	�B�1�E���<�<��(���)�)�+�+�������
,�
���+�+�G�'�,�,�+�G���$�$�T�*���
r�c�N�t|�tj|�}tj||�}t|�r�t
|�s�t|jt�}|sS|jjr||jvs||jjd��vr|j|�S|r5|jjr||jvr|j|�St|t�r|j|�St|t �r|j#|�Stj$|�r|j'|�St|t(�xst+|�}|rT|jj,dkDr|j|�S|jj/|�}t1|�r9|g}n5t
|�rt3|�}|jj5|d�d}t7|dd�t8k(rt;j"|�d}t|t�r|j=|d��S|j?|d��}|r=|j@ddk(r+t|jt�s|j|�S|S)NF��keepr�r�r�rr�)!rnr�item_from_zerodimrD�apply_if_callablerArDr�r�rkr��drop_duplicatesr��_getitem_multilevel�slice�_getitem_slicer��where�is_bool_indexer�_getitem_bool_array�tuplerErBr-rBr
r�r�rr�_slice�_take_with_is_copyr;)r�r��is_mi�
is_single_keyr�rs      r��__getitem__zDataFrame.__getitem__�s9��"�3�'��#�#�C�(���#�#�C��.���s��K��$4��t�|�|�Z�8�E�����&�&��4�<�<�'��$�,�,�6�6�E�6�B�B��+�+�C�0�0��4�<�<�1�1�c�T�\�\�6I��/�/��4�4��c�5�!��&�&�s�+�+��c�9�%��:�:�c�?�"����s�#��+�+�C�0�0�#�3��.�G�l�3�6G�2G�
���|�|�#�#�a�'��/�/��4�4��l�l�*�*�3�/�G��'�"�"�)���3���3�i���l�l�6�6�s�I�F�q�I�G��7�G�T�*�d�2��h�h�w�'��*�G��g�u�%��;�;�w�Q�;�/�/��&�&�w�Q�&�7���
�z�z�!�}��!�*�T�\�\�:�*N��+�+�C�0�0��r�c��t|t�rJ|jj|j�s%t	j
dtt���nOt|�t|j�k7r.tdt|��dt|j��d���t|j|�}|j�r|jd��S|j�d}|j|d��S)	Nz>Boolean Series key will be reindexed to match DataFrame index.r��Item wrong length � instead of r�r�rr�)r�r}r��equalsr�r��UserWarningr+rr�rm�allr��nonzeror�)r�r�r�s   r�r�zDataFrame._getitem_bool_array"s����c�6�"�3�9�9�+;�+;�D�J�J�+G��M�M�P��+�-�
�
��X��T�Z�Z��
(��$�S��X�J�l�3�t�z�z�?�:K�1�M��
�!����S�1���7�7�9��9�9�$�9�'�'��+�+�-��"���&�&�w�Q�&�7�7r�c��|jj|�}t|ttj
f�r�|j|}t
||�}|jdd�|f}||_t|j�dk(r\|jd}t|t�r|d}|dk(r3|d}t|t�r|j||j|��}|j|�|S|j|d��S)Nr�r�r�r�)r�r-r�r�rrrlrrr�r}r�r�r�r�)r�r��loc�new_columns�result_columnsr��tops       r�r�zDataFrame._getitem_multilevel=s����l�l�"�"�3�'���c�E�2�:�:�.�/��,�,�s�+�K�-�k�3�?�N��Y�Y�q�#�v�&�F�+�F�N��6�>�>�"�a�'��n�n�Q�'���c�5�)��a�&�C��"�9�#�B�Z�F�!�&�&�1�!%�!9�!9�"�$�*�*�3�":�"��
����%��M��9�9�S�q�9�)�)r�c�`�|r"|j|d��}|j|S|j|�}|jj}t|jt�s*|jj|�}|j|S|j|�}|j|S)a�
        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�rGr�r��_enginer�rkr-)r�r�r;�takeable�seriesr�rrs        r��
_get_valuezDataFrame._get_value_s���&��Y�Y�s��Y�+�F��>�>�%�(�(��%�%�c�*�����#�#���$�*�*�j�1��*�*�$�$�U�+�C��>�>�#�&�&��n�n�U�#���~�~�c�"�"r�c���t|t�r�t|�r|g}t|�t|j�k7r.tdt|��dt|j��d���t
|�D]?\}}|j|jdd�|f�\}}|j||d|���Ay|j|�\}}|j||d|��y)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``.
        zGot z positions but value has z	 columns.NF�r��refs)
r�r�rBrr�r�r��_sanitize_columnr�_iset_item_mgr)r�rrcr��idx�	arraylikers       r��isetitemzDataFrame.isetitem�s���0�e�Y�'��#���e���3�x�3�u�}�}�-�-� ��3�s�8�*�$=�c�%�-�-�>P�=Q�R� ���
$�C�.���3�"&�"7�"7��
�
�1�a�4�8H�"I��	�4��#�#�C��E��#�M�)�
��/�/��6��	�4����C��E���Er�c�l�tsCt�r9tj|�dkr�t	j
ttd��n�ts|t�srtj|�dkrZt�s0t�sFtd�|jjD��r t	j
ttd��tj||�}t!|t"�r/|j$j'|d��}|j)||�St!|t*�st-|dd�dk(r|j/||�yt!|t0t2j4t6t8f�r|j;||�yt!|t*�r|j=||�yt?|�rd|j@jBsNdtE|j@jG|g��cxkrtE|�k(rnn|j;|g|�y|jI||�y)	N�r�r�c3�PK�|]}|jj���� y�wr�)r�
has_reference)rQ�bs  r�rSz(DataFrame.__setitem__.<locals>.<genexpr>�s ����M�<L�q�A�F�F�0�0�2�<L�s�$&�getitem)�kindrr�)%rr�sys�getrefcountr�r�r$r!rr1r�r@r&rrDr�r�r�r��_convert_slice_indexer�_setitem_slicer�r��_setitem_framer}rrr
rf�_setitem_array�_set_item_frame_valuerEr�r�r�get_indexer_for�	_set_item)r�r�rc�slcs    r��__setitem__zDataFrame.__setitem__�s����+�-����t�$��)��
�
�+�-C�PQ���1�3����t�$��)�"�$�*�,��M�D�I�I�<L�<L�M�M��
�
�3�]�q���#�#�C��.���c�5�!��*�*�3�3�C�i�3�H�C��&�&�s�E�2�2��c�9�%���f�d�)C�q�)H�����U�+�
��f�b�j�j�$��>�
?�����U�+�
��y�
)��&�&�s�E�2�����L�L�*�*��C����4�4�c�U�;�<�J��E�
�J�
�����u�-�
�N�N�3��&r�c�B�|j�||j|<yr�)�_check_setitem_copyr�r�r�rcs   r�r"zDataFrame._setitem_slice�s��	
� � �"���	�	�#�r�c��tj|�r�t|�t|j�k7r.t	dt|��dt|j��d���t|j|�}|j
�d}|j�t|t�r*|j|jj|��}||j|<yt|t�r>t|j||�t||j�D]
\}}||||<�yt!|�s
|D]}|||<�	yt|t"j$�r"|j&dk(r|j)||�yt#j&|�dkDr't|�j*}|j-||�S|j)||�y)Nr�r�!rr�r�)rDr�rr�r�rmrr+r�r�r��takerrdr�r�rErrr�_iset_not_inplacerr$)r�r�rcr��k1�k2r;s       r�r$zDataFrame._setitem_array�s�����s�#��3�x�3�t�z�z�?�*� �(��S��
�,�s�4�:�:��>O�q�Q���%�T�Z�Z��5�C��k�k�m�A�&�G��$�$�&��%��+��
�
�d�j�j�o�o�g�&>�?��!&�D�I�I�g���%��+� ����s�E�:�!�#�u�}�}�5�F�B��$�R�y�D��H�6�"�%�(��C� %�D��I���E�2�:�:�.�5�:�:��?��&�&�s�E�2������!�#�!�%�(�/�/���*�*�3��6�6��&�&�s�E�2r�c��dd�}|jjrOtj|�dt	|�k7rtd��t
|�D]\}}|||�||<�y|jj|�d}|dkj�rt�tj|�dt	|�k7rtd��tj|�dksJ�|j}	ttt	|j���|_t
|�D]\}}|||�||<�	||_y#||_wxYw)Nc�N�t|tj�r|d|fS||S)N.)r�rr)�objr�s  r��igetitemz-DataFrame._iset_not_inplace.<locals>.igetitems)���#�r�z�z�*��3��6�{�"��1�v�
r�rC�"Columns must be same length as keyrr�)r��int)
r�r�rr;rr�r��get_indexer_non_uniquer1�NotImplementedErrorrrfr)	r�r�rcr6r�r;�ilocs�orig_columnsrs	         r�r0zDataFrame._iset_not_inplaces#��	��<�<�!�!��x�x���r�"�c�#�h�.� �!E�F�F�#�C�.���3�$�U�A�.��S�	�)��L�L�7�7��<�Q�?�E���	��� �)�)��x�x���r�"�c�%�j�0� �!E�F�F��7�7�5�>�Q�&�&�&��<�<�L�
,�$�U�3�t�|�|�+<�%=�>���(��/�G�A�t�!)�%��!3�D��J� 0� ,����|���s
�7AE�	Ec�z�t|tj�rI|j|jk7rt	d��|j
|fi|j
��ddi��}|jr'td�|jD��std��|j�|j||d��y)Nz,Array conditional must be same shape as selfr�Fc3�2K�|]}t|����y�wr�)r<)rQr�s  r�rSz+DataFrame._setitem_frame.<locals>.<genexpr><s����M�*��
�e� 4�*�rTz;Must pass DataFrame or 2-d ndarray with boolean values onlyT�r�)
r�rrr;r�r��_construct_axes_dict�sizerrr	r+�_wherer,s   r�r#zDataFrame._setitem_frame4s����c�2�:�:�&��y�y�D�J�J�&� �!O�P�P�#�$�#�#�C�S�4�+D�+D�+F�S�U�S�C��8�8�C�M�#�*�*�M�M��M��
�	
� � �"����S�D�%���.r�c�r�|j|�||jv�r�|jj|�}|j|}t|�st	|t
�rdn
t
|�}|t
|j�k7rtd��t	|jt�r�t	|tttjtf�rbt||�}t
|�r.|j|j�s|j!|d��}t#||�D]
\}}||||<�yt|�r||jd||<yt	|t�r6tj$|j&|j(|j*�}	n"t|�r|g}	n|j-�d}	|j/|	|�St
|j�dkDrtd|����t
|j�dk(rtd|����||jd||<y)Nr�r7r�rzBCannot set a DataFrame with multiple columns to the single column z5Cannot set a DataFrame without columns to the column )�_ensure_valid_indexr�r-rFr�r�rr�rkr�r}rrrfrlrr�r��arange�start�stop�steprr)
r�r�rcr�cols�len_cols�cols_droplevelr;�
col_droplevel�locss
          r�r%zDataFrame._set_item_frame_valueDs���� � ��'��$�,�,���,�,�&�&�s�+�C��<�<��$�D�%�d�O�z�$��/F�q�C�PT�I�H��3�u�}�}�-�-� �!E�F�F��$�,�,�
�3�
��e�V�R�Z�Z��7�9�"2�$��!<���~�&�~�/D�/D�U�]�]�/S�!�M�M�.�q�M�A�E�*-�d�N�*C�&�C�� %�m� 4�D��I�+D�����"�5�=�=��#3�4��T�
���#�u�%��y�y����C�H�H�c�h�h�?���3���u���{�{�}�Q�'���=�=��u�-�-��u�}�}���!����� ��
�����
�1�
$��G��u�M��
��%�-�-��*�+��S�	r�c�b�|jj||||��|j�y)Nr)r��iset�_clear_item_cache)r�rrcr�rs     r�rzDataFrame._iset_item_mgrvs(��	
�	�	���s�E�7���>���� r�c��	|jj|�}|j|||��t
|�r|j�yy#t$r4|jjt
|j�|||�Y�YwxYw)N�r)�
_info_axisr-rr0r�r�rr+)r�r�rcrrs     r��
_set_item_mgrzDataFrame._set_item_mgr�s���	7��/�/�)�)�#�.�C�

����U���6�
�t�9��$�$�&����	E��I�I���S����1�3��t�D�	E�s�A�:B�
Bc��t�r*|j||j||j��n,|j||jj	�d��t|�r|j
�yy)NrTr?)rrrG�_referencesr�rr+)r�rrcr�s    r��
_iset_itemzDataFrame._iset_item�sn��� �����U�]�]�G�%�:K�:K�
 �
�
����U�]�]�%7�%7�%9�4��H�
�t�9��$�$�&�r�c��|j|�\}}||jvr�|jdk(r�t|jt
�s||jjrt|jt�rL||}t|t�r7tj|t|j�df�j}d}|j|||�y)a8
        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)rr�rr�r�rMr�rkr�r�tilerrFrT)r�r�rcr�existing_pieces     r�r'zDataFrame._set_item�s����+�+�E�2���t�
�4�<�<���
�
�a���u�{�{�N�;��<�<�)�)�Z����j�-Q�!%�c����n�i�8��G�G�E�C��0F�0F�,G��+K�L�N�N�E��D����3��t�,r�c��	|r|}tt|�}n6|jj|�}|jj|�}|j
j
|||d��|j�y#ttttf$rD|r||j||f<n||j||f<|jj|d�Yyt $r}t!dt#|����|�d}~wwxYw)a>
        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 )rr8r�r-r�r��column_setitemrPr0r	r�r0rrr��popr"r�)r�r�r;rcr
�icol�iindex�ii_errs        r��
_set_valuezDataFrame._set_value�s��� 	�����c�5�)���|�|�+�+�C�0�����+�+�E�2���I�I�$�$�T�6�5�t�$�L��"�"�$���)�Z�1B�C�
	,��(-��	�	�%��*�%�',�������$���� � ��d�+� �	�$�;�D��K�=�I���
��	�s�A:A=�=AC>�C>�!C9�9C>c���t|j�s�t|�r�t|�r�t|t�s	t|�}|jj�}|jj�|jj|_
|jj|dtj��|_yyyy#tttf$r}t
d�|�d}~wwxYw)zn
        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)rr�rEr�r�r}r�r:r	r�r�r��reindex_axisr�nan)r�rcr��
index_copys    r�rDzDataFrame._ensure_valid_index�s����4�:�:��<��#6�3�u�:��e�Y�/��"�5�M�E����)�)�+�J��z�z���*�"&�*�*�/�/�
���	�	�.�.�z��b�f�f�.�U�D�I�<F�#6���#�$7��C��$�K������s�C�C-�C(�(C-c��|j|}|j||j��}||_|j	|�S)z4
        Provide boxed values for a column.
        r�)r�r�r�r�r�)r�rrr�r5s     r�r�zDataFrame._box_col_valuessC���|�|�C� ���/�/��V�[�[�/�I����	�����%�%r�c�8�|jj�yr�)r��clearr�s r�rPzDataFrame._clear_item_caches������� r�c�P�t�s
t�r.|jj|�}|j	|d��S|j
}|j
|�}|�D|jj|�}|j	|d��}|||<|j|_|S)z8Return the cached item, item represents a label indexer.r�r�)rrr�r-r�r��get�_is_copy)r��itemr�cache�ress     r�r�zDataFrame._get_item_caches���� �$6�$8��,�,�&�&�t�,�C��9�9�S�q�9�)�)�� � ���i�i��o���;��,�,�&�&�t�,�C��)�)�C�a�)�(�C��E�$�K� �=�=�C�L��
r�c��yr�rkr�s r��
_reset_cacherzDataFrame._reset_cacher's��r�c���|jj|�}|j}|j|d��}|j|jur|ry|jj|||��y)zO
        The object has called back to us saying maybe it has changed.
        r�r�Nr?)rSr-rGr�r�rO)r�rnrcr�rr�olds       r��_maybe_cache_changedzDataFrame._maybe_cache_changed+s^���o�o�%�%�d�+���M�M�	��i�i��!�i�$���;�;�%�-�-�'�G���	�	���s�I�w��7r�r?c��yr�rk�r��exprr�rms    r��queryzDataFrame.query<r�r�c��yr�rkrws    r�ryzDataFrame.query@r�r�c��yr�rkrws    r�ryzDataFrame.queryDr�r�c�B�t|d�}t|t�sdt|��d�}t	|��|jdd�dz|d<d|d<|j|fi|��}	|j|}|r|j|�y|S#t$r||}Y�&wxYw)	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�levelrr�N�target)	r.r�r�r�r�r^�evalr�_update_inplace)r�rxr�rmr�rpr�s       r�ryzDataFrame.queryHs���R&�g�y�9���$��$�;�D��J�<�v�N�C��S�/�!� �*�*�W�a�0�1�4��w����x���d�i�i��'��'��	��X�X�c�]�F��� � ��(���M���	��#�Y�F�	�s�(B
�
B�Bc��yr�rkrws    r�rzDataFrame.eval�r�r�c��yr�rkrws    r�rzDataFrame.eval�r�r�c��ddlm}t|d�}|jdd�dz|d<|j	�}|j�}||f}d|vr||d<t
|jdd��|z|d<||fd|i|��S)	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)rr�r}r�r~�	resolversrk)�pandas.core.computation.evalrr.r^�_get_index_resolvers�_get_cleaned_column_resolversr�rl)r�rxr�rm�_eval�index_resolvers�column_resolversr�s        r�rzDataFrame.eval�s���x	?�%�g�y�9�� �*�*�W�a�0�1�4��w���3�3�5���=�=�?��$�o�5�	��6�!�#�F�8��#�F�J�J�{�B�$?�@�9�L��{���T�5�7�5�f�5�5r�c�����t��s���fnd�t��s���fnd�t��t��f}t|�std��d�}|���|�����fD]
}t	|���j��std��z����d
d��d���fd�}|jj|�jd��}|j||j�	�j|�S)a�	
        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
        Nrkz3at least one of include or exclude must be nonemptyc��g}|D]�}t|t�r|dk(s|tur?|jtj
�|jtj��_|dk(s|tur0|jtjtjg���|jt|����t|�S)Nr8�float)
r�r�r8r�r�int32�int64r�r��float64�float32r9�	frozenset)r�converted_dtypesr�s   r��check_int_infer_dtypez6DataFrame.select_dtypes.<locals>.check_int_infer_dtype�s���+-�����u�c�*�u��~�5�C�<�$�+�+�B�H�H�5�$�+�+�B�H�H�5��g�%��%��$�+�+�R�Z�Z����,D�E�$�+�+�,C�E�,J�K� ��-�.�.r�zinclude and exclude overlap on c���t|t�s|n|j}t|jt|��xs/tj|vxrt|dd�xrt|�S)N�_is_numericF)
r�rK�numpy_dtype�
issubclassr�r�r�numberr�r<)r��
dtypes_sets  r��dtype_predicatez0DataFrame.select_dtypes.<locals>.dtype_predicate�sb��!+�E�:�!>�E�E�DU�DU�E��e�j�j�%�
�*;�<���	�	�Z�'�-��E�=�%�8�-�%�e�,�,�
r�c�N��|j}�r
�|��sy�r
�|��ryy)NFTr�)r=r�r�r2�includes  ���r��	predicatez*DataFrame.select_dtypes.<locals>.predicate�s/����I�I�E��&�u�g�6� ��"�5�'�2� �r�r�r�)r�r�r%r)r=r�r%r)rEr�r1r�r6�
isdisjointr��_get_data_subsetr�r�r�r�)	r�r�r2�	selectionr�rr�r�r�s	 ``     @r��
select_dtypeszDataFrame.select_dtypesWs���f�G�$�$+�$7�w�j�R�G��G�$�$+�$7�w�j�R�G��w�'��7�);�<�	��9�~��R�S�S�
	/�(��0��'��0����(�F�$�V�,�)��!�!�'�*��>��'�@Q�>S�T�U�U�	�
	��i�i�(�(��3�8�8�d�8�C���)�)�#�C�H�H�)�=�J�J�4�P�Pr�c�2�|tjurd}|r!|jjst	d��|s||j
vrt	d|�d���t
|�std��t|�}t|t�r:t|j
�dkDr"t	dt|j
��d���t|t�r|jd	d	�d
f}|j|�\}}|jj||||��y	)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.zcannot insert z, already existszloc must be intr�z8Expected a one-dimensional object, got a DataFrame with z columns instead.NrrR)r�
no_default�flags�allows_duplicate_labelsr�r�rBr	r8r�r�rrrr�r�)r�rr?rc�allow_duplicatesrs      r�r�zDataFrame.insert�s��l�s�~�~�-�$���D�J�J�$F�$F��A��
� �F�d�l�l�$:��~�f�X�5E�F�G�G��#���-�.�.��#�h���e�Y�'�C��
�
�,>��,B��J��u�}�}�%�&�&7�9��
���y�
)��J�J�q�!�t�$�E��+�+�E�2���t��	�	����f�e�$��7r�c��|jd��}|j�D]\}}tj||�||<� |S)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�rDr�)r�rmrr�r�s     r��assignzDataFrame.assign6sD��|�y�y�d�y�#���L�L�N�D�A�q��+�+�A�t�4�D��G�#��r�c��|j|�t|t�rJ�t|�r1t|t�st	|�}t||j�St|�r tj||j�t||jdd��}t|t�rL|jdk(r=|j|jk7r$tjdtt!���|dfS)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_2drz�Setting 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)rDr�r�r>r}�_reindex_for_setitemr�rErD�require_length_matchr`rfr�r�r�rr+)r�rcr=s   r�rzDataFrame._sanitize_columnzs���	
� � ��'��e�Y�/�/�/�����e�V�,��u�
��'��t�z�z�:�:�����$�$�U�D�J�J�7��U�D�J�J�T�D�I���u�e�$����x�'��	�	�U�[�[�(�
�M�M�C��+�-�
��D�y�r�c	��t|j�D��cic]\}}||j|d����c}}Scc}}w)Nr�r�)r�r�r�)r�rrns   r��_serieszDataFrame._series�s;��>G����>U�V�>U���d��d�i�i��!�i�,�,�>U�V�V��Vs�;c�&�|jj|d�\}}|jj|d�\}}|�3|�1||f}t|j||��}	|j|	||d��S|j
||g||gd�||��S)z:
        We are guaranteed non-Nones in the axes.
        r�r�)rdF�r�r�r�)rr�)r�rd)r�r�r�rWrr��_reindex_with_indexers)
r�r�r�rd�	new_index�row_indexerr�col_indexerr�r�s
          r��_reindex_multizDataFrame._reindex_multi�s���"&���!3�!3�D��M�!B��	�;�#'�<�<�#7�#7��Y��#H� ��[��"�{�'>�"�;�.�G�&�t�{�{�G�
�S�J��$�$��)�[�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�|�|||��S)Nr�)�super�set_axis)r��labelsr�r��	__class__s    �r�r�zDataFrame.set_axis�s���L�w���T���=�=r�r�)r�r�)	r�r�r�r�r�r}rd�limit�	tolerancec	�6��t�|�|||||||||	|
��
S)N)
r�r�r�r�r�r�r}rdr�r�)r�r�)r�r�r�r�r�r�r�r}rdr�r�r�s           �r�r�zDataFrame.reindex�s9���&�w���������!����
�	
r�)r�r�r�r}r�c��yr�rk�r�r�r�r�r�r}r�r�s        r�r'zDataFrame.drop���	r�)r�r�r�r}r�r�c��yr�rkr�s        r�r'zDataFrame.dropr�r�c��yr�rkr�s        r�r'zDataFrame.drop+r�r��raisec	�0��t�|�|||||||��S)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�r')	r�r�r�r�r�r}r�r�r�s	        �r�r'zDataFrame.drop9s1���h�w�|���������
�	
r�)r�r�r�r�r}r�c��yr�rk�	r��mapperr�r�r�r�r�r}r�s	         r�r�zDataFrame.rename����	r�)r�r�r�r�r�r}r�c��yr�rkr�s	         r�r�zDataFrame.rename�r�r�c��yr�rkr�s	         r�r�zDataFrame.rename�r�r�r�c
�2��t�	|�||||||||��S)aM
        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�zDataFrame.renames4���F�w�����������	
�		
r�c�$��t�|�|��S)a1
        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
        )rn)r�r^)r�rnr�s  �r�r^z
DataFrame.pop�s���R�w�{��{�%�%r�c�$�|r|n|jd��}|j}t|�D]M\}}||vs�|jdd�|f}||\}	}
|j	|	|
|��}|j|||���O|ry|j
|�S)a@
        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�rr�rWr�)r��mappingr�r�rp�axr��ax_valuer�r~rc�newobjs            r��_replace_columnwisezDataFrame._replace_columnwise�s���$�d�4�9�9�$�9�#7��
�\�\��$�R�=�K�A�x��7�"��i�i��1��o�� '�� 1�
������V�U�%��@�����q�&�'��:�)�������%�%r�)r�r�c	���|�F|tjur4tjdtt���tj}|jr|j�S|j|�}t|�r�tt|�}|dk(rtd��t|�dk(rtd��ddlm}g}|D]u}t!|�st#d|�d	t%|��d
���tt&|�}|j)t*�|�Y||||��j/|r|�d|��nd|�����w||d�
�S|rtd��tt&|�}t|j0�}	|j2j4}
|dk(�r�|dk7�r�|	dkD�r�|���|tju�r;|j0d}|dkDrz|j6dd�d|�f}t9t;|	t=|���D]B}
|j6dd�dfj-t|��}|j?d||d���Dn�|j6dd�|d�f}t9t;|	t=|���D]U}
|j6dd�dfj-t|��}|j?t|j0�||d���W|j0j�|_|St|
�dkDstA|
d|�s�t=|�}t;||	�}|dkDrBtCjDdg|ztGt9|	|z
��ztBjH��}n?tCjDtGt9||	��dg|zztBjH��}|j2jK|j0|d|d��}|jM||jN��}|jQ|d��S|jRj-||��jRSt*�|�Y||||��S)Nz�Passing 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.rz0If `periods` is an iterable, it cannot be empty.��concatzPeriods must be integer, but z is r�)�periods�freqr�rdrr�z/Cannot specify `suffix` if `periods` is an int.T�r�rCr�)r�rdr�r��shiftr�)r�rd)*rr�r�r�rr+�emptyr��_get_axis_numberrErr	r�r�pandas.core.reshape.concatr�rBr	r�r8r�r�r��
add_suffixr�r�rrrrY�absr�r1rr�r
r�r�r�r�r�rF)r�r�r�r�rd�suffixr��shifted_dataframes�period�ncolsrr�r�r;�filler�nperr�r��res_dfr�s                   �r�r�zDataFrame.shift�s������
�#�.�.� @��M�M���+�-�
����J��:�:��9�9�;���$�$�T�*���� ��8�W�-�G��q�y� �P����7�|�q� � �!S�T�T�9�!#��!��!�&�)�#�7��x�t�D��L�>�QR�S����c�6�*��"�)�)��G��#)��4�J�U�W��Z��6�(�!�F�8� 4�a��x�L�Q��
"��,�1�5�5�
��N�O�O��s�G�$���D�L�L�!�����!�!���1�9��A��%�!�)����S�^�^�+����Q����Q�;�!�Y�Y�q�)�G�8�)�|�4�F�$�S���G��%=�>��"&���1�a�4��!6�!6�s�4�y�!A���
�
�a����
�N�	 ?�"�Y�Y�q�7�(�)�|�4�F�$�S���G��%=�>��!%���1�b�5�!1�!7�!7��D�	�!B���
�
�����/���QU�&�� ?�"&���!2�!2�!4����
��V��q��
%�V�A�Y�
�;��7�|���4��'���Q�;� �h�h���t��d�5����+A�&B�B�"�'�'��G�!�h�h��U�4��/�0�B�4�$�;�>�b�g�g��G��i�i�/�/��L�L���)�#�0����3�3�C�c�h�h�3�G���*�*�4��*�@�@��v�v�|�|�G�
�|�K�M�M�M��w�}��$�T�j��
�	
r�)r'r�r�rSc��yr�rk�r�r�r'r�r�rSs      r�r&zDataFrame.set_indexQ���	r�)r'r�rSc��yr�rkr�s      r�r&zDataFrame.set_index]r�r�c
�x���t|d�}�j|�t|t�s|g}d}g}|D]z�t�tt
tjttjf�rt�dd�dk7s�Mt|��	��jv}|r�j|j���||rt!d|�d���|r�}
n�j#d�	�}
g}g}|r�t�j$j&�}t�j$t(�r8|j+�fd
�t-�j$j.�D��n|j�j$�g}
|D�]��t�t(�rJ|j+�fd�t-�j.�D��|j+�j&��nt�tt
f�r-|j��|j�j0�n�t�ttjf�r#|j��|jd�n~t�tj�r,|jt���|jd�n8|j|
��|j��|r|
j��t3|d�t3��k7s��~td
t3���dt3|d�����t5||�}|r;|j6s/||j9�j;�}td|����t=|
�D]}|
|=�|j?�||
_|s|
Sy#t$r}	t|�dt�����|	�d}	~	wwxYw)a�
        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�z�The parameter "keys" may be a column key, one-dimensional array, or a list containing only valid column keys and one-dimensional arrays.rr�z. Received column of type NzNone of z are in the columnsr�c3�T�K�|]}�jj|����!y�wr�)r��_get_level_values)rQr�r�s  �r�rSz&DataFrame.set_index.<locals>.<genexpr>�s%������=V��D�J�J�0�0��3�=V�s�%(c3�@�K�|]}�j|����y�wr�)r�)rQ�nr;s  �r�rSz&DataFrame.set_index.<locals>.<genexpr>s�����S�@R�1�c�3�3�A�6�@R�s�rCzLength mismatch: Expected z  rows, received array of length zIndex has duplicate keys: ) r.�*_check_inplace_and_allows_duplicate_labelsr�r
rfr}rrrrr�r�r�r�r	r�r0r�r�r
rkr�rrBr�rrjr�r�uniquer��_cleanup)r�r�r'r�r�rS�err_msg�missing�foundr��framerr
r<r��
duplicatesrLr;s`                @r�r&zDataFrame.set_indexis9���D&�g�y�9���7�7��@��$��%��6�D�
&�	�#%���C��#��v�r�z�z�4����N�O��3���*�a�/�$�W�-�-�,��4�<�<�/�E�!����s�+�!�$��X�g�Y�.A�B�C�C���E��I�I�4�I�(�E� �� "�������)�)�*�E��$�*�*�j�1��
�
��=B�4�:�:�CU�CU�=V����
�
�d�j�j�)�$&�	��C��#�z�*��
�
�S��c�k�k�@R�S�S����S�Y�Y�'��C�%���1�
�
�
�c�"����S�X�X�&��C�$��
�
�!3�4��
�
�c�"����T�"��C����.��
�
�d�3�i�(����T�"��
�
�e�C�j�)����S�!���$�$�S�)��6�"�:��#�d�)�+�!�0��T���<0�03�F�2�J��/@�B���?�H,�F�E�:���E�O�O��u�/�/�1�2�9�9�;�J��9�*��F�G�G��Y��A��a�� �	���������L���e!��#�"�)�#=�d�3�i�[�I������s�N�	N9�N4�4N9)r'r��	col_level�col_fillr�r
c��yr�rk�r�r}r'r�r�r�r�r
s        r��reset_indexzDataFrame.reset_index5r�r�)r'r�r�r�r
c��yr�rkrs        r�rzDataFrame.reset_indexCr�r�c��yr�rkrs        r�rzDataFrame.reset_indexQr�r�rc���t|d�}|j|�|r|}n|jd��}|tjurt|d�}tt
|��}	|�~t|ttf�s|g}|D�
cgc]}
|jj|
���}}
t
|�|jjkr|jj|�}	|�s�d|vrdnd}|jj||�}t|jt�r5t!|jj"|jj$�}n|jdff}t|j&t�}
t)tt+|���D�]?\}\}
}|�||vr�||}|
r�t|t�rt|�n|g}|�6t
|�d|j&jfvrt-d|����|d	}|j&j|�}|g|z|z}|j&jt
|�z
}||g|zz
}t|�}|
j.}|j0t2j4k(rtj6|�}|�#t9j:||d
|
j<��}|j?d	|||����B|	|_
|s|Sycc}
w)
ar
        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 rT��
allow_fillrdr�) r.r�r�rr�rhrr�r�r
r��_get_level_numberrB�	droplevel�_get_default_index_namesrkr��levels�codesr��reversedr�r�rGr�rrr,rPr/�	_na_valuer�)r�r}r'r�r�r�r�r
�new_objr��lev�default�	to_insert�	multi_colr��labr��col_name�lev_num�name_lstr��level_valuess                      r�rzDataFrame.reset_index_s���Z&�g�y�9���7�7��@���G��i�i�T�i�*�G��3�>�>�1�2�3C�EW�X��!�#�g�,�/�	����e�e�T�]�3����BG�H�%�3�T�Z�Z�1�1�#�6�%�E�H��5�z�D�J�J�.�.�.� �J�J�0�0��7�	��")��!4�g�)�G��J�J�7�7��w�G�E��$�*�*�j�1���
�
� 1� 1�4�:�:�3C�3C�D�	�"�j�j�$�/�1�	�"�4�<�<��<�I�!)�$�y��/C�*D�!E�
��:�C���$��%����Q�x���-7��e�-D�t�D�z�4�&�H��'��x�=��D�L�L�4H�4H�0I�I�",�!?�?C�f�!F�#��$,�A�;��"�l�l�<�<�Y�G�G� (�z�G�3�h�>�H�"�l�l�2�2�S��]�B�G���
�W� 4�4�H� ��?�D� #�{�{���%�%����3�#&�#<�#<�\�#J�L��?�#-�?�?�$�c�d�s�}�}�$�L������ �%5�	��?"F�L"��
���N���uIs�"K2c��|jjt��}|j||j��}|j	|d��S)N)�funcr�rNr�)r�rNr�r�r�)r��res_mgrr�s   r�rNzDataFrame.isnaXsE���)�)�.�.�d�.�+���+�+�G�'�,�,�+�G���"�"�4��"�7�7r�c�"�|j�S)zB
        DataFrame.isnull is an alias for DataFrame.isna.
        �rNr�s r��isnullzDataFrame.isnull^s��
�y�y�{�r�c�$�|j�Sr�rr�s r�rOzDataFrame.notnaes���	�	��|�r�c�$�|j�S)zD
        DataFrame.notnull is an alias for DataFrame.notna.
        rr�s r��notnullzDataFrame.notnullis��
�	�	��|�r�)r��how�thresh�subsetr��ignore_indexc��yr�rk�r�r�r#r$r%r�r&s       r��dropnazDataFrame.dropnapr�r�)r�r#r$r%r&c��yr�rkr(s       r�r)zDataFrame.dropna}r�r�c��|tjur|tjurtd��|tjurd}t|d�}t	|t
tf�rtd��|j|�}d|z
}|}|��t|�s|g}|j|�}	|	j|�}
|
dk(}|j�r/ttj|�|j���|j!|
|��}|tjur|j#|��}||k\}
nR|dk(rt%|�j'|d	�
�}
n0|dk(rt%|�j|d	�
�}
nt)d|����tj&|
�r|j+d�
�}n|j-|��|
}|rt/t1|��|_|s|S|j5|�y)uk

        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.r1r�z7supplying multiple axes to axis is no longer supported.r�NrCr�F)r��	bool_onlyrzinvalid how option: r�)rr�r	r.r�r�r
r�rE�	_get_axisr&r1r0rr��tolistr/�countrOrr�r�rrhrr�r�)r�r�r#r$r%r�r&�agg_axis�agg_objr��indices�checkr/�maskr�s               r�r)zDataFrame.dropna�s���V
�s�~�~�%�F�#�.�.�,H��T��
��#�.�.� ��C�%�g�y�9���d�U�D�M�*��U�V�V��$�$�T�*���t�8��������'� �������)�B��(�(��0�G��r�M�E��y�y�{��r�x�x��/��6�=�=�?�@�@��i�i��h�i�7�G�����'��M�M�x�M�0�E��F�?�D�
�E�\���>�%�%�8�u�%�E�D�
�E�\���>�%�%�8�u�%�E�D��3�C�5�9�:�:�
�6�6�$�<��Y�Y�D�Y�)�F��X�X�4�X�(��.�F��(��V��5�F�L���M����V�$�r�)r�r&c��yr�rk�r�r%r�r�r&s     r�r�zDataFrame.drop_duplicates*���	r�)r�r�r&c��yr�rkr6s     r�r�zDataFrame.drop_duplicates5r7r�c��yr�rkr6s     r�r�zDataFrame.drop_duplicates@r7r��firstc��|jr|jd��St|d�}t|d�}||j||��}|rt	t|��|_|r|j|�y|S)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�)r�r�r.rrhrr�r�)r�r%r�r�r&r�s      r�r�zDataFrame.drop_duplicatesKs{��b�:�:��9�9�$�9�'�'�%�g�y�9��*�<��H���t���v�D��9�9�:���(��V��5�F�L��� � ��(���Mr�c	�0����jr�jt��Sd�fd�}��
�j�nFt	j
��r.t
�t�st
�t�r��jvr�f�tt���t��t�j�z
}|rtt|���t��dk(r5�jjr��dj!|�}d|_n{�fd��j%�D�}t't(t+t'||���\}}t-|t|�dd��}	�jt!|	|��j.�	�}|j1�d
��S)
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���tj|t����\}}|jdd��t|�fS)N)�	size_hint�i8Fr�)rP�	factorizer�astype)�valsr�r;r�s   �r��fzDataFrame.duplicated.<locals>.f
s9���&�0�0���T��K�M�F�E��=�=��E�=�2�C��J�>�>r�Nr�rc3�F�K�|]\}}|�vs�|j���y�wr�)r)rQr�r;r%s   �r�rSz'DataFrame.duplicated.<locals>.<genexpr>-s �����O��9�4�����C�J�J��s�!�!F)�sort�xnullrrr�)r%ztuple[np.ndarray, int])r�r�rr�r�iterabler�r�r�rr	r�r0rfrr�rr�r�r�r
r�rr�r�)
r�r%r�rC�diffr�rBr�r;�idss
``        r�rzDataFrame.duplicated�sP���|�:�:��+�+�$�+�7�7�	?��>��\�\�F����F�#��&�#�&��&�%�(��$�,�,�&��Y�F��h��'��
�6�{�S����.�.����5��;�'�'��v�;�!����� 6� 6��&��)�_�/�/��5�F��F�K�O��
�
��O�D���c�3�q�$�<�&8�9�M�F�E�!�&�%��,�U�%�P�C��-�-�j��d�.C�4�:�:�-�V�F��"�"�4��"�=�=r�)r��	ascendingr�r�na_positionr&r�c��yr�rk�	r��byr�rJr�rrKr&r�s	         r��sort_valueszDataFrame.sort_values7r�r�)r�rJrrKr&r�c��yr�rkrMs	         r�rOzDataFrame.sort_valuesFr�r��	quicksort�lastc��t|d�}|j|�}t|�}t|t�s|g}t|�r;t
|�t
|�k7r$tdt
|��dt
|��d���t
|�dkDr[|D�	cgc]}	|j|	|����}
}	|�)t|
|�D��cgc]\}}t||����}
}}t|
|||�	�}
n�t
|�rT|j|d
|��}|�t||d
��}t|ttf�r|d
}t|||||��}
n%|r|j|�S|jd��St!|
t
|
��rP|j|xrt#���}|rt%t
|��|_|r|j|�S|S|j(j+|
|j-|�d
��}|r3|j/|j-|�t%t
|
���|j1||j2��}|r|j|�S|j5|d��Scc}	wcc}}w)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�zLength of ascending (z) != length of by (�)r�r�Nr�)�ordersrKr�r)rrJrKr�r�F)r��verifyr�rOr�)r.r�r-r�r
rGrr��_get_label_or_level_valuesr�r}r�r�r�r�r�rrrhr�r�r/�_get_block_manager_axisr�r�r�r�)r�rNr�rJr�rrKr&r�r9r�r�r�r�r��new_datas                r�rOzDataFrame.sort_valuesUs���|&�g�y�9���$�$�T�*��&�y�1�	��"�d�#���B��y�!���G�s�9�~�%��'��I��'7�8%�%(��W�I�Q�0��
��r�7�Q�;�KM�N�2�a�D�3�3�A�D�3�A�2�D�N���
&)��r�]��%2�	��D��1�4�(�%2���
&��Y�K�S��G���W��/�/��1��D�/�A�A����1�2�a�5�)���)�e�T�]�3�%�a�L�	����	�{�PS��G���+�+�D�1�1��y�y�d�y�+�+��G�S��\�2��Y�Y��[�%N�9L�9N�5N�Y�P�F��,�S��[�9�����+�+�F�3�3��
��9�9�>�>��$�6�6�t�<�U�"�
�������,�,�T�2�M�#�g�,�4O�
��+�+�H�8�=�=�+�I����'�'��/�/��&�&�t�M�&�B�B��yO��s�I9�I>)r�r}rJrrK�sort_remainingr&r�c	��yr�rk�
r�r�r}rJr�rrKrZr&r�s
          r��
sort_indexzDataFrame.sort_indexB���	r��	r�r}rJr�rrKrZr&r�c	��yr�rkr\s
          r�r]zDataFrame.sort_indexRr^r�c	��yr�rkr\s
          r�r]zDataFrame.sort_indexbr^r�c	�4��t�
|�|||||||||	��	S)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}rJr�rrKrZr&r�r�s          �r�r]zDataFrame.sort_indexrs8���B�w�!������#�)�%��"�

�
	
r�c��|�|jj�}|rdnd}|j||d��jj	�}||_|r|j
|��}|r||j�z}t|�rJt|�dk(r<tj|jg|jj
g��|_|S)as

        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)rJr�r�)
r�r.�groupby�_grouperrAr�rO�sumrErrk�from_arraysr�)r�r%�	normalizerErJr)r��countss        r��value_countszDataFrame.value_counts�s���d�>��\�\�(�(�*�F�(�|�g�����f�V�e��D�M�M�R�R�T�������'�'�)�'�<�F���f�j�j�l�"�F����C��K�1�$4�%�1�1�����v�|�|�'8�'8�&9��F�L��
r�c�P�tj||||��j�S)ap
        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
        �r�r�r�)r{�SelectNFrame�nlargest�r�r�r�r�s    r�rpzDataFrame.nlargestes%��n�#�#�D�A�D�'�J�S�S�U�Ur�c�P�tj||||��j�S)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
        rn)r{ro�	nsmallestrqs    r�rszDataFrame.nsmallest�s%��\�#�#�D�A�D�'�J�T�T�V�Vr�z�axis : {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_paramsrtrCc��|jd��}|j|�}t|j|�t�std��|dk(r?t|jt�sJ�|jj||�|_|St|jt�sJ�|jj||�|_|S)Nr�z,Can only swap levels on a hierarchical axis.r)	r�r�r�r-rkr	r��	swaplevelr�)r�r��jr�r�s     r�rvzDataFrame.swaplevelNs���~�����%���$�$�T�*���&�*�*�4�0�*�=��J�K�K��1�9��f�l�l�J�7�7�7�!�<�<�1�1�!�Q�7�F�L��
��f�n�n�j�9�9�9�#�^�^�5�5�a��;�F�N��
r�c��|j|�}t|j|�t�st	d��|jd��}|dk(r>t|jt�sJ�|jj|�|_|St|jt�sJ�|jj|�|_|S)a[
        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)	r�r�r-rkr	r�r��reorder_levelsr�)r��orderr�r�s    r�ryzDataFrame.reorder_levels�s���R�$�$�T�*���$�.�.��.�
�;��M�N�N������%���1�9��f�l�l�J�7�7�7�!�<�<�6�6�u�=�F�L��
��f�n�n�j�9�9�9�#�^�^�:�:�5�A�F�N��
r�c��d}|j||dd��\}}|j|||��}|j|�S)Nr�F��flexr}r�)�
_align_for_op�_dispatch_frame_op�_construct_result�r�r��opr�rYs     r��_cmp_methodzDataFrame._cmp_method�sN�����(�(���5��(�M���e��*�*�5�"�4�*�@���%�%�h�/�/r�c�l�|j||ddd�r|j||�Sd}tj||j|f�}|j||dd��\}}t
jd��5|j|||��}ddd�|j�S#1swY�xYw)Nr�Tr|r��rr�)
�_should_reindex_frame_op�_arith_method_with_reindexrS�maybe_prepare_scalar_for_opr;r~r�errstaterr�r�s     r��
_arith_methodzDataFrame._arith_method�s����(�(���A�t�T�B��2�2�5�"�=�=����/�/���
�
�4�8H�7J�K���(�(���4�t�(�L���e�
�[�[�X�
&��.�.�u�b�t�.�D�H�'��%�%�h�/�/�'�
&�s�<B*�*B3c��tj|�}tj|�}t	|�s:|j
j
||��}|j||j��St|t�r�|jj|j�sJ�|jj|j�sJ�|j
j|j
|�}|j||j��St|t�r�|dk(r�|jj|j�sJ�|j }t|t"j$�rJ�t'|j)�|�D��cgc]\}}|||���}}}nst|t�rX|jj|j�sJ�|j }|j)�D�	cgc]}	||	|���
}}	nt+|��t-|�j/||j|jd��Scc}}wcc}	w)a�
        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)rS)rS�get_array_oprr�rEr��applyr�r�r�r�r�rr��operate_blockwiser}rGrrr�r�r:r�rT)
r�r�rr��array_op�bm�_left�_rightrr�s
          r�rzDataFrame._dispatch_frame_op�s���,�#�#�D�)���%�%�e�,���E�"���������7�B��-�-�b�r�w�w�-�?�?�
��y�
)��:�:�$�$�U�[�[�1�1�1��<�<�&�&�u�}�}�5�5�5����,�,��
�
��	�B��-�-�b�r�w�w�-�?�?�
��v�
&�4�1�9��;�;�%�%�d�l�l�3�3�3��M�M�E�!�%����4�4�4�&)��)A�)A�)C�U�%K��%K�M�E�6����'�%K�
��
��v�
&��;�;�%�%�d�j�j�1�1�1��M�M�E�8<�8P�8P�8R�S�8R��h�t�U�+�8R�F�S�&�e�,�,��D�z�&�&��D�L�L�$�*�*�u�'�
�	
����Ts�I�>Ic�D������}n��fd�}|j||�}|S)Nc�J��tj||��\}}�||�Sr�)rS�
fill_binop)r�r�rdrs  ��r��	_arith_opz+DataFrame._combine_frame.<locals>._arith_opDs(���"�n�n�T�5�*�E���e��D�%�(�(r�)r)r�r�rrdr�rYs  ``  r��_combine_framezDataFrame._combine_frame:s0������I�
)��*�*�5�)�<���r�c��|}|jj|jddd��\}}}|jdd�|f}|jdd�|f}|||�}	|jj|jddd��\}
}}|	jjrL|	jj	|
�\}}tj|�}|	jd|
|gid��}	|	S|	j|
d��}	|	S)	a
        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_duplicatesr9rP�unique1dr�r�)
r�r�r�r�rI�lcols�rcols�new_left�	new_rightr��join_columnsrr�s
             r�r�z$DataFrame._arith_method_with_reindexNs����"�\�\�.�.��M�M�w�d�D�/�
���e�U��9�9�Q��X�&���J�J�q�%�x�(�	��H�i�(��"�\�\�.�.��M�M�w�d�D�/�
���a���>�>�(�(� ���>�>�|�L�J�G�Q� �)�)�'�2�G��2�2��\�7�+�,��3��F��
��^�^�L�q�^�9�F��
r�c��|tjus|tjuryt	|t
�sy|��|��|dk(r|jj�}|jj�}|j|�}t|�r/t|�t|�k(rt|�t|�k(syy)z]
        Check if this is an operation between DataFrames that will need to reindex.
        Fr�T)
�operator�powrT�rpowr�r�r�r��intersectionr)	r�r�r�r�rdr}�left_uniques�
right_uniquesrIs	         r�r�z"DataFrame._should_reindex_frame_opzs���������y�~�~�!5���%��+����%�-�D�A�I� �<�<�.�.�0�L�!�M�M�0�0�2�M��,�,�]�;�D��4�y��D�	�S��.�.�3�t�9��M�@R�3R��r�c����||c�}��fd�}t|tj��r�|jdk(r
||�}�n�|jdk(�r@d}|jt
k(rt
}|j�jk(r+�j|�j�j|��}�n^|jd�jdk(r\|jddk(rJtj|�j�}�j|�j�j|��}n�|jd�jdk(r"|jddk(r||ddd�f�}n�td�j�d|j����|jdkDrntd	|j����t|�rKt|ttf�s5td
�|D��rtdt!|d��d���||�}|�Nt|t�r>�j#|�s)|r�j%|d
|d��\�}�|fStd���|fSt|t�rf���nd�|s3�j&�j)|j�std���j%|d
�|d��\�}�j+|��}�|fS)a�
        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�.��d}d}t|dd�tk(rt}�dk(ryt�j�t|�k7r8t	|jt�j�t|������j
|�j|��}|St�j�t|�k7r8t	|jt�j�t|������j
|�j|��}|S)NzGUnable to coerce to Series, length must be {req_len}: given {given_len}r�r)�req_len�	given_lenr�)r�rrr�r�r�r�r�)r�r�r�r�r�s   ��r��	to_seriesz*DataFrame._align_for_op.<locals>.to_series�s����>�
��E��u�g�t�,��6����q�y��t�z�z�?�c�%�j�0�$��
�
�3�t�z�z�?�c�%�j�
�Q����0�0��d�j�j�PU�0�V���L��t�|�|�$��E�
�2�$��
�
�3�t�|�|�+<��E�
�
�S����0�0��d�l�l�RW�0�X���Lr�r�r�Nr�rz-Unable to coerce to DataFrame, shape must be z: given z>Unable to coerce to Series/DataFrame, dimension must be <= 2: c3�2K�|]}t|����y�wr�)r;)rQ�els  r�rSz*DataFrame._align_for_op.<locals>.<genexpr>�s����5�u��=��$�u�rTzUnable 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�rrrr�rr;r�r�r��broadcast_tor�rEr}r�r1r��
_indexed_same�alignr�r�_maybe_align_series_as_frame)	r�r�r�r}r}r�r�r�r�s	  `     @r�r~zDataFrame._align_for_op�s����2�E���e�	�8�e�R�Z�Z�(��z�z�Q��!�%�(�����q�����;�;�&�(�#�E��;�;�$�*�*�,� �-�-��T�Z�Z����U�.��E��[�[��^�t�z�z�!�}�4����Q��1�9L��O�O�E�4�:�:�>�E� �-�-��T�Z�Z����U�.��E��[�[��^�t�z�z�!�}�4����Q��1�9L�%�e�A�q�D�k�2�E�%�#�#'�:�:�,�h�u�{�{�m�E���
���a�� �/�/4�{�{�m�=���
�%�
 ��E�F�I�;N�)O��5�u�5�5� �/��U�1�X��/?�?S�T����e�$�E���
�5�)� <��%�%�e�,��"&�*�*��G�5�u�#-�#�K�D�%�8�U�{��1%�,���0�U�{��)��v�
&��+�4��D���y�y���-�-�e�k�k�:�$�,����*�*������%��K�D�%��5�5�e�T�B�E��U�{�r�c��|j}t|tj�s&|jdvrtj
|�}n|S|dk(r|j
dd�}n|j
dd�}tj||j�}|j||j|j|j��S)zn
        If the Series operand is not EA-dtype, we can broadcast to 2D and operate
        blockwise.
        )zdatetime64[ns]ztimedelta64[ns]rrCr�r�)rGr�rrr�rrEr�r;r�r�r�)r�rr��rvaluess    r�r�z&DataFrame._maybe_align_series_as_frame s���
�.�.���'�2�:�:�.��}�}� E�E��*�*�W�-���
��1�9��o�o�b�!�,�G��o�o�a��,�G��/�/�'�4�:�:�6��� � ���*�*��L�L��-�-�	!�
�	
r�)r�r}rdc��|�|j|�nd}|j|||||�r|j||�St|t�r|�td|�d���t
j||j�}|j||d|��\}}tjd��5t|t�r|j|||�}nJt|t�r|j|||��}n%|�|j|�}|j||�}ddd�|j!�S#1swY�xYw)	Nr�zfill_value z not supported.Tr|r�r�r�)r�r�r�r�r}r:rSr�r;r~rr�r�r�r�fillnar�)r�r�r�r�r}rdrYs       r��_flex_arith_methodzDataFrame._flex_arith_method: s0��/3�.>�t�$�$�T�*�A���(�(���D�*�e�L��2�2�5�"�=�=��e�V�$��)?�&��J�<��&O�P�P��/�/��t�z�z�B���(�(���4�u�(�M���e�
�[�[�X�
&��%��+��.�.�u�b�*�E���E�6�*��2�2�5�"�4�2�H���)��;�;�z�2�D��2�2�5�"�=��'��%�%�h�/�/�'�
&�s
�,A/D4�4D=c��|j|d��j|�}|j|_|j|_|S)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�zDataFrame._construct_resultZ sA������U��3�@�@��F���l�l����J�J��	��
r�c�$�||z}|||zz
}||fSr�rk�r�r��div�mods    r��
__divmod__zDataFrame.__divmod__m s"���e�m���S�5�[� ���C�x�r�c�$�||z}|||zz
}||fSr�rkr�s    r��__rdivmod__zDataFrame.__rdivmod__s s"���t�m���c�D�j� ���C�x�r��r�r}c��|�|j|�nd}|j||d|��\}}|j|||��}|j|�S)Nr�Tr|r�)r�r~rr�)r�r�r�r�r}rYs      r��_flex_cmp_methodzDataFrame._flex_cmp_methody s^��.2�.>�t�$�$�T�*�A���(�(���4�u�(�M���e��*�*�5�"�4�*�@���%�%�h�/�/r��eqc�H�|j|tj||��S�Nr�)r�r�r��r�r�r�r}s    r�r�zDataFrame.eq� � ���$�$�U�H�K�K�d�%�$�P�Pr��nec�H�|j|tj||��Sr�)r�r�r�r�s    r�r�zDataFrame.ne� r�r��lec�H�|j|tj||��Sr�)r�r�r�r�s    r�r�zDataFrame.le� r�r��ltc�H�|j|tj||��Sr�)r�r�r�r�s    r�r�zDataFrame.lt� r�r��gec�H�|j|tj||��Sr�)r�r�r�r�s    r�r�zDataFrame.ge� r�r��gtc�H�|j|tj||��Sr�)r�r�r�r�s    r�r�zDataFrame.gt� r�r�r.c�J�|j|tj|||��S�N)r}rdr�)r�r�r.�r�r�r�r}rds     r�r.z
DataFrame.add� �+���&�&��8�<�<�u��$�'�
�	
r��raddc�J�|j|tj|||��Sr�)r�rTr�r�s     r�r�zDataFrame.radd� �+���&�&��9�>�>��:�D�'�
�	
r��subc�J�|j|tj|||��Sr�)r�r�r�r�s     r�r�z
DataFrame.sub� r�r��rsubc�J�|j|tj|||��Sr�)r�rTr�r�s     r�r�zDataFrame.rsub� r�r��mulc�J�|j|tj|||��Sr�)r�r�r�r�s     r�r�z
DataFrame.mul� r�r��rmulc�J�|j|tj|||��Sr�)r�rTr�r�s     r�r�zDataFrame.rmul� r�r��truedivc�J�|j|tj|||��Sr�)r�r�r�r�s     r�r�zDataFrame.truediv� s-���&�&��8�#�#�5�Z�d�'�
�	
r��rtruedivc�J�|j|tj|||��Sr�)r�rTr�r�s     r�r�zDataFrame.rtruediv� s.���&�&��9�%�%�U�z�PT�'�
�	
r��floordivc�J�|j|tj|||��Sr�)r�r�r�r�s     r�r�zDataFrame.floordiv� s-���&�&��8�$�$�E�j�t�'�
�	
r��	rfloordivc�J�|j|tj|||��Sr�)r�rTr�r�s     r�r�zDataFrame.rfloordiv� s.���&�&��9�&�&�e�
�QU�'�
�	
r�r�c�J�|j|tj|||��Sr�)r�r�r�r�s     r�r�z
DataFrame.mod� r�r��rmodc�J�|j|tj|||��Sr�)r�rTr�r�s     r�r�zDataFrame.rmod� r�r�r�c�J�|j|tj|||��Sr�)r�r�r�r�s     r�r�z
DataFrame.pow!r�r�r�c�J�|j|tj|||��Sr�)r�rTr�r�s     r�r�zDataFrame.rpow
!r�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�|�|||||��S)N)r��
align_axis�
keep_shape�
keep_equal�result_names)r�r�)r�r�r�r�r�r�r�s      �r�r�zDataFrame.compare!s+���x�w���!�!�!�%��
�	
r�c�D�t|j�}|j|d��\}}|j}|jr1t|�t|j�k(r|j	�S|jrt|�|k(r|j	�S|j
j
|j
�}|du}	i}
|D�]}||}||}
|j}|
j}t|�}t|
�}|s'|j�r||j	�|
|<�e|	r*|j	�}|
j	�}
|||<||
|<||j
vr|}	|j|d��}n3t||g�}|j|d��}|
j|d��}
|||
�}t|tj�rt||�}||
|<��|j!|
||��}|j#|d��S#t$rY�iwxYw)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�)rr�r�r�r�r�r�r�rNrrAr�r4r�rr8r�r�)r�r�rrd�	overwrite�other_idxlen�thisr�r�do_fillr�r;r�other_series�
this_dtype�other_dtype�	this_mask�
other_mask�	new_dtyper=�frame_results                     r�r�zDataFrame.combine�!s��^�5�;�;�'���j�j��U�j�3���e��J�J�	��;�;�3�y�>�S����_�<��9�9�;���:�:�#�e�*��4��:�:�<���l�l�(�(����7���D�(�����C��#�Y�F� ��:�L����J�&�,�,�K��V��I��l�+�J�����!1�"�3�i�n�n�.��s���������+�0�0�2��$.��y�!�+5��Z�(��$�,�,�&�(�	��#�]�]�9�5�]�A�F�-�j�+�-F�G�	����y�u��=��+�2�2�9�5�2�I���v�|�,�C��)�R�X�X�.�
.������F�3�K�_�d�(�(��y�+�(�V���(�(��i�(�@�@��/"����s�.H�	H�Hc	�~���ddlm�d
��fd�}t|�dk(rk�j�jj|jj
�j��d��}|j|j�}n�j||d��}�jj|j�D�cic]I}|j|�j|k7r(|t�j||j|g���K}}|r|j|�}|j�d�	�Scc}w)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����|j�j}|j}|j}|j�jvr|S�j	|||�Sr�)rNrGr�r�r�)r9�yr4�x_values�y_valuesrr�s     ��r��combinerz)DataFrame.combine_first.<locals>.combiner}"sR����6�6�8�#�#�D��y�y�H��y�y�H��v�v�T�\�\�)����$�$�T�8�X�>�>r�r�r�F)r��
combine_firstr�)r9r}rr})
�pandas.core.computationrrr�r�r��
differencerArr�r�r4r�)r�r�r�combinedr;rrs`     @r�rzDataFrame.combine_firstL"s���^	8�	?��u�:��?��|�|����#�#�E�M�M�$<�$<�T�\�\�$J�K�RS�$��H� ���u�|�|�4�H��|�|�E�8�u�|�E�H��|�|�0�0����?�
�?�����s�#�t�{�{�3�'7�7�
�!�4�;�;�s�#3�U�\�\�#�5F�"G�H�H�?�	�
�����v�.�H��$�$�T�/�$�B�B��
s�AD:c�T�tsGt�r=tj|�tkr}tjttd��n\tsVt�sL|j�r<tj|�tkr tjttd��|dk7rtd��|dvrtd��t|t�st|�}|j!|j"�}|j$j'|j$�D]�}||j(}||j(}|�||�t+|�z}	nM|dk(r/t-|�}
t-|�}t/|
|z�rtd	��|rt+|�}	nt-|�}	|	j1�r��tj2�5tj4d
dt��||j7|	|�|j8dd�|f<ddd���y#1swY��xYw)
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�zOnly left join is supported)r�r�z7The parameter errors must be either 'ignore' or 'raise'Nr�zData overlaps.r�zDowncasting behavior)�message�category)rrrr rr�r�r#r!�_is_view_after_cow_rulesr%rr:r�r�r�r�r�r�r�rGrNrOr1r�catch_warnings�filterwarningsr�r)r�r�r�r��filter_funcr�r;r��thatr4�	mask_this�	mask_thats            r�r/zDataFrame.update�"s���l�+�-����t�$�	�1��
�
�2�*� ��
�1�3��8U�8U�8W����t�$�	�1��
�
�:�!� ���6�>�%�&C�D�D��,�,��V�W�W��%��+��e�$�E��
�
�d�j�j�)���<�<�,�,�U�]�]�;�C���9�$�$�D���:�%�%�D��&�#�D�)�)�D��J�6���W�$� %�d��I� %�d��I��9�y�0�1�(�)9�:�:����:�D� ��;�D��x�x�z���(�(�*��'�'��2�*��$(��9�?�?�4��#>�����C�� �+�*�-<�,+�*�s
�AH�H'	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
        rfc	�6�|tjur`|j|�}|dk(r%tjdt
t
���n'tjdt
t
���nd}ddlm}	|�
|�td��|	|||||||||��	S)	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.rr�z*You have to supply one of 'by' and 'level')	r5r�r�r}�as_indexrE�
group_keysrer))
rr�r�r�r�rr+�pandas.core.groupby.genericr�r	)
r�rNr�r}rrErrer)r�s
          r�rfzDataFrame.groupbyQ#s���l�s�~�~�%��(�(��.�D��q�y��
�
�C�!�/�1�	��
�
�;�!�/�1�	��D�@��=�R�Z��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�rc�&�ddlm}|||||��S)Nr)r)r�r�r)�pandas.core.reshape.pivotr)r�r�r�rrs     r�rzDataFrame.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
�4�ddlm}|||||||||||	|
��S)Nr)r!)
rr�r��aggfuncrd�marginsr)�margins_namererE)r r!)r�rr�r�r%rdr&r)r'rerEr!s            r�r!zDataFrame.pivot_table%s5��	:�������!���%���
�	
r�c�\��|s�ddlm}m}|tjus+|tjus�j
jdkDr$tjdtt���|tjurd}|tjurd}t|ttf�r
|�|||��}n�|�|||��}n�ddlm}|tjurtd	��|tjurtd
��t|ttf�r1t!�fd�|D��st!d�|D��std
��t|ttf�s|g}|D�	cgc]}	�j
j#|	���}}	|�|�}|j%�d��Scc}	w)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�z�The 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)rE)�stack_v3z�dropna 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.z�Cannot specify sort with future_stack=True, this argument will be removed in a future version of pandas. Sort the result using .sort_index instead.c3�N�K�|]}|�jjv���y�wr�)r�r
)rQrr�s  �r�rSz"DataFrame.stack.<locals>.<genexpr>�%s!�����G��#�C�4�<�<�#5�#5�5��s�"%c3�<K�|]}t|t����y�wr�)r�r8)rQrs  r�rSz"DataFrame.stack.<locals>.<genexpr>�%s����B�E�S�J�s�C�0�E�s�zTlevel should contain all level names or all level numbers, not a mixture of the two.r)r�)�pandas.core.reshape.reshaper)r*rr�r�rBr�r�rr+r�r�r
r+r�rr	r�)
r�r}r)rE�future_stackr)r*r�r+rs
`         r�r)zDataFrame.stack3%s����j�
��c�n�n�,��s�~�~�-��<�<�'�'�!�+��
�
�G�"�/�1�
�����'����s�~�~�%����%�%���/�'��e�F��N���t�U�6��E��<��S�^�^�+� �N����3�>�>�)� �+����5�5�$�-�0��G��G�G��B�E�B�B� �9���
�e�e�T�]�3����DI�J�E�S�T�\�\�3�3�C�8�E�E�J��d�E�*�F��"�"�4��"�8�8��Ks�)"F)c�^�|jjsC|j|jj�j�}t	d|����t|�st
|t�r|g}nht
|t�rMtd�|D��r;|st	d��t|�tt|��kDrt	d��|}nt	d��|jd��}t|�dk(r||d	j�}nzd
�}||d	j|�}|ddD]-}	t|||	j|�k(�r�$t	d��t|D�	cic]}	|	||	j���c}	�}|j!|d�
�j#|�}|rt%t|��|_n*|j&j)|j&�|_|j+|jd��}|j-|d��Scc}	w)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: c3�VK�|]!}t|�xst|t����#y�wr�)rFr�r�)rQrLs  r�rSz$DataFrame.explode.<locals>.<genexpr>i&s'����.
�:@�Q�I�a�L�0�J�q�%�0�0�&�s�')zcolumn must be nonemptyzcolumn must be uniquez/column must be a scalar, tuple, or list thereofT)r'r�rc�N�t|�rt|�dkDrt|�SdS)Nrr�)rEr)r9s r��<lambda>z#DataFrame.explode.<locals>.<lambda>x&s ���a��S��V�a�Z�c�!�f�O�a�Or�Nz)columns must have matching element countsr�Fr��exploder�)r�r�rr.r�rFr�r�r
rrr�rr4r�r�r'r�rhr�r/r�r�)
r�r?r&�duplicate_colsr�r�r��mylen�counts0rLs
          r�r4zDataFrame.explode&s���r�|�|�%�%�!�\�\�$�,�,�*A�*A�*C�D�K�K�M�N��G��GW�X��
�
�V��
�6�5� 9��h�G�
���
%�#�.
�:@�.
�+
�� �!:�;�;��6�{�S��V��-�-� �!8�9�9��G��N�O�O�
�
�
�4�
�
(���w�<�1�����
�^�+�+�-�F�O�E��7�1�:�&�,�,�U�3�G��Q�R�[���7�d�1�g�m�m�E�&:�:�;�$�%P�Q�Q�!��G�D�G�q��2�a�5�=�=�?� 2�G�D�E�F�����q��)�.�.�v�6���(��V��5�F�L��:�:�?�?�6�<�<�8�F�L�������5��A���"�"�4�	�"�:�:�� Es�0H*c�J�ddlm}|||||�}|j|d��S)a4
        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)�unstackr9r�)r.r9r�)r�r}rdrEr9r�s      r�r9zDataFrame.unstack�&s.��~	8���u�j�$�7���"�"�4�	�"�:�:r�r|zdf.melt()�callerr�c	�H�t|||||||��j|d��S)N)�id_vars�
value_vars�var_name�
value_namer�r&r|r�)r|r�)r�r<r=r>r?r�r&s       r�r|zDataFrame.melt�&s6�����!��!��%�
��,�t�F�,�
+�	,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�rt�other_klassrtc��tj|�s1t|�r|j�std��t	|�}|j|�}|dk(r|dk7r||j
||��z
Sd}|jj|��}|j||j��}|j|d�S)Nzperiods must be an integerr�rr�)r�r�rH)rrBr?r�r8r�r�r�rHr�r�r�)r�r�r�rYr�s     r�rHzDataFrame.diff�&s���T�~�~�g�&��W�%�'�*<�*<�*>� �!=�>�>��'�l�G��$�$�T�*���1�9��!�|��d�j�j��t�j�<�<�<��D��9�9�>�>�G�>�,���+�+�H�8�=�=�+�I���"�"�4��0�0r�c�@�|�|}||S|jdk(r|S||S)a
        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�rr%s    r��_gotitemzDataFrame._gotitemC's9��"�>��F�
�c�{��	�[�[�A�
��M��c�{�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_alsortc��ddlm}|j|�}||||||��}|j�}t	||fi|��}|S�Nr��frame_apply)rr�r�rm)�pandas.core.applyrJr��aggrV�r�rr�r�rmrJr�r�s        r�rEzDataFrame.aggregate�'sJ��	2��$�$�T�*��
��D�t�$�v�
N�������/���G��G���
r��	transform)r�r�c�p�ddlm}||||||��}|j�}t|t�sJ�|SrH)rKrJrNr�r�rMs        r�rNzDataFrame.transform�'s9��	2�
��D�t�$�v�
N��������&�)�,�,�,��
r�c	�t�ddlm}
|
||||||||||	��
}|j�j|d��S)a�
        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
        rrI)	rr��raw�result_type�by_rowr�r�r�rmr�r�)rKrJr�r�)r�rr�rQrRr�rSr�r�rmrJr�s            r�r�zDataFrame.apply�'sN��|	2�
�����#���'���
���x�x�z�&�&�t�G�&�<�<r�c������dvrtdt������|jr|j�St	j
�fi|�����fd�}|j
|�j|d�S)ah
        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�*��|j����S)N)�	na_action)�_map_values)r9rrVs ��r�rYzDataFrame.map.<locals>.infer�(s����=�=���=�;�;r�r�)r��reprr�r��	functools�partialr�r�)r�rrVrmrYs ``  r�r�z
DataFrame.map�(sx���^�,�,��:�4�	�?�:K�L��
��:�:��9�9�;��� � ��0��0��	<��z�z�%� �-�-�d�E�:�:r�c�t�tjdtt���|j|fd|i|��S)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�rV)r�r�rr+r�)r�rrVrms    r��applymapzDataFrame.applymap�(s:��^	�
�
�P��'�)�	
�
�t�x�x��<�	�<�V�<�<r�c�^�t|ttf�r�t|t�r|std��t|�}|j�
|std��t|jgt|jt�r|jjn|jj��}|j�j}|jd��j|jd��}nnt|t�r^|sn[t|dt�sHt|�}|jj�'|s%|jj|j_ddlm}t|tt"f�r|g|�}n||g}|||||��}	|	j%|d	�
�S)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�rr�)r&rSrEr�r�)r�r}rr	r�rfr�rkr
�to_framerF�
infer_objects�rename_axisr
r�r�r�r�r�)
r�r�r&rSrEr��row_dfr��	to_concatr�s
          r�r�zDataFrame._append)ss���e�f�d�^�,��%��&�#�#�$Q�R�R��u�
���z�z�!�,��2���
������d�j�j�*�5��Z�Z�%�%��Z�Z�_�_�	�E��^�^�%�'�'�F��(�(�e�(�4�@�@����%�A��E���t�
$�����a��)�4�!�%�(���:�:�?�?�.�|�'+�z�z���E�K�K�$�5��e�d�E�]�+�����I��u�
�I���%�-��	
���"�"�4��"�9�9r�c�T�ddlm}ddlm}	t	|t
�r.|j�td��t|j|i�}t	|t�r+|dk(r|	||||||f||��S|	|||||dud||f||�	�	S|�td
��|s|rtd��td|�gt|�z}
td
�|
D��}|r<|dk(r*||
ddd|��}|j|jd��S||
d|d|��S|
d}
|
ddD]}|	|
||dd|��}
�|
S)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
        rr���mergeNzOther Series must have a name�cross)r#�on�suffixesrE�validateT)�left_onr#�
left_index�right_indexrhrEriz?Joining multiple DataFrames only supported for joining on indexz7Suffixes not supported when joining multiple DataFrames�DataFrame | Seriesc3�HK�|]}|jj���y�wr�)r�r�)rQr�s  r�rSz!DataFrame.join.<locals>.<genexpr>!*s����A�&�B�R�X�X�/�/�&�s� "r�r�r�)r�r�rSrEFr�)r#rkrlri)r�r��pandas.core.reshape.mergerer�r}r�r�r�rr
rr�r�)r�r�rgr#�lsuffix�rsuffixrErir�re�frames�
can_concatrp�joinedr�s               r�r�zDataFrame.joinT)s���|	6�3��e�V�$��z�z�!� �!@�A�A��u�z�z�5�1�2�E��e�Y�'��g�~������%�w�/��%����������:� �!�7�+��!�
�

��~� �U����'� �M����/��6�7�$�u�+�E�F��A�&�A�A�J���&�=� ��Q�W�t�RV��C��;�;�t�z�z��;�>�>�!��Q�S�4�d����A�Y�F����������#� $�%�
��$��Mr�r�)�indentsc
�8�ddlm}
|
||||||||||	|
||��
S)Nrrd)r#rgrj�right_onrkrlrErhr��	indicatorri)rore)r�r�r#rgrjrwrkrlrErhr�rxrires              r�rezDataFrame.merge=*s;��"	4��������!�#������
�	
r�c���ddlm}d�fd�}dd��tj||�t	|t
tf�rzt	|t�r!|jjstd��t|�r+td�|j�D��std��t|||��}nit|�rS|j j#|t%���}|j'||j(�	�j+|d
��Std��|�Ot-|�dkDrA|j/||d
��|j|j0��j+|d
��S|j3d��S)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
        rr�c3��K�|j�D]\}}	�|||����y#t$r|��Y�'wxYw�wr�)r�r0)r��decimalsr;rB�
_series_rounds    �r��_dict_roundz$DataFrame.round.<locals>._dict_round�*sF������X�X�Z�	��T��'��h�s�m�<�<�(�� ���J��s�?�,�?�
<�?�<�?c�|�t|j�st|j�r|j|�S|Sr�)rCr�r@�round)r�r{s  r�r|z&DataFrame.round.<locals>._series_round�*s-����	�	�*�n�S�Y�Y�.G��y�y��*�*��Jr�z Index of decimals must be uniquec3�8K�|]\}}t|����y�wr�)rB)rQrrcs   r�rSz"DataFrame.round.<locals>.<genexpr>�*s����2�2B�h�a��
�5�!�2B�s�z#Values in decimals must be integers)r{r�r�rr�z4decimals must be an integer, a dict-like or a Seriesr�r�r�Fr�)r�r�)r�r}r{r8r%r})r�r�r��validate_roundr�rr}r�r�r�r>rr�r	r
rBr�rrr�r�r�rr�r�r�)	r�r{r�rmr�r}�new_colsr�r|s	        @r�rzDataFrame.round`*sc���^	6�	�	�
	���$��'��h��v��/��(�F�+�H�N�N�4L�4L� �!C�D�D��H�%�c�2�2:�.�.�2B�2�/� � E�F�F��K��h�7�8�H�
��
!��i�i�o�o�!�-�/�&��G��-�-�g�G�L�L�-�I�V�V��W�W��
��R�S�S���C��M�A�$5��$�$��x�a�(��
�
�D�L�L�%���l�4��l�0�
1��9�9�%�9�(�(r�c��|r|j�n|}|j}|j�}|jtt
jd��}|dk(rtj||��}�n:|dk(rtj||��}�n|dk(st|�r�|�d}|j}tj|�}	t|�}
tj|
|
ft��}tj |�}t#|�D]�\}}
t#|�D]y\}}||kDr�||||z}|j%�|krt
j}n1||k(rd	}n)|j'�s|	|
|||�}n	|	|
|�}||||f<||||f<�{��nt)d
|�d���|j+|||d��}|j-|d
��S)a


        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�rrf�libalgos�nancorr�nancorr_spearman�callablerFrR�
get_corr_funcrr��isfiniter�rhrr�r�r�)r�r��min_periods�numeric_onlyrrIr�mat�correl�corrf�Kr4r��acrw�bc�validrLr�s                   r�r�zDataFrame.corr�*s���N,8�t�%�%�'�T���|�|���i�i�k���m�m�%�"�&�&�u�m�E���Y���%�%�c��<�F�
�z�
!��.�.�s��E�F�
�y�
 �H�V�$4��"����%�%�C��(�(��0�E��D�	�A��X�X�q�!�f�E�2�F��;�;�s�#�D�"�3����2�&�s�^�E�A�r��1�u� � ��G�d�1�g�-�E��y�y�{�[�0��F�F���a����"�Y�Y�[�!�"�U�)�R��Y�7��!�"�b�M��#$�F�1�a�4�L�#$�F�1�a�4�L�,�(�"���8�>�+��
��"�"�6��d��"�O���"�"�4��"�7�7r�c��|r|j�n|}|j}|j�}|jtt
jd��}t|�j�r�|�_|t|�kDrQtj|jd|jdf�}|jt
j�n!tj|j|��}|jt|�t|�f�}nt!j"|d|��}|j%|||d��}	|	j'|d�	�S)
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�r�r�)r�r�r�r�r�rrfrOrrr�r;�fillr�rFrEr�r�r�r�)
r�r�r�r�rrIrr��base_covr�s
          r�r�z
DataFrame.covQ+s	��`,8�t�%�%�'�T���|�|���i�i�k���m�m�%�"�&�&�u�m�E����:�>�>���&�;��S��+A��8�8�S�Y�Y�q�\�3�9�9�Q�<�$@�A���
�
�b�f�f�%��6�6�#�%�%�d�3���'�'��T��C��I�(>�?�H��'�'���K�H�H��"�"�8�3��5�"�Q���"�"�4��"�6�6r�c	����|j|�}|r|j�n|}t�t�r|j	��fd�|��S|r�j��|j�dd��\}}|dk(r|j}|j}�dk(r�||dzz}||dzz}||j|�	�z
}	||j|�	�z
}
|	|
zj�}|j�dz
|j|�	�z|j|�	�z}||z}
n~�d
vst��r`�fd�}|jt|t|jj|jj��|j d��}
nt#d
��d���|s�|dk(rdnd}|j%|�j'�j%|��}|j)|
j*�}t-|�dkDr7|
j/tt0j2gt-|�z|���}
|
S)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�*���j|���S)Nr�)r�)r9r�r�s ��r�r3z$DataFrame.corrwith.<locals>.<lambda>,s����
�
�1�V�
�(Dr�r�r�F)r�r�r�r�r)r�)r�r�c�@��tj|d|d���S)Nrr�r�)rRr�)r9r�s �r�rLzDataFrame.corrwith.<locals>.c=,s����~�~�a��d�A�a�D��@�@r�r�zInvalid method zM was passed, valid methods are: 'pearson', 'kendall', 'spearman', or callabler)r�r�r�r}r�r�rFr"rhr/�stdr�r�r�r�rr�r�r-r�rr�rr�rrf)r�r�r�r'r�r�r�r�r��ldem�rdem�num�domr�rL�raxisr!�idx_diffs `  `             r��corrwithzDataFrame.corrwith�+s*���P�$�$�T�*��+7�t�%�%�'�T���e�V�$��:�:�D�4�:�P�P���+�+�-�E��j�j��W�5�j�A���e��1�9��6�6�D��G�G�E��Y���%�!�)�#�D��D�1�H�$�E��$�)�)��)�>�>�D��5�:�:�<�:�@�@�D��$�;�#�#�%�C������!��(�(��(�5�6��)�)��)�6�7�
��3�Y�F�
�.�
.�(�6�2B�
A��-�-��A�s�4�;�;�=�=�%�,�,�.�.�9�:��l�l��.��F��!�&��**�*��
��#'�!�)�Q��E��>�>�%�0�6�6�u���u�7M�N�L�#�.�.�v�|�|�<�H��8�}�q� �����B�F�F�8�c�(�m�3�8�D����
r�c�L�|j|�}|r|j�}n|}t|j|��dk(r#|j	d|j|���}nt
|�j|��}|jdd��j|d��S)	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
        rrr�r�Fr�r/r�)
r�r�rr-r��
_get_agg_axisrOrhrAr�)r�r�r�r�r�s     r�r/zDataFrame.count^,s���|�$�$�T�*����*�*�,�E��E��u���t�$�%��*��-�-�a�u�7J�7J�4�7P�-�Q�F��5�\�%�%�4�%�0�F��}�}�W�5�}�1�>�>�t�G�>�T�Tr��r��skipnar��filter_typec	��������������dk(sJ����dk(rdnd}���j���d����fd�}	i�dd ������fd�
}
d!��fd�}�}|r|�}���t|jjD�
cgc]}
|
j��c}
�}t|t�rK|j|d��}tt|j���}
|
j�f�dd����S|	|j�S�dk(�rNt|j�d	k(r9|j��fd	�d�d
����jdd	}|j|_|S|j d�r�dk7�r�t|jjD�
cgc]}
|
j��c}
�}t|t��r�dd
d�j#����|j|d��}tt|j���}
|j \}}t%j&t%j(|�|�}t%j*t%j(|�|�}t-|
|d��}t/d��d�t0dt3��j4�d��d���5|j7|�j8�fi���}ddd�|j_�sj�dvrf|j;�j=t$j>��jAd��}�dvrdntBjD}|jG||�}|S|jH}|jjK|
�}|jM||jN��jd	}|�"|jdk7r|j|�}|S|jjQ�tRk(jA�r�dvr|jtR�}|St��d	k(r6|jtRk(r#�dvr|jt$jT�}|Scc}
wcc}
w#1swY���xYw)"Nrc����|f��d����S)N�r�r�rk)rr��kwdsr�r�s ����r�rzDataFrame._reduce.<locals>.func�,s����f�?�4��?�$�?�?r�r�c�L��t|t��rt|j�s0t�	jt
�s|j�fd�
d����S�j|j�}|�2t|j�}d|jv}|�|j<|r|j�f�
dd����Stjt|��d�tt���|j�fd�
i���}tj |g�S�|f|�
d����S)	Nr�r��keepdimsT�r�r�z:._reduce will require a `keepdims` parameter in the futurer�r�)r�r[r:r�r�ro�_reducerlr
�
parametersr�r�r�rr+rr�)rr��has_keepdims�signr��dtype_has_keepdimsr�r�r�r�r�s     ������r��blk_funcz#DataFrame._reduce.<locals>.blk_func�,s����&�.�1�*�6�<�<�8���I�I�|�B�*�6�>�>�$�N�Q�v�N��N�N�1�5�5�f�l�l�C���'�$�V�^�^�4�D�#-����#@�L�7C�&�v�|�|�4��)�6�>�>�$�U�v��U�PT�U�U��M�M���<�.�)(�(�%�#3�#5�	�,�V�^�^�D�H��H�4�H�F��8�8�V�H�-�-��&�C�t�F�C�d�C�Cr�c�^�����j�}|S�dk(sJ��j�}|S)Nr)r��_get_bool_data)rr�r�s ��r��	_get_dataz$DataFrame._reduce.<locals>._get_data�,sA����"��-�-�/��
�K�#�f�,�,�,��*�*�,���Kr�Fr�r�rr��kurt�idxmax�idxmin)�argmax�argminr�zThe 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)r1rr�r�)r�r�rCr��boolean)rh�prod)r�
np.ndarray)r��r�r��r%r�)+r�r4r�rr�r�rMrArJr
r�r�rrr�rr;rlrrYrE�repeatr}r,rr�r�rfrLrNr��bool_r1rr�r4rF�reducer�r��
get_dtypesrr�)r�r�r�r�r�r�r�r��	out_dtyperr�r�r�r=r�r�r4r��	row_index�	col_indexr�r4r�rpr�r�s````` ``                 @r�r�zDataFrame._reduce�,s����"�k�V�&;�H�[�H�;�)�V�3�F��	����(�(��.�D�	@�	@�:<��	D�	D�2	������B��<�$�2�7�7�>�>�%J�>�C�c�i�i�>�%J�K�E��%��0��Y�Y�u�5�Y�1��#�D��)?�)?�)A�$B�C��"�s�{�{�4�O���O�$�O�O���	�	�?�"�
�Q�Y��2�8�8�}��!�$��������!�!&� +�
����$�r���� "�x�x����
��x�x��{�t�v�~�(�r�w�w�~�~�)N�~��#�)�)�~�)N�O���e�^�4�'/�(�C�G�G��d�S�D����5�u��5�B�'��R�-C�-C�-E�(F�G�C�#%�8�8�L�E�5� "����	�	�%�(8�%� @�I� "�	�	�"�)�)�E�*:�E� B�I� ��I�E�B�C�)�<�T�F�BU�V�(5�.�t�D�z�/B�/B�.C�1�T�F�KJ�J�
�"<����Y�!7�!;�!;�D�!I�D�!I��
�$&�8�8�F�L�!�d�.�&@�!�w�w�y�1�1����1�A�E�E�1�E�M��&*�.B�&B������!'���T�5�!9��!�M����B��g�g�n�n�X�&���&�&�s����&�:�?�?��B��� �S�Y�Y�)�%;��*�*�Y�'�C��
��g�g� � �"�f�,�
1�
1�
3��N�8R��*�*�V�$�C��
���Y�!�^��	�	�V� 3���8O��*�*�R�Z�Z�(�C��
��Y&K��2*O�"
�
�s�;Q�Q� #Q�Q#c��|dk(r5tjt|�t��}tj}nE|dk(r5tj
t|�t��}tj}nt|��|jjD]}||d|��}|||�}�|j||jd��}|S)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.
        rr�r1rr�Fr�)r�onesrr�logical_and�zeros�
logical_orr:r�rr�r�)	r�r�rr�r��ufuncr=�middle�res_sers	         r��
_reduce_axis1zDataFrame._reduce_axis17-s����5�=��W�W�S��Y�d�3�F��N�N�E�
�U�]��X�X�c�$�i�t�4�F��M�M�E�%�d�+�+��9�9�#�#�C��#�A�f�5�F��6�6�*�F�$��*�*�6����%�*�P���r�r1rC)r�r,r�c��|jdtj|||fi|��}t|t�r|j|d��}|S)Nr1r�)�
_logical_funcrR�nananyr�r}r��r�r�r,r�rmr�s      r�r1z
DataFrame.anyS-sS��$��#�#��6�=�=�$�	�6�
�=C�
���f�f�%��(�(��e�(�<�F��
r�rc��|jdtj|||fi|��}t|t�r|j|d��}|S)Nrr�)r�rR�nanallr�r}r�r�s      r�rz
DataFrame.alld-sS��$��#�#��6�=�=�$�	�6�
�=C�
���f�f�%��(�(��e�(�<�F��
r�rYc�r��t�|�|||fi|��}t|t�r|j	|d��}|S)NrYr�)r�rYr�r}r��r�r�r�r�rmr�r�s      �r�rYz
DataFrame.mins-�@������T�6�<�B�6�B���f�f�%��(�(��e�(�<�F��
r�r\c�r��t�|�|||fi|��}t|t�r|j	|d��}|S)Nr\r�)r�r\r�r}r�r�s      �r�r\z
DataFrame.max�-r�r�rhc�P��t�|�||||fi|��}|j|d��S)Nrhr�)r�rhr��r�r�r�r��	min_countrmr�r�s       �r�rhz
DataFrame.sum�-s4������T�6�<��M�f�M���"�"�4��"�6�6r�r�c�P��t�|�||||fi|��}|j|d��S)Nr�r�)r�r�r�r�s       �r�r�zDataFrame.prod�-s4������d�F�L�)�N�v�N���"�"�4��"�7�7r�c�r��t�|�|||fi|��}t|t�r|j	|d��}|S)Nr"r�)r�r"r�r}r�r�s      �r�r"zDataFrame.mean�-�@������d�F�L�C�F�C���f�f�%��(�(��f�(�=�F��
r��medianc�r��t�|�|||fi|��}t|t�r|j	|d��}|S)Nr�r�)r�r�r�r}r�r�s      �r�r�zDataFrame.median�-s@�������f�l�E�f�E���f�f�%��(�(��h�(�?�F��
r��semc�t��t�|�||||fi|��}t|t�r|j	|d��}|S)Nr�r�)r�r�r�r}r��r�r�r�r�r�rmr�r�s       �r�r�z
DataFrame.sem�-�B������T�6�4��H��H���f�f�%��(�(��e�(�<�F��
r��varc�t��t�|�||||fi|��}t|t�r|j	|d��}|S)Nr�r�)r�r�r�r}r�r�s       �r�r�z
DataFrame.var�-r�r�r�c�t��t�|�||||fi|��}t|t�r|j	|d��}|S)Nr�r�)r�r�r�r}r�r�s       �r�r�z
DataFrame.std�-r�r��skewc�r��t�|�|||fi|��}t|t�r|j	|d��}|S)Nr�r�)r�r�r�r}r�r�s      �r�r�zDataFrame.skew�-r�r�r�c�r��t�|�|||fi|��}t|t�r|j	|d��}|S)Nr�r�)r�r�r�r}r�r�s      �r�r�zDataFrame.kurt�-r�r��cumminc�8�tj|||g|��i|��Sr�)rbr��r�r�r�r�rms     r�r�zDataFrame.cummin.����~�~�d�D�&�B�4�B�6�B�Br��cummaxc�8�tj|||g|��i|��Sr�)rbr�r�s     r�r�zDataFrame.cummax
.r�r��cumsumc�8�tj|||g|��i|��Sr�)rbr�r�s     r�r�zDataFrame.cumsum.r�r��cumprodc�8�tj|||g|��i|��Sr�)rbrr�s     r�rzDataFrame.cumprod.s�����t�T�6�C�D�C�F�C�Cr�c�F�|jtj||��S)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�rzDataFrame.nunique.s��L�z�z�&�.�.�t�F�z�C�Cr�r��False)�numeric_only_defaultc���|j|�}|jrCt|j|�r+|j|j}|j|��S|r|j
�}n|}|jtjd||d��}|j}|dk(j�r;tjdt|�j�d�t t#���|j%|�}t'j(|j|d	|j*�
�}	|j|	|j-|���}
|
j/|d�
�S)Nr�r�F�r�r�r�rCr�zu.idxmin with all-NA values, or any-NA and skipna=False, is deprecated. In a future version this will raise ValueErrorr�Trrr�r�)r�r�rr�r�r�r�r�rR�	nanargminrGr1r�r�r�r�rr+r-rPr/rr�r��r�r�r�r��
axis_dtyperrpr2r�r��final_results           r�r�zDataFrame.idxmin>.�C���$�$�T�*���:�:�#�d�i�i��o�.����4��.�.�J��+�+�*�+�=�=���)�)�+�D��D��l�l����h�T�&�u��
���+�+��
�r�M��� ��M�M�"�4��:�#6�#6�"7�85�5��+�-�
����t�$������M�M�7�t����
���/�/��d�>P�>P�QU�>V�/�W���(�(��h�(�?�?r�r�c���|j|�}|jrCt|j|�r+|j|j}|j|��S|r|j
�}n|}|jtjd||d��}|j}|dk(j�r;tjdt|�j�d�t t#���|j%|�}t'j(|j|d	|j*�
�}	|j|	|j-|���}
|
j/|d�
�S)Nr�r�FrrCr�zu.idxmax with all-NA values, or any-NA and skipna=False, is deprecated. In a future version this will raise ValueErrorr�Trrr�r�)r�r�rr�r�r�r�r�rR�	nanargmaxrGr1r�r�r�r�rr+r-rPr/rr�r�r
s           r�r�zDataFrame.idxmaxc.r
r�c�v�|dk(r|jS|dk(r|jStdt|��d���)z/
        Let's be explicit about this.
        rr�zAxis must be 0 or 1 (got rT)r�r�r�rX)r��axis_nums  r�r�zDataFrame._get_agg_axis�.s@���q�=��<�<��
��]��:�:���8��h��8H��J�K�Kr�c���|s|n|j�}�fd�}|j||��}|jrtd�|_|S)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�(��|j���S)N)r))r)r�r)s �r�rCzDataFrame.mode.<locals>.f�.s����6�6��6�(�(r�r�r)r�r�r�rhr�)r�r�r�r)rrCs   `  r�rzDataFrame.mode�.sI���`(�t�T�-C�-C�-E��	)��z�z�!�$�z�'���:�:�&�q�)�D�J��r�c��yr�rk�r��qr�r��
interpolationr�s      r��quantilezDataFrame.quantile�.r7r�c��yr�rkrs      r�rzDataFrame.quantile�.r7r�c��yr�rkrs      r�rzDataFrame.quantile/r7r�c��t|�|j|�}t|�s�|j|g||||��}|dk(r|jd}n|j
jdd�df}|dk(rHt
|�dk(r:tt|j��}t|�r|j|�S|St|tj��}|r|j�n|}	|dk(r|	j
}	t
|	j �dk(r�tg|j j"��}
tj}|dk(r+tt|j��}t|�r|}|j%g||
|��}|j'|d	�
�Sddh}||vrt)d|�d
|�d���|dk(r|	j*j||��}�nL|dk(�rFhd�}
||
vrt)d|�d|
����t
|	�dk(rY|	j,dk(rtt|j��}n|j.}|j%g||	j |��Stjtj0t
|	��||�
�}|	j }t
|�dkDr*|D�cgc]}|	j3|���}}t5|�}n|	j3|d�}t7|�}|	j*j9||d��}||j:d<|j=|j:��}|j'|d	�
�Scc}w)a�
        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�r�rr��singlerNr�r�r�r�rr�r8zInvalid method: z. Method must be in r�)�qsr>r��higher�nearestzInvalid interpolation: z. Interpolation must be in r�F)rVr�)r/r�rErrrFrr4r
rrHrArfrr�r�r�r�r�r�r�r�rr�rErWr�r�r/r�r�)r�rr�r�rr�r�rpr�rrI�cdtype�valid_method�valid_interpolation�q_idxrNr9r�r�r�r�s                     r�rzDataFrame.quantile/s*��v	�A���$�$�T�*���A���]�]����)�+��#��F���!��k�k�!�n���h�h�m�m�A�q�D�)���q�y�S��Y�!�^�(��d�k�k�):�;��&�u�-��:�:�e�,�,��J��!�2�:�:�&��+7�t�%�%�'�T���1�9��6�6�D��t�|�|���!���$�,�,�"3�"3�4�D��J�J�E��q�y�)�$�t�{�{�*;�<��&�v�.�"�E��#�#�B�a��U�#�K�C��#�#�D��#�<�<� �'�*����%��"�6�(�*>�|�n�A�N��
��X���)�)�$�$���$�G�C�
�w�
�"@���$7�7� �-�m�_�=0�0C�/D�F���
�4�y�A�~��9�9��>�,�T�$�+�+�->�?�E� �J�J�E��(�(��1�d�l�l�RW�(�X�X��K�K��	�	�#�d�)� 4�a�
�N�E����B��2�w��{�DF�G�B�q��7�7��:�B��G�)�$�/���3�3�B�q�E�:��"�1�+���)�)�.�.�����.�>�C��C�H�H�Q�K��+�+�C�c�h�h�+�?���"�"�4�
�"�;�;��Hs�7Mc� �|j|xrt���}|j|�}t||�}t	|t
�s!t
dt|�j����|j||��}t|||�|S)a	
        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�rgr	r�r��to_timestamp�setattr)	r�r�r#r�r�r�	axis_name�old_ax�new_axs	         r�r'zDataFrame.to_timestamp�/s���L�)�)��!C�.A�.C�*C�)�D���'�'��-�	���y�)���&�+�.��/��V��0E�0E�/F�G�H�H��$�$�$�C�$�8�����F�+��r�c��|j|xrt���}|j|�}t||�}t	|t
�s!t
dt|�j����|j|��}t|||�|S)ac
        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�rr&r�r�rer	r�r��	to_periodr()r�r�r�r�rr)r*r+s        r�r-zDataFrame.to_period0s���r�)�)��!C�.A�.C�*C�)�D���'�'��-�	���y�)���&�-�0��/��V��0E�0E�/F�G�H�H��!�!�t�!�,�����F�+��r�c�*���t�t�rIddlm}t	j
t���|��fd�t�j�D�d��}�n&t�t�rD�jjstd���j�j��d��}n�t�t�rX�jjr�jjstd���j�j���}njt!��s"t#dt%��j&�d	����fd
�}�j(j+|�}�j-||j.��}|j1�d�
�S)ag	
        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
        rr�c3�p�K�|]-\}}�jdd�|gfj�|����/y�wr�)r�isin)rQr�r;r�rs   ��r�rSz!DataFrame.isin.<locals>.<genexpr>�0s;������"9���3��I�I�a�!��f�%�*�*�6�#�;�7�"9�s�36r�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���tj|j���}|j|j�Sr�)rPr0�ravelrEr;)r9r�rs  �r��isin_zDataFrame.isin.<locals>.isin_�0s4���
$����G�G�I�����~�~�a�g�g�.�.r�r�r0r�)r�rr�r�r��defaultdictr
r�r�r}r�r�r�r��reindex_liker�rEr	r�r�r�r�r�r�r�)r�rr�r�r3rs``    r�r0zDataFrame.isinV0sU���J�f�d�#�9� �,�,�T�6�:�F���"+�D�L�L�"9����F����
'��<�<�)�)� �!M�N�N��W�W�V�0�0��6�W�W�E�F�
��	�
*��N�N�,�,����1G�1G� �!M�N�N��W�W�V�0�0��6�7�F���'��%�%)�&�\�%:�%:�$;�1�>���	
/��i�i�o�o�e�,�G��/�/���\�\�0��F��"�"�4��"�7�7r�z!list[Literal['index', 'columns']]�_AXIS_ORDERS)r�r�zdict[Axis, int]�_AXIS_TO_AXIS_NUMBERz
Literal[1]�_info_axis_numberzLiteral['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	��|j}ttt|d��}|j	�j�D��cic]2\}}||j
||j��j|���4c}}Scc}}w)z�
        Return a dict of dtype -> Constructor Types that
        each is a homogeneous dtype.

        Internal ONLY - only works for BlockManager
        �blockr�)	r�rrprtrr�r�r�r�)r�r�r�r�s    r��_to_dict_of_blockszDataFrame._to_dict_of_blocks1s~���i�i���<��C��!9�:������,�,�.�
�.���1�
�t�)�)�!�!�&�&�)�9�F�F�t�L�L�.�
�	
��
s�7Bc�6�|jj�S)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�rzDataFrame.values.1s��T�y�y�!�!�#�#r�)r%zCallable[..., DataFrame]r�)r%r})NNNNN)
r��Axes | Noner�r?r��Dtype | Noner��bool | Noner%�None)FT)r$rr"rr%�
DataFrameXchg)r'�
str | Noner%rr�)r%zlist[Index])r%ztuple[int, int])r%r)r%rD)r%r�)r%rD)...................)(rOrBr�r?rs�,int | list[int] | dict[Hashable, int] | Noner{�bool | SequenceNotStr[str]r�rrtr�rv�fmt.FormattersType | Nonerw�fmt.FloatFormatType | NonerxrArzrryrDrJ�
int | NonerrIr�rr�r�r�rIr~rIr�rIr�rDr%r�)..................)(rO�FilePath | WriteBuffer[str]r�r?rsrEr{rFr�rrtr�rvrGrwrHrxrArzrryrDrJrIrrIr�rr�r�r�rIr~rIr�rIr�rDr%rB)NNNTTruNNNTNNNFr�NNNN)(rO�"FilePath | WriteBuffer[str] | Noner�r?rsrEr{rFr�rrtr�rvrGrwrHrxrArzrryrDrJrIrrIr�rr�r�r�rIr~rIr�rIr�rDr%rD)
rw�FloatFormatType | Noner�rDr�r�rtr�r%r�)r%r�)r%z!Iterable[tuple[Hashable, Series]])T�Pandas)r�rr�rDr%zIterable[tuple[Any, ...]])r%r8)r�r}r%r})r�zDataFrame | Index | ArrayLiker%r�)r�zAnyArrayLike | DataFramer%rm)r�NN)
rrr�r�r�r@r�r?r%r�)r�znpt.DTypeLike | Noner�rr�rr%r�)r�rr�z	list[int]r%r
).)r��<Literal['dict', 'list', 'series', 'split', 'tight', 'index']r�'type[MutableMappingT] | MutableMappingTr�rr%r�)r��Literal['records']rrOr�rr%zlist[MutableMappingT])r�rNr�
type[dict]r�rr%r)r�rPrrQr�rr%z
list[dict])r�zGLiteral['dict', 'list', 'series', 'split', 'tight', 'records', 'index']rrOr�rr%z'MutableMappingT | list[MutableMappingT])	NNF�failTNNTN)rr�rrDrrIrrrr�rrrzlist[dict[str, str]] | NonerrDrrr%rB)NNNFN)r3rr4rIr%r�)TNN)r�rr%znp.rec.recarray)NT)r�r@rSrr%r�)rW�FilePath | WriteBuffer[bytes]rZ�dict[Hashable, str] | Noner[rr\zToStataByteorder | Noner]zdatetime.datetime | Noner^rDr_rTr�rIr`zSequence[Hashable] | Nonerar�rU�StorageOptions | Nonerbz'dict[Hashable, dict[float, str]] | Noner%rB)rWrSr%rB)N�wtTN)
rOrKrr�r�rrUrUr%rD)......)rWrBr��)Literal['auto', 'pyarrow', 'fastparquet']rarDr�rAr��list[str] | NonerUr�r%�bytes).....)rWrSr�rWrarDr�rAr�rXrUr�r%rB)N�auto�snappyNNN)rW�$FilePath | WriteBuffer[bytes] | Noner�rWrarDr�rAr�rXrUrUr%�bytes | None)
rWr\r�zLiteral['pyarrow']r�rAr�zdict[str, Any] | Noner%r])......................)0rOrJr�r?rs�ColspaceArgType | Noner{rr�rrtr�rv�FormattersType | NonerwrLrxrArzrryrDrJrIrrIr��
bool | strr�r�r|rr��str | list | tuple | Noner}rr�rr��int | bool | Noner�rDr�rr�rDr%rB).......................)0rOrBr�r?rsr^r{rr�rrtr�rvr_rwrLrxrArzrryrDrJrIrrIr�r`r�r�r|rr�rar}rr�rr�rbr�rDr�rr�rDr%r�)NNNTTruNNNTNNNFr�TNTFNNFN)0rOrKr�r?rsr^r{rr�rrtr�rvr_rwrLrxrArzrryrDrJrIrrIr�r`r�r�r|rr�rar}rr�rr�rbr�rDr�rr�rDr%rD)"r�rBr�rr�rDr�rDrtrDr�rXr�rXr��dict[str | None, str] | Noner�rDr�r�r�rAr�rAr��XMLParsers | Noner��5FilePath | ReadBuffer[str] | ReadBuffer[bytes] | Nonerar�rUrUr%r�)"r�z0FilePath | WriteBuffer[bytes] | WriteBuffer[str]r�rr�rDr�rDrtrDr�rXr�rXr�rcr�rDr�r�r�rAr�rAr�rdr�rerar�rUrUr%rB)NTrrNNNNNzutf-8TTr�NrYN)"r�z7FilePath | WriteBuffer[bytes] | WriteBuffer[str] | Noner�rr�rDr�rDrtrDr�rXr�rXr�rcr�rDr�r�r�rAr�rAr�rdr�rerar�rUrUr%rD)r�rArOzWriteBuffer[str] | NonerrIr�zbool | str | Noner�rAr%rB)TF)r�rr�rr%r})r�rr%r�)r)r�r8r�r�r%r})r�r8r%r�)r%zIterator[ArrayLike])r�r
)F)r
rr%r�)r%rB)r�r�r%rB)rcr�r%rB)FN)rzint | slice | np.ndarrayr�rr�BlockValuesRefs | Noner%rB)rcr�rrfr%rB)T)rr8rcr}r�rr%rB)r�r�rcr�r
rr%rB)rr�rr8r%r})rnrr%r})rcr}r�rr%rB)rxr�r��Literal[False]r%r�)rxr�r��
Literal[True]r%rB)rxr�r�rr%�DataFrame | None)rxr�r�rgr%r)rxr�r�rr%z
Any | None)NN)r%r�)
rr8r?rrczScalar | AnyArrayLiker��bool | lib.NoDefaultr%rB)r%�(tuple[ArrayLike, BlockValuesRefs | None])r�zdict[str, Index]r�rr%r�)r�r�r�rAr%r�)r��Axis | Noner�zReindexMethod | Noner�rAr}�Level | Nonerdz
Scalar | Noner�rIr%r�)r�r�r�r�r�r�r�r�r}r�r�rhr�r�r%rB)r�r�r�r�r�r�r�r�r}r�r�rgr�r�r%r�)r�r�r�r�r�r�r�r�r}r�r�rr�r�r%ri)r��IndexLabel | Noner�r�r�rnr�rnr}rmr�rr�r�r%ri)r��Renamer | Noner�ror�ror�rlr�rAr�rhr}r�r�r�r%rB)r�ror�ror�ror�rlr�rAr�rgr}r�r�r�r%r�)r�ror�ror�ror�rlr�rAr�rr}r�r�r�r%ri)r�ror�ror�ror�rlr�rAr�rr}rmr�r�r%ri)r�zdict[Hashable, tuple[Any, Any]]r�r)r�zint | Sequence[int]r��Frequency | Noner�r�rdrr�rDr%r�)
r'rr�rr�rgrSrr%r�)
r'rr�rr�rhrSrr%rB)
r'rr�rr�rrSrr%ri)r}r�r'rr�rgr�rr�rr�rjr
�$Hashable | Sequence[Hashable] | Noner%r�)r}r�r'rr�rhr�rr�rr�rjr
rqr%rB)r}r�r'rr�rr�rr�rr�rjr
rqr%ri)r}rnr'rr�rr�rr�rr�rjr
rqr%ri)r�r�r#�AnyAll | lib.NoDefaultr$�int | lib.NoDefaultr%r�r�rgr&rr%r�)r�r�r#rrr$rsr%r�r�rhr&rr%rB)r�r�r#rrr$rsr%rnr�rr&rr%ri)
r%rqr�r�r�rhr&rr%rB)
r%rqr�r�r�rgr&rr%r�)
r%rqr�r�r�rr&rr%ri)Nr:)r%rqr�r�r%r})rNr�r�r�r�rgrr�rKr�r&rr�r�r%r�)rNr�r�r�r�rhrr�rKr�r&rr�r�r%rB)rNr�r�r�rJz$bool | list[bool] | tuple[bool, ...]r�rrr�rKr�r&rr�zValueKeyFunc | Noner%ri)r�r�r}r�rJ�bool | Sequence[bool]r�rhrr�rKr�rZrr&rr�r�r%rB)r�r�r}r�rJrtr�rgrr�rKr�rZrr&rr�r�r%r�)r�r�r}r�rJrtr�rrr�rKr�rZrr&rr�r�r%ri)r�r�r}rnrJrtr�rrr�rKr�rZrr&rr�zIndexKeyFunc | Noner%ri)NFTFT)r%rnrjrrErrJrr)rr%r})r:)r�r8r�r�r�r�r%r�)���rCr)r�r�rwr�r�r�r%r�)rzzSequence[int | str]r�r�r%r�)rrr�zAxisInt | Noner%r�)r�r�)r�r�r%r�)r�r8r%r)r�r�r}rAr}rm)rr}r�r�r�)r%ztuple[DataFrame, DataFrame])r�N)r�r�r%r�)r�FFr�)r�r�r�r�r�rr�rr�r�r%r�)r�r�rz-Callable[[Series, Series], Series | Hashable]r�rr%r�)r�r�r%r�)r�TNr�)r�r�r�rr�r�r%rB)r�zAxis | lib.NoDefaultr}rnrrrErrrrerjr)rr%r�)r%r�r&rr)rr'r�rerjrErr%r�)r}r�r)rjrErjr/r)r?r�r&rr%r�)rCNT)r}r�rEr)NNNrcNT)r?rr�rmr&rr%r�)r�r)r�r8r�r�r%r�)r�r�rr8r%zDataFrame | Series | Noner%rm)Nr)rr�r�r�r%r�)rFNrk�compat�pythonN)rr�r�r�rQrrRz/Literal['expand', 'reduce', 'broadcast'] | NonerSzLiteral[False, 'compat']r�zLiteral['python', 'numba']r�zdict[str, bool] | None)rr�rVrDr%r�)rr�rVzNaAction | Noner%r�)FFF)r&rrSrrErr%r�)Nr�rrFN)r�z1DataFrame | Series | Iterable[DataFrame | Series]rgrnr#r�rpr�rqr�rErrizJoinValidate | Noner%r�)r�NNNFFF)�_x�_yNFN)r�rmr#r�rg� IndexLabel | AnyArrayLike | NonerjrzrwrzrkrrlrrErrhr�r�rArxz
str | boolrizMergeValidate | Noner%r�)r{z$int | dict[IndexLabel, int] | Seriesr%r�)r�r�F)r�r�r�r8r�rr%r�)Nr�F)r�rIr�rIr�rr%r�)rFr�F)r�rmr�r�r'rr�r�r�rr%r})rF)r�r�r�r)r�r�r�r�r�rr�r)r�r�r�rr%r})r�rlr,rr�rr%z
Series | bool)rFT)rTF)r�rlr�rr�r)rTFr)r�rlr�rr�rr�r8)rTr�F)r�rlr�rr�r8r�r)r�rlr�r)rT)r�r�r)rr%r})r�r�r�rr�rr%r})rr8r%rf)r�r�r�rr)rr%r�)rr�r�r�r�rrr�r��Literal['single', 'table']r%r})....)rzAnyArrayLike | Sequence[float]r�r�r�rrr�r�r{r%�Series | DataFrame)rz&float | AnyArrayLike | Sequence[float]r�r�r�rrr�r�r{r%r|)g�?rF�linearr)NrFrN)
r�rpr#r�r�r�r�rAr%r�)NrN)r�rpr�r�r�rAr%r�)rz'Series | DataFrame | Sequence | Mappingr%r�)r%r�(r��
__module__�__qualname__�__doc__rb�_internal_names_set�_typr}rfr[rr�_HANDLED_TYPESr��__annotations__r�r��__pandas_priority__�propertyr�r�r�r�r�r%r,r5r�r;r>rArGrKreriror�rrZr)r(rl�common_docstring�return_docstringr�r�r~r'r�r�r�r�r�r�r��classmethodr�rr�r�rrrrr=rQrTr*rorqrs�_shared_doc_kwargsr�r�r�r�r�r�rgr�r�rFr�r�r�r�r�r�r�rrr)r"r$r0r#r%rrTrWr'rbrDr�rPr�rrruryrr�r�r�rr�r�r�r�rfr'r�r^r�r�r&rrNrrOr"r)r�rrOr]rlrprsrvrryr�r��_logical_methodrr�r�r�r~r�r�r�r�r�r�rS�
make_flex_docr�r�r�r�r�r�r.r�r��subtractr�r��multiplyr�r�r��divider��rdivr�r�r�r�r�r�r�r�rr/rfrr!r)r4r9r|rHrD�_agg_see_also_doc�_agg_examples_docrErLrNr�r�r\r�r��
_merge_docrerr�r�r�r/r�r�rcr1rrYr\rhr�r"r�r�r�r�r�r��kurtosis�productr�r�r�rrr�r�r�rrr'r-r0r6r7r�	_AXIS_LENr8r9r�AxisPropertyr�r�rUr��plotting�PlotAccessorr:�
hist_frame�hist�
boxplot_frame�boxplotr^r�r=r�
__classcell__)r�s@r�r�r��s�=���D�L%�g�.��1L�1L�L���D��e�^�R�Z�Z�@�N�$�:�J��%�$+�$9�$9�I�b�M�$I�M�>�I�
%�%���
����%�"28��.�7�-�$�!�#�"� �
r��r��	r�
�r��
r�
�r�n=A�,@��,@�59�,@�	�,@�^,0�
V�(�
V�	�
V�*�:�*��*� �2��2�*�A��A�4�.��.�����:%�-"�^
�
-�*�X��"�BE�-0���03�36� #��!�"�"� #��!$�"�#&�"�)�
����@�	�
+���
���.��1�������������� �!�"�#�$�%�&!�'�(�)�*

�+���0� #�BE�-0���03�36� #��!�"�"� #��!$�"�#&�"�)�
(����@�	�
+���
���.��1�������������� �!�"�#�$�%�&!�'�(�)�*
�+���0$��V�U�O�+���)��2�K�
	��� 4� 4�c�>R�>R�S�37�#�BF�-1���04�37� $� �"�#�#� %��!%�#�#'�#�)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�l�7�#�$�.�%�.�4�n6>�R��R�(2�R�	"�R�h���������t@�l���������+� �"+�"�#�}L��}L��}L��	}L�
�}L�
�
}L��}L�B'+���>�>�	@�#�@��@��	@�

�@�D�)-��EN��	
��,�PS��
��L��6�	�
��
�
������"��6�	�
��
�
����PS�����L���	�
��
�
����
���"���	�
��
�
���$��V�X�$6�Y��
� ��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����"� �a1��
a1��a1�
�a1��a1�HDH�^U��^U�	�^U�@�#�!%�
/1�
�/1��
/1�
�/1��/1�b	�$�%6�7�(�)>�?�&�H��59� �-1�/3�!%�6:�!�26�*1�15�@D�S�+�S�2�	S�
�S�+�
S�-�S��S�4�S��S�0�S�(�S�/�S�>�S�
�S�	�S�j)�>$��V�U�O�-��	���� ��)�$�%6�7�,�	�837���15��
/�����	�
/��
��5��:�.��<?�"%� �+.�*-�
��
�:�
� �	
�
�
�)�
�(�
�
�
��
��=@�"%� �+.�*-�
�+�
�:�
� �	
�
�
�)�
�(�
�
�
��
�$��V�V�$4�<��	��&7�8�9�6:�<B�"*�!�+/�15�d
�2�d
�:�d
� �	d
�
�d
�)�
d
�/�d
�
�d
�:��d
�P6:�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$��V�U�O�)����=�?�4�	��� 4� 4�c�>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��SW�� &�$�!�&*�&*�37�!��'+�$(�$*�LP�*1�15�#G,�O�G,��G,��	G,�
�G,��
G,�$�G,�$�G,�1�G,��G,��G,�%�G,�"�G,�"�G,�J�G,� (�!G,�"/�#G,�$
�%G,�	��G,�T	��,�+�,� $�'+�#�*.�#'�

��
�%�
��	
�
(�
�!�

�
�
�-�
�&c�J-2�v=�p� �� �> �D(�0��*B�H8�6 *�D$#�L(F�T('�T�&3�P*,�X/� 0,�l�'+�	!�
%�	!��		!�
%�	!�
�
	!�EI�'�#�'�+A�'�	
�'�"'� -�6GL�+��+�-3�+�?C�+�	
�+�ZV�.
&�!��*
�8�"�<?���������25����38�\�|�;>��������27�g6�RNQ�j25���M8�
�M8��M8�%�	M8�
/�M8�
�
M8�^B�H(�T�W��W��$��,0��	��8�	��.� ��)�*�+<�=�)�=�"���g���&�&�'�
� �>��	>�
�>�
�
>�(��/�>>�	���� ��)�+�,>�?���
��� �'+� �"�$&�F�F� ��
��

�%�
��
��
�"�
��
�
�
��

�6�!����!��!�����	�
���
�������
�����!����!��"%�!�����	�
���
��� ����
�����!����!���!�����	�
���
�������
����%)�\
��#'�%)�"��%�\
�!�\
��	\
�
!�\
�#�
\
��\
��\
��\
�
�\
�|�"%��!$�"%����!�����	�
 ���
���������
�����"%��!$�"%���"%��!�����	�
 ���
��� ������
�����"%��!$�"%�����!�����	�
 ���
���������
���� "&�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
�b�
��"%�!$�	��		�
�	� �
	��	�
�	��	��
��!$�	��		�
�	��
	��	�
�	��	����!&�J��	J�
�J��
J��J�
�J�X� ���"%�!� �14�6:�����	�
 ���
���/��4��
����� ���!� �14�6:�����	�
���
���/��4��
����� ����!� �14�6:�����	�
���
���/��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�:��;����&)�&)� �"%� �
��
�$�	
�
$�
��
� �
��
�
�
��
���&)�&)� � �
��
�$�	
�
$�
��
��
��
�
�
��
��&)�n�n�&)�n�n�$(��"�^��^�$�	^�
$�^�"�
^��^��^�
�^�@�8;��� �
�4���	�
���
�
�����8;���"%� �
�4���	�
 ���
�
�����8;���� �
�4���	�
���
�
����8<�_�!��"�
_�4�_��	_�
�_��
_�
�_�F8<� �F>�4�F>��F>�
�	F>�V�
��"%��"%� ������	� �
��� ������
�����
���� ������	��
���������
����$�:>��$�!�"�#'�kC��kC��	kC�
8�kC��
kC��kC��kC��kC�!�kC�
�kC�Z���+.��"%�"� ��
��
��	
�
)�
��

��
� �
��
��
��
�
�
��
����+.�"%��"%�"� ��
��
��	
�
)�
� �

��
� �
��
��
��
�
�
��
����+.���"%�"� ��
��
��	
�
)�
��

��
� �
��
��
��
�
�
��
�$�#'�+/��$�"(�#�"�#'�k
��k
�!�	k
�
)�k
��
k
��k
� �k
��k
��k
�!�k
�
�k
�^%)�����
D�!�D��D��	D�
�D��
D�
�D�NJQ�wV��wV�)�wV�1F�wV�	�wV�tJQ�nW��nW�)�nW�1F�nW�	�nW�`	���� ��)��
*�
�
�2
5�4
�=�|�}=�|� 5�t0�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�4�Q���c����k�2�3�Q�4�Q���c����k�2�3�Q�4�Q���c����k�2�3�Q�4�Q���c����k�2�3�Q�4�Q���c����k�2�3�Q�4�Q���c����{�3�4�DH�
��
�	�
�5�
���c�����4�5�DH�
��
�	�
�6�
���c����{�3�4�DH�
��
�	�
�5�
��H�
��c�����4�5�DH�
��
�	�
�6�
���c����{�3�4�DH�
��
�	�
�5�
��H�
��c�����4�5�DH�
��
�	�
�6�
���c���	�;�7�8�DH�
��
�	�
�9�
��C�
�F�
��c���
�K�8�9�DH�
��
�	�
�:�
��D�
��c���
�K�8�9�DH�
��
�	�
�:�
���c����[�9�:�DH�
��
�	�
�;�
���c����{�3�4�DH�
��
�	�
�5�
���c�����4�5�DH�
��
�	�
�6�
���c����{�3�4�DH�
��
�	�
�5�
���c�����4�5�DH�
��
�	�
�6�
�	��Y���m
�o	
�`!��)�es�n� � �!2�

��
��
��	
�
�
��

�
�
�is�h
�(��qA��qA�<�qA�
�qA�
�
qA�fOC�h"���&�
p?��p?��	p?��
p?�
�p?�h��e
�g	
�i�T�l�9�%�(:�:�;��%(�^�^�#'����),����-
�#�-
�!�	-
�
�-
��
-
��-
�'�-
��-
�
�-
�<�Ui�V-
�bE	����R�"��
�l�7�#�$� #���s�~�~�H�	�H�%��H�S	����n�"��
�l�=�)�*����%����#�),����
�
�
��
��
��
�'�
��
�
�
�+��
�>�'*�~�~�%(�^�^�"�R9��R9�%�R9�#�	R9�
�R9�n#�~;��~;��~;�
�	~;�@C;�J�l�6�"�
�V�%L�L�M����&�"&�!�,�
�,� �
,��,�
�,�N�,�,	�����:���?
�A
�
H�R1�SH�R1�6-1�	�
����*�	�

��2�	�
���)	�+��Z	��[�!� ��)�
��
'�"�"������C���[�!� ��)�
��
'��/0����'+��	���
���GK�
�+3�-5�04�L=��L=��L=��	L=�
E�L=�)�L=�+�L=�.�L=�^=A�\;�"�\;�/9�\;�	�\;�~BF�4=�"�4=�/>�4=�	�4=�x#�!&��3:��3:��	3:�
�3:�
�
3:�p!%�����(,�g�@�g�
�g��	g�
�g��
g��g�&�g�
�g�R�"��
�j�!�$� �/3�48�59� �!��)� � %�)-�
�!�
��
�
-�	
�
2�
�3�

��
��
��
��
��
��
�'�
�
�
�%��
�D@A�z)�<�z)�	�z)�B%.��"�	p8�!�p8��p8��	p8�

�p8�h#'��"�	@7��@7��@7��	@7�

�@7�J��$-�"�
F�!�F��F��	F�
"�F��
F�
�F�VKU�d��"��J��J�
�J��
J��J�X�8	��%�a�	 �!�
���
��
��	
�
�
�
�
�"�
�	��%�a�	 �!����	������	�
�
�"��	��%�a�	 �!���"�	
��
��
��	
�"�
�	��%�a�	 �!���"�	
��
��
��	
�"�
�	��%�a�	 �!���"��	7��	7��	7��		7�
�	7�"�	7�	��&�q�	!�"���"��	8��	8��	8��		8�
�	8�#�	8�	��&�q�	!�"���"�	
��
��
��	
�#�
�	��(��	#�$���"�	
��
��
��	
�%�
�	��%�a�	 �!����"�������	�
��"��	��%�a�	 �!����"�������	�
��"��	��%�a�	 �!����"�������	�
��"��	��&�q�	!�"���"�	
��
��
��	
�#�
�	��&�q�	!�"���"�	
��
��
��	
�#�
��H��G���(��	#�$�C�%�C�	��(��	#�$�C�%�C�	��(��	#�$�C�%�C�	��)�Q�	� �D�!�D�&D�P	��h�	�g�>�HM�"@��"@�&*�"@�AE�"@�	�"@�?�"@�H	��h�	�g�>�HM�"@��"@�&*�"@�AE�"@�	�"@�?�"@�H	L�JN�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�fRV�C�$�C�37�C�CN�C�	�C�Jp8�h8?�	�6J�L�3�J�-�
�
&�
&�-���-��/��
�L�!�I�$%��z�%�*3�O�'�3�#�J�#�#�
�*
�-
�E�\&�j�%�%�
��
�
��G�*�&�&�/�/�">�">�?�D��?�?�%�%�D��o�o�+�+�G�
�H�&9�
:�F�


��I$��I$r�c��tjt�}|j�D]%\}}|j�D]
\}}||||<��'|Sr�)r�r4rr�)rrYr�r�r;r�s      r�r�r�{1sO��(3�(?�(?��(E�H��J�J�L���q��g�g�i�F�C��#$�H�S�M�%� � �!��Or�c��|jj|�st|�sNt�r(t	|t
�r|j|jfS|jj�dfS	|j|�j}|dfS#t$r)}|jjs|�td�|�d}~wwxYw)Nz6incompatible index of inserted column with frame index)
r�rrrr�r}rGrVr�r�r�r�r	)rcr��reindexed_valuer�s    r�r�r��1s���

�{�{���%� ��E�
�� �Z��v�%>��=�=�%�"3�"3�3�3��}�}�!�!�#�T�)�)�
��-�-��.�6�6���D� � �����{�{�$�$��I��D�
��	��
�s�6B�	C�$C�C)r%zcollections.defaultdict)rcrmr�rfr%rk(r��
__future__rr�r�collections.abcrrrrr	rY�inspectr
�iorr)r�r�textwrapr�typingr
rrrrrr��numpyrr�pandas._configrrr�pandas._config.configr�pandas._libsrr�rr�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.castr0r1r2r3r4r5r6r7r8�pandas.core.dtypes.commonr9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrI�pandas.core.dtypes.concatrJ�pandas.core.dtypes.dtypesrKrLrM�pandas.core.dtypes.missingrNrO�pandas.corerPrQrDrRrSrT�pandas.core.accessorrUrKrV�pandas.core.array_algos.takerW�pandas.core.arraylikerX�pandas.core.arraysrYrZr[r\r]�pandas.core.arrays.sparser^�pandas.core.constructionr_r`ra�pandas.core.genericrbrc�pandas.core.indexersrd�pandas.core.indexes.apirerfrgrhrirj�pandas.core.indexes.multirkrl�pandas.core.indexingrmrn�pandas.core.internalsrorp�"pandas.core.internals.constructionrqrrrsrtrurvrwrxryrz�pandas.core.methodsr{�pandas.core.reshape.meltr|�pandas.core.seriesr}�pandas.core.shared_docsr~�pandas.core.sortingrr�r��pandas.io.commonr��pandas.io.formatsr�r�rl�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�rr��*pandas.core.interchange.dataframe_protocolr�rCr�r�r�r�r�r�r�rkr�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�

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists