pandas.errors.IndexingError #

异常 pandas.errors。索引错误[来源] #

尝试索引且维度不匹配时会引发异常。

例子

>>> 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