【问题标题】:How can I solve attribute error for Pandas : "AttributeError: module 'pandas' has no attribute 'StringDtype'"?如何解决 Pandas 的属性错误:“AttributeError: module 'pandas' has no attribute 'StringDtype'”?
【发布时间】:2021-02-01 18:52:04
【问题描述】:

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

AttributeError: 模块 'pandas' 没有属性 'StringDtype'

【问题讨论】:

    标签: python pandas error-handling jupyter attributeerror


    【解决方案1】:

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

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

    1.0.0 版中的新功能。

    【讨论】:

    • 啊,我以为 OP 使用的是 Pyspark dtypes 而不是 Pandas(有轻微错字)不知道这个新的 dtype 不错。
    猜你喜欢
    • 2022-11-07
    • 2023-02-17
    • 2016-07-31
    • 2022-06-12
    • 1970-01-01
    • 2022-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多