首页 > 解决方案 > 如何解决 Pandas 的属性错误:“AttributeError: module 'pandas' has no attribute 'StringDtype'”?

问题描述

pd.Series(["a","b","c"], dtype=pd.StringDtype())

AttributeError:模块“pandas”没有属性“StringDtype”

标签: pythonpandaserror-handlingjupyterattributeerror

解决方案


您需要升级 pandas,因为pandas.StringDtype在 pandas 1.0.0+ 中实现:

类 pandas.StringDtype
字符串数据的扩展 dtype。

1.0.0 版中的新功能。


推荐阅读