MCPcopy
hub / github.com/pandas-dev/pandas / InvalidIndexError

Class InvalidIndexError

pandas/errors/__init__.py:586–612  ·  view source on GitHub ↗

Exception raised when attempting to use an invalid index key. This exception is triggered when a user attempts to access or manipulate data in a pandas DataFrame or Series using an index key that is not valid for the given object. This may occur in cases such as using a malformed

Source from the content-addressed store, hash-verified

584
585
586class InvalidIndexError(Exception):
587 """
588 Exception raised when attempting to use an invalid index key.
589
590 This exception is triggered when a user attempts to access or manipulate
591 data in a pandas DataFrame or Series using an index key that is not valid
592 for the given object. This may occur in cases such as using a malformed
593 slice, a mismatched key for a ``MultiIndex``, or attempting to access an index
594 element that does not exist.
595
596 See Also
597 --------
598 MultiIndex : A multi-level, or hierarchical, index object for pandas objects.
599
600 Examples
601 --------
602 >>> idx = pd.MultiIndex.from_product([["x", "y"], [0, 1]])
603 >>> df = pd.DataFrame([[1, 1, 2, 2], [3, 3, 4, 4]], columns=idx)
604 >>> df
605 x y
606 0 1 0 1
607 0 1 1 2 2
608 1 3 3 4 4
609 >>> df[:, 0]
610 Traceback (most recent call last):
611 InvalidIndexError: (slice(None, None, None), 0)
612 """
613
614
615class DataError(Exception):

Callers 5

_set_valueMethod · 0.90
_check_indexing_errorMethod · 0.90
get_locMethod · 0.90
get_indexerMethod · 0.90
_check_indexing_errorMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected