当我尝试在数据框中显示列的dtype(句点)时,出现以下错误。 我想将数据类型分配为对象。
KeyError:'句号'
在处理上述异常期间,发生了另一个异常:
KeyError Traceback (most recent call last)
<ipython-input-234-e1689ba33c98> in <module>
----> 1 df['Period'].dtype
~\Anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
2925 if self.columns.nlevels > 1:
2926 return self._getitem_multilevel(key)
-> 2927 indexer = self.columns.get_loc(key)
2928 if is_integer(indexer):
2929 indexer = [indexer]
~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2657 return self._engine.get_loc(key)
2658 except KeyError:
-> 2659 return self._engine.get_loc(self._maybe_cast_indexer(key))
2660 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2661 if indexer.ndim > 1 or indexer.size > 1: