pandas.errors.IndexingError — pandas 2.2.3 documentation (original) (raw)
exception pandas.errors.IndexingError[source]#
Exception is raised when trying to index and there is a mismatch in dimensions.
Examples
df = pd.DataFrame({'A': [1, 1, 1]}) df.loc[..., ..., 'A'] ... # IndexingError: indexer may only contain one '...' entry df = pd.DataFrame({'A': [1, 1, 1]}) df.loc[1, ..., ...] ... # IndexingError: Too many indexers df[pd.Series([True], dtype=bool)] ... # IndexingError: Unalignable boolean Series provided as indexer... s = pd.Series(range(2), ... index = pd.MultiIndex.from_product([["a", "b"], ["c"]])) s.loc["a", "c", "d"] ... # IndexingError: Too many indexers