2

I am trying to reproduce the example described in the Python Pint library here.

In the section "Reading from csv" when running the following line:

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

I got the following message error:

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

Has anybody a solution to that?

Thanks in advance!

Best regards.

saeed foroughi
  • 1,662
  • 1
  • 13
  • 25
Mathador
  • 144
  • 1
  • 1
  • 11
  • did you `import pint` ? – Ivan Jan 27 '20 at 14:17
  • I was reading, it seems like pint-pandas comes in a different github branch than "normal" pint – Ivan Jan 27 '20 at 14:29
  • yes I imported pint. I exactly reproduced the example described there. I guess there is something missing. Something more to import? But I could not find what... – Mathador Jan 27 '20 at 15:02

1 Answers1

1

As @Ivan noted in the comments, you need to install pint-pandas package:

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

Pandas has an open issue regarding this.

sanzoghenzo
  • 598
  • 5
  • 21
  • Thank you, it works like this! To be complete, one also needs to [install git](https://stackoverflow.com/questions/29565779/cannot-find-command-git-windows) before running the pip install command. – Mathador Jan 28 '20 at 13:27