Sindbad~EG File Manager
�
Mٜg�{ � � � d dl mZ d dlmZ d dlZd dlmZmZmZm Z m
Z
d dlZd dlZ
d dlmZmZ d dlmZ d dlmZ d dlmZ d d lmZmZmZmZmZmZmZmZ d d
l m!Z! d dl"m#Z# d dl$m%Z%m&Z& d d
l'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1 d dl2m3Z3 d dl4m5Z5 d dl6m7Z7m8Z8 d dl9m:Z:m;Z;m<Z<m=Z=m>Z> d dl?m@ZA d dlBmCc mDZE d dlFmGZHmIZI d dlJmKZKmLZLmMZMmNZN d dlOmPZPmQZQ erd dlRmSZSmTZT d dlUmVZVmWZWmXZXmYZY d dlZm[Z[m\Z\ ed� Z] e^dd� Z_dZ` G d� d� Za ea� Zb G d� d� Zc G d� d e� Zd e!ecj� � G d!� d"ed� � Zf e!ecj� � G d#� d$ed� � Zh G d%� d&e� Zi e!ecj� � G d'� d(ei� � Zk e!ecj� � G d)� d*ei� � Zmd5d+�Znd6d,�Zod7d-�Zpd.� Zqd/� Zrd0� Zsd8d1�Ztd8d2�Zud9d3�Zvd:d4�Zwy);� )�annotations)�suppressN)�
TYPE_CHECKING�Any�TypeVar�cast�final)�using_copy_on_write�warn_copy_on_write)�NDFrameIndexerBase)�item_from_zerodim)�PYPY)�AbstractMethodError�ChainedAssignmentError�
IndexingError�InvalidIndexError�LossySetitemError�_chained_assignment_msg�_chained_assignment_warning_msg�
_check_cacher)�doc)�find_stack_level)�can_hold_element�
maybe_promote)
�
is_array_like�
is_bool_dtype�is_hashable�
is_integer�is_iterator�is_list_like�is_numeric_dtype�is_object_dtype� is_scalar�is_sequence)�
concat_compat)�ExtensionDtype)�ABCDataFrame� ABCSeries)�+construct_1d_array_from_inferred_fill_value�infer_fill_value�is_valid_na_for_dtype�isna�na_value_for_dtype)�
algorithms)�array�
extract_array)�check_array_indexer�is_list_like_indexer�is_scalar_indexer�length_of_indexer)�Index�
MultiIndex)�Hashable�Sequence)�Axis�AxisInt�Self�npt)� DataFrame�Series�Tz(indexer may only contain one '...' entryc � � e Zd ZdZd� Zy)�_IndexSlicea
Create an object to more easily perform multi-index slicing.
See Also
--------
MultiIndex.remove_unused_levels : New MultiIndex with no unused levels.
Notes
-----
See :ref:`Defined Levels <advanced.shown_levels>`
for further info on slicing a MultiIndex.
Examples
--------
>>> midx = pd.MultiIndex.from_product([['A0','A1'], ['B0','B1','B2','B3']])
>>> columns = ['foo', 'bar']
>>> dfmi = pd.DataFrame(np.arange(16).reshape((len(midx), len(columns))),
... index=midx, columns=columns)
Using the default slice command:
>>> dfmi.loc[(slice(None), slice('B0', 'B1')), :]
foo bar
A0 B0 0 1
B1 2 3
A1 B0 8 9
B1 10 11
Using the IndexSlice class for a more intuitive command:
>>> idx = pd.IndexSlice
>>> dfmi.loc[idx[:, 'B0':'B1'], :]
foo bar
A0 B0 0 1
B1 2 3
A1 B0 8 9
B1 10 11
c � � |S �N� )�self�args �?/usr/local/lib/python3.12/site-packages/pandas/core/indexing.py�__getitem__z_IndexSlice.__getitem__� s � ��
� N)�__name__�
__module__�__qualname__�__doc__rH rD rI rG rA rA m s
� �%�NrI rA c �X � e Zd ZdZedd�� Zedd�� Zed d�� Zed
d�� Zy)�
IndexingMixinzH
Mixin for adding .loc/.iloc/.at/.iat to Dataframes and Series.
c � � t d| � S )a>
Purely integer-location based indexing for selection by position.
.. deprecated:: 2.2.0
Returning a tuple from a callable is deprecated.
``.iloc[]`` is primarily integer position based (from ``0`` to
``length-1`` of the axis), but may also be used with a boolean
array.
Allowed inputs are:
- An integer, e.g. ``5``.
- A list or array of integers, e.g. ``[4, 3, 0]``.
- A slice object with ints, e.g. ``1:7``.
- A boolean array.
- A ``callable`` function with one argument (the calling Series or
DataFrame) and that returns valid output for indexing (one of the above).
This is useful in method chains, when you don't have a reference to the
calling object, but would like to base your selection on
some value.
- A tuple of row and column indexes. The tuple elements consist of one of the
above inputs, e.g. ``(0, 1)``.
``.iloc`` will raise ``IndexError`` if a requested indexer is
out-of-bounds, except *slice* indexers which allow out-of-bounds
indexing (this conforms with python/numpy *slice* semantics).
See more at :ref:`Selection by Position <indexing.integer>`.
See Also
--------
DataFrame.iat : Fast integer location scalar accessor.
DataFrame.loc : Purely label-location based indexer for selection by label.
Series.iloc : Purely integer-location based indexing for
selection by position.
Examples
--------
>>> mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
... {'a': 100, 'b': 200, 'c': 300, 'd': 400},
... {'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000}]
>>> df = pd.DataFrame(mydict)
>>> df
a b c d
0 1 2 3 4
1 100 200 300 400
2 1000 2000 3000 4000
**Indexing just the rows**
With a scalar integer.
>>> type(df.iloc[0])
<class 'pandas.core.series.Series'>
>>> df.iloc[0]
a 1
b 2
c 3
d 4
Name: 0, dtype: int64
With a list of integers.
>>> df.iloc[[0]]
a b c d
0 1 2 3 4
>>> type(df.iloc[[0]])
<class 'pandas.core.frame.DataFrame'>
>>> df.iloc[[0, 1]]
a b c d
0 1 2 3 4
1 100 200 300 400
With a `slice` object.
>>> df.iloc[:3]
a b c d
0 1 2 3 4
1 100 200 300 400
2 1000 2000 3000 4000
With a boolean mask the same length as the index.
>>> df.iloc[[True, False, True]]
a b c d
0 1 2 3 4
2 1000 2000 3000 4000
With a callable, useful in method chains. The `x` passed
to the ``lambda`` is the DataFrame being sliced. This selects
the rows whose index label even.
>>> df.iloc[lambda x: x.index % 2 == 0]
a b c d
0 1 2 3 4
2 1000 2000 3000 4000
**Indexing both axes**
You can mix the indexer types for the index and columns. Use ``:`` to
select the entire axis.
With scalar integers.
>>> df.iloc[0, 1]
2
With lists of integers.
>>> df.iloc[[0, 2], [1, 3]]
b d
0 2 4
2 2000 4000
With `slice` objects.
>>> df.iloc[1:3, 0:3]
a b c
1 100 200 300
2 1000 2000 3000
With a boolean array whose length matches the columns.
>>> df.iloc[:, [True, False, True, False]]
a c
0 1 3
1 100 300
2 1000 3000
With a callable function that expects the Series or DataFrame.
>>> df.iloc[:, lambda df: [0, 2]]
a c
0 1 3
1 100 300
2 1000 3000
�iloc)�_iLocIndexer�rE s rG rQ zIndexingMixin.iloc� s � �\ �F�D�)�)rI c � � t d| � S )a�'