2
import pandas as pd 

I am getting the following error while importing pandas. Could anyone please help me i am relatively new to python. I am using raspberry for this and the os installed is raspbian os.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/usr/local/lib/python3.5/dist-packages/pandas/__init__.py in <module>()
     25 try:
---> 26     from pandas._libs import (hashtable as _hashtable,
     27                              lib as _lib,

/usr/local/lib/python3.5/dist-packages/pandas/_libs/__init__.py in <module>()
      3 
----> 4 from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
      5 

ImportError: cannot import name 'iNaT'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-3-7dd3504c366f> in <module>()
----> 1 import pandas as pd

/usr/local/lib/python3.5/dist-packages/pandas/__init__.py in <module>()
     33                       "pandas from the source directory, you may need to run "
     34                       "'python setup.py build_ext --inplace --force' to build "
---> 35                       "the C extensions first.".format(module))
     36 
     37 from datetime import datetime

ImportError: C extension: 'iNaT' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
khaldi
  • 472
  • 7
  • 15
tg7
  • 21
  • 4
  • How did you install pandas? From what directory are you running your script/Python prompt? – 9769953 Jul 19 '18 at 08:48
  • have you installed pandas? if not than try this command first in your pi, `~ $ pip install pandas` – khaldi Jul 19 '18 at 08:52
  • i used sudo pip install pandas to install pandas and the directory is /home/pi – tg7 Jul 19 '18 at 08:58
  • Repeated question, please check answer [here](https://stackoverflow.com/questions/14422976/importing-pandas-shows-importerror-cannot-import-name-hashtable) – jits_on_moon Jul 19 '18 at 09:02
  • Possible duplicate of [How to solve import error for pandas?](https://stackoverflow.com/questions/30761152/how-to-solve-import-error-for-pandas) – Nishant Patel Jul 19 '18 at 09:19

1 Answers1

0

Install it this way:

sudo apt install python3-pandas