importing pandas.io.data

1,561 views
Skip to first unread message

TD

unread,
Nov 24, 2012, 2:55:20 PM11/24/12
to PyData
I am on the 0.9.2 development version I've checked out from github. I
am not able to import pandas.io.data. When I looked inside the
__init__ files, I found that the pandas.io.data module was not being
brought in. so I tried doing that and I am getting a nasty error I
pasted below.

I want to use the yahoo interface to download data and I thought this
worked with earlier releases. Does anyone know what is causing the
problem and how to fix it?

Thanks



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

c:\Users\EMILY\Downloads\Python\pandas\pandas\__init__.py in
<module>()
32 ExcelWriter)
33 from pandas.io.pytables import HDFStore
---> 34 from pandas.io.data import DataSource, Options
35 from pandas.util.testing import debug
36

c:\Users\EMILY\Downloads\Python\pandas\pandas\io\data.py in <module>()
14 from pandas.util.py3compat import StringIO, BytesIO,
bytes_to_str
15
---> 16 from pandas import DataFrame, read_csv, concat
17 from pandas.io.parsers import TextParser
18

ImportError: cannot import name concat

Skipper Seabold

unread,
Nov 24, 2012, 3:01:44 PM11/24/12
to pyd...@googlegroups.com
How did you install pandas? Are you sure this is the development version and not some old files? AFAIK those imports from io.data in __init__ are not in current master.

Skipper 

TD

unread,
Nov 24, 2012, 3:10:02 PM11/24/12
to PyData
Pretty sure.. I've followed the instructions here:
http://pandas.pydata.org/pandas-docs/stable/install.html#installing-from-source

I'v checked out from github, and built_ext then installed using python
setup.py install.

Here's the version string:

pd.__version__
Out[2]: '0.9.2.dev-f64ccf0'

Before checking out the code I obtained binaries for 0.9.1 from
Gohlke's web site but that didn't let me import pd.io.data either..
Are you saying you have the exact same configuration and it works for
you? Mine is a clean install so I cannot see what can go wrong.





On Nov 24, 3:02 pm, Skipper Seabold <jsseab...@gmail.com> wrote:

Skipper Seabold

unread,
Nov 24, 2012, 3:20:36 PM11/24/12
to pyd...@googlegroups.com
On Sat, Nov 24, 2012 at 3:10 PM, TD <tansu...@gmail.com> wrote:
Pretty sure.. I've followed the instructions here:
http://pandas.pydata.org/pandas-docs/stable/install.html#installing-from-source

I'v checked out from github, and built_ext then installed using python
setup.py install.

Here's the version string:

pd.__version__
Out[2]: '0.9.2.dev-f64ccf0'

Not sure how you imported this if you can't import pandas?
 

Before checking out the code I obtained binaries for 0.9.1 from
Gohlke's web site but that didn't let me import pd.io.data either..
Are you saying you have the exact same configuration and it works for
you? Mine is a clean install so I cannot see what can go wrong.


I do not have the exact same configuration, but I don't see that import in the pandas/__init__.py that's in your traceback in either master or v0.9.1. 


That's also not a standard file path in your traceback for a Python installation on Windows, but I'm not really sure what's going on there. Maybe you're trying to import from the source tree, but that still doesn't explain the traceback I don't think. Are you sure the build finished properly?

Skipper

--



TD

unread,
Nov 24, 2012, 3:29:38 PM11/24/12
to PyData
Skipper, first thanks for your help and prompt replies.

I should have been more clear. The import works fine if I don't change
anything in the __init__ file, and I have the same init file as the
ones you link to. Btw, I checked the build output and it was
successful. My main problem is that I cannot access the pd.io.data
module to download time series from yahoo. I therefore added the line
"from pandas.io.data import DataSource, Options" to the main __init__
file hoping that would solve the problem.

Back to my main problem, how do you get python to import DataReader,
for which the code exists but somehow is not being imported. And what
is the reason for this?

Thanks!



On Nov 24, 3:20 pm, Skipper Seabold <jsseab...@gmail.com> wrote:
> On Sat, Nov 24, 2012 at 3:10 PM, TD <tansude...@gmail.com> wrote:
> > Pretty sure.. I've followed the instructions here:
>
> >http://pandas.pydata.org/pandas-docs/stable/install.html#installing-f...
>
> > I'v checked out from github, and built_ext then installed using python
> > setup.py install.
>
> > Here's the version string:
>
> > pd.__version__
> > Out[2]: '0.9.2.dev-f64ccf0'
>
> Not sure how you imported this if you can't import pandas?
>
>
>
> > Before checking out the code I obtained binaries for 0.9.1 from
> > Gohlke's web site but that didn't let me import pd.io.data either..
> > Are you saying you have the exact same configuration and it works for
> > you? Mine is a clean install so I cannot see what can go wrong.
>
> I do not have the exact same configuration, but I don't see that import in
> the pandas/__init__.py that's in your traceback in either master or v0.9.1.
>
> https://github.com/pydata/pandas/blob/master/pandas/__init__.py#L33https://github.com/pydata/pandas/blob/v0.9.1/pandas/__init__.py

Skipper Seabold

unread,
Nov 24, 2012, 3:34:38 PM11/24/12
to pyd...@googlegroups.com
On Sat, Nov 24, 2012 at 3:29 PM, TD <tansu...@gmail.com> wrote:
Skipper, first thanks for your help and prompt replies.
 
I should have been more clear. The import works fine if I don't change
anything in the __init__ file, and I have the same init file as the
ones you link to. Btw, I checked the build output and it was
successful. My main problem is that I cannot access the pd.io.data
module to download time series from yahoo. I therefore added the line
"from pandas.io.data import DataSource, Options" to the main __init__
file hoping that would solve the problem.

Back to my main problem, how do you get python to import DataReader,
for which the code exists but somehow is not being imported. And what
is the reason for this?


Ah, you edited __init__.py. Don't do that. I think you're creating a circular import. DataReader is not imported into the pandas namespace as you see. You'll need to do

from pandas.io.data import DataReader

Also, DataReader is (going to be) deprecated, so you might want to just import get_data_yahoo and get used to using it, though the docstring of the function is non-existent vs. DataReader.

from pandas.io.data import get_data_yahoo

Skipper
 
--



TD

unread,
Nov 25, 2012, 8:52:21 AM11/25/12
to PyData
Ah I see, it was my mistake should have done the import properly.
Thank you very much

On Nov 24, 3:34 pm, Skipper Seabold <jsseab...@gmail.com> wrote:
> >https://github.com/pydata/pandas/blob/master/pandas/__init__.py#L33ht...
Reply all
Reply to author
Forward
0 new messages