Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dateutil.tz package apparently missing when using Pandas?

Tags:

python

pandas

My python 2.7 code is as follows:

import pandas as pd
from pandas import DataFrame

DF_rando = DataFrame([1,2,3])

...and then when I execute, I get a strange error regarding dateutil.tz.

/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/mattobrien/pandas_test.py
No module named dateutil.tz
Traceback (most recent call last):
  File "/Users/mattobrien/pandas_test.py", line 2, in <module>
    import pandas as pd
  File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 7, in <module>
    from . import hashtable, tslib, lib
  File "pandas/tslib.pyx", line 37, in init pandas.tslib (pandas/tslib.c:76999)
ImportError: No module named dateutil.tz

Process finished with exit code 1

Very strange. I checked an indeed dateutil.tz is indeed installed. I uninstalled Pandas and reinstalled it to be sure. No issues there.

Why am I getting this error?

like image 345
tumultous_rooster Avatar asked Nov 13 '14 23:11

tumultous_rooster


People also ask

Is dateutil included in Python 3?

Python 2. x has an extraordinary function called dateutil. parser which transforms an ISO8601 arranged date into a python DateTime value. It's absent in Python 3.

How do you fix ModuleNotFoundError No module named dateutil?

The Python "ModuleNotFoundError: No module named 'dateutil'" occurs when we forget to install the python-dateutil module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install python-dateutil command.


1 Answers

Needed these 2 lines.

sudo pip install python-dateutil --upgrade

sudo pip install pytz --upgrade

like image 167
tumultous_rooster Avatar answered Sep 21 '22 20:09

tumultous_rooster