write csv to object and read into pandas

Peter Otten __peter__ at web.de
Thu Oct 15 08:11:37 EDT 2015


Oscar Benjamin wrote:

> On 15 October 2015 at 09:16, Peter Otten <__peter__ at web.de> wrote:
>>
>> def preprocess(filename):
>>     with open(filename) as f:
>>         for row in csv.reader(f):
>>             # do stuff
>>             yield row
>>
>> rows = preprocess("pandas.csv")
> 
> Take the with statement outside of the generator and do something like:

When will I ever learn :(




More information about the Python-list mailing list