pandas.errors.IndexingError#
- exception pandas.errors.IndexingError[源代码]#
尝试索引且维度不匹配时引发的异常。
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