Panda data read_csv returns 'TextFileReader' object

Kurt kplunt at gmail.com
Wed Apr 29 15:49:23 EDT 2015


Python has a return object dependency on its input parameter call. I overlooked the fact specifying a "chunksize" parameter in the read_csv function returns a TextFileReader object, which is used for iteration purposes. I might need to work with that, as well as a ref manual such as Python for Data Analysis.

Kurt



On Friday, April 24, 2015 at 6:53:05 PM UTC-4, Dave Angel wrote:
> 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