Reputation: 12361
I installed pandas on osx 10.9.1 from mac ports via sudo port install py27-pandas
.
On trying to run a simple example
from pandas.io.data import DataReader
from datetime import datetime
goog = DataReader("GOOG", "yahoo", datetime(2000,1,1), datetime(2012,1,1))
print goog["Adj Close"]
When invoking python in a new terminal window, I get the following error
$ python2.7 pandas.py
Traceback (most recent call last):
File "pandas.py", line 1, in <module>
from pandas.io.data import DataReader
File "/Users/adm/Documents/Factor/research/pandas.py", line 1, in <module>
from pandas.io.data import DataReader
ImportError: No module named io.data
Also other pandas
modules aren't being imported properly
from pandas.stats.moments import rolling_std
ImportError: No module named stats.moments
I'm not sure what I'm missing or if this is a bug in macports
or pandas
or osx
.
Upvotes: 2
Views: 2476
Reputation: 40993
You have a file named pandas.py
in your current directory. Python is importing that one. Please rename it, so that the correct pandas
module can be loaded.
By the way if you have problems installing pandas on Mac I recommend you use the Anaconda distribution instead of Macports.
Upvotes: 4