关注documentation我正在尝试采用pandas数据帧列的模式,但收到错误:AttributeError: 'DataFrame' object has no attribute 'mode'
。这是一个可重复的例子:
import pandas as pd
df = pd.DataFrame({"A": ["A", "A", "B", "A", "B"], "B": [20, 30, 10, 40, 50], "C": [32, 234, 23, 23, 42523]})
df.mode()
这是追溯:
df.mode()
File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 2088, in __getattr__
(type(self).__name__, name))
AttributeError: 'DataFrame' object has no attribute 'mode'
如何使用列模式?