Python:Pandas 支持 Pint

Python: Pandas support in Pint

我正在尝试重现 Python Pint 库 here 中描述的示例。

在 "Reading from csv" 部分中,当 运行 以下行时:

df_ = df.pint.quantify(level=-1)

我收到以下消息错误:

AttributeError: 'DataFrame' object has no attribute 'pint'

有人解决这个问题吗?

提前致谢!

此致。

正如@Ivan 在评论中指出的那样,您需要安装 pint-pandas 软件包:

pip install git+https://github.com/hgrecco/pint-pandas.git

Pandas has an open issue关于这个