Panda data read_csv returns 'TextFileReader' object
Dave Angel
davea at davea.name
Fri Apr 24 18:51:45 EDT 2015
On 04/24/2015 04:04 PM, Kurt wrote:
> Isn't the call pd.read_csv(filepath,...) suppose to return a dataframe, not this other object? I keep getting the following error when I try to view the attribute head.
>
> AttributeError: 'TextFileReader' object has no attribute 'head'
>
> I reference pandas as pd and df is suppose to define itself. I had this working at one time.
>
Please supply the Python version, the pandas version, and the code you
ran. It can also be useful to show how/where you installed pandas, like
the URL you used, or the apt-get, or the pip command, or whatever.
Then show the complete error traceback, not just a summary. And if the
error really is on the line you partially supplied above, what's the
type and contents of filepath? What are the other arguments' values?
The function I suspect you're trying to call is:
pandas.io.parsers.read_csv(filepath, ...)
but I can't tell from your description.
--
DaveA
More information about the Python-list
mailing list