CLN: leftover ix checks (#30951) · pandas-dev/pandas@46c2864 (original) (raw)

`@@ -2829,24 +2829,24 @@ def _filter_indexer_tolerance(self, target, indexer, tolerance):

`

2829

2829

` Parameters

`

2830

2830

` ----------

`

2831

2831

` key : label of the slice bound

`

2832

``

`-

kind : {'ix', 'loc', 'getitem', 'iloc'} or None

`

``

2832

`+

kind : {'loc', 'getitem', 'iloc'} or None

`

2833

2833

` """

`

2834

2834

``

2835

2835

`@Appender(_index_shared_docs["_convert_scalar_indexer"])

`

2836

2836

`def _convert_scalar_indexer(self, key, kind=None):

`

2837

``

`-

assert kind in ["ix", "loc", "getitem", "iloc", None]

`

``

2837

`+

assert kind in ["loc", "getitem", "iloc", None]

`

2838

2838

``

2839

2839

`if kind == "iloc":

`

2840

2840

`return self._validate_indexer("positional", key, kind)

`

2841

2841

``

2842

2842

`if len(self) and not isinstance(self, ABCMultiIndex):

`

2843

2843

``

2844

2844

`# we can raise here if we are definitive that this

`

2845

``

`-

is positional indexing (eg. .ix on with a float)

`

``

2845

`+

is positional indexing (eg. .loc on with a float)

`

2846

2846

`# or label indexing if we are using a type able

`

2847

2847

`# to be represented in the index

`

2848

2848

``

2849

``

`-

if kind in ["getitem", "ix"] and is_float(key):

`

``

2849

`+

if kind in ["getitem"] and is_float(key):

`

2850

2850

`if not self.is_floating():

`

2851

2851

`return self._invalid_indexer("label", key)

`

2852

2852

``

`@@ -2882,12 +2882,12 @@ def _convert_scalar_indexer(self, key, kind=None):

`

2882

2882

` Parameters

`

2883

2883

` ----------

`

2884

2884

` key : label of the slice bound

`

2885

``

`-

kind : {'ix', 'loc', 'getitem', 'iloc'} or None

`

``

2885

`+

kind : {'loc', 'getitem', 'iloc'} or None

`

2886

2886

` """

`

2887

2887

``

2888

2888

`@Appender(_index_shared_docs["_convert_slice_indexer"])

`

2889

2889

`def _convert_slice_indexer(self, key: slice, kind=None):

`

2890

``

`-

assert kind in ["ix", "loc", "getitem", "iloc", None]

`

``

2890

`+

assert kind in ["loc", "getitem", "iloc", None]

`

2891

2891

``

2892

2892

`# validate iloc

`

2893

2893

`if kind == "iloc":

`

`@@ -3026,7 +3026,7 @@ def _convert_index_indexer(self, keyarr):

`

3026

3026

`@Appender(_index_shared_docs["_convert_list_indexer"])

`

3027

3027

`def _convert_list_indexer(self, keyarr, kind=None):

`

3028

3028

`if (

`

3029

``

`-

kind in [None, "iloc", "ix"]

`

``

3029

`+

kind in [None, "iloc"]

`

3030

3030

`and is_integer_dtype(keyarr)

`

3031

3031

`and not self.is_floating()

`

3032

3032

`and not isinstance(keyarr, ABCPeriodIndex)

`

`@@ -4704,7 +4704,7 @@ def _validate_indexer(self, form, key, kind):

`

4704

4704

` If we are positional indexer, validate that we have appropriate

`

4705

4705

` typed bounds must be an integer.

`

4706

4706

` """

`

4707

``

`-

assert kind in ["ix", "loc", "getitem", "iloc"]

`

``

4707

`+

assert kind in ["loc", "getitem", "iloc"]

`

4708

4708

``

4709

4709

`if key is None:

`

4710

4710

`pass

`

`@@ -4725,7 +4725,7 @@ def _validate_indexer(self, form, key, kind):

`

4725

4725

` ----------

`

4726

4726

` label : object

`

4727

4727

` side : {'left', 'right'}

`

4728

``

`-

kind : {'ix', 'loc', 'getitem'}

`

``

4728

`+

kind : {'loc', 'getitem'} or None

`

4729

4729

``

4730

4730

` Returns

`

4731

4731

` -------

`

`@@ -4738,15 +4738,14 @@ def _validate_indexer(self, form, key, kind):

`

4738

4738

``

4739

4739

`@Appender(_index_shared_docs["_maybe_cast_slice_bound"])

`

4740

4740

`def _maybe_cast_slice_bound(self, label, side, kind):

`

4741

``

`-

assert kind in ["ix", "loc", "getitem", None]

`

``

4741

`+

assert kind in ["loc", "getitem", None]

`

4742

4742

``

4743

4743

`# We are a plain index here (sub-class override this method if they

`

4744

4744

`# wish to have special treatment for floats/ints, e.g. Float64Index and

`

4745

4745

`# datetimelike Indexes

`

4746

4746

`# reject them

`

4747

4747

`if is_float(label):

`

4748

``

`-

if not (kind in ["ix"] and (self.holds_integer() or self.is_floating())):

`

4749

``

`-

self._invalid_indexer("slice", label)

`

``

4748

`+

self._invalid_indexer("slice", label)

`

4750

4749

``

4751

4750

`# we are trying to find integer bounds on a non-integer based index

`

4752

4751

`# this is rejected (generally .loc gets you here)

`

`@@ -4780,14 +4779,14 @@ def get_slice_bound(self, label, side, kind):

`

4780

4779

` ----------

`

4781

4780

` label : object

`

4782

4781

` side : {'left', 'right'}

`

4783

``

`-

kind : {'ix', 'loc', 'getitem'}

`

``

4782

`+

kind : {'loc', 'getitem'} or None

`

4784

4783

``

4785

4784

` Returns

`

4786

4785

` -------

`

4787

4786

` int

`

4788

4787

` Index of label.

`

4789

4788

` """

`

4790

``

`-

assert kind in ["ix", "loc", "getitem", None]

`

``

4789

`+

assert kind in ["loc", "getitem", None]

`

4791

4790

``

4792

4791

`if side not in ("left", "right"):

`

4793

4792

`raise ValueError(

`

`@@ -4847,7 +4846,7 @@ def slice_locs(self, start=None, end=None, step=None, kind=None):

`

4847

4846

` If None, defaults to the end.

`

4848

4847

` step : int, defaults None

`

4849

4848

` If None, defaults to 1.

`

4850

``

`-

kind : {'ix', 'loc', 'getitem'} or None

`

``

4849

`+

kind : {'loc', 'getitem'} or None

`

4851

4850

``

4852

4851

` Returns

`

4853

4852

` -------

`