Re: write csv to object and read into pandas

2015-10-15 Thread Vincent Davis
That worked, Thanks! Vincent Davis 720-301-3003 On Thu, Oct 15, 2015 at 6:11 AM, Peter Otten <__pete...@web.de> wrote: > Oscar Benjamin wrote: > > > On 15 October 2015 at 09:16, Peter Otten <__pete...@web.de> wrote: > >> > >> def preprocess(filename): > >> with open(filename) as f: > >>

Re: write csv to object and read into pandas

2015-10-15 Thread Peter Otten
Oscar Benjamin wrote: > On 15 October 2015 at 09:16, Peter Otten <__pete...@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 wi

Re: write csv to object and read into pandas

2015-10-15 Thread Oscar Benjamin
On 15 October 2015 at 09:16, Peter Otten <__pete...@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

Re: write csv to object and read into pandas

2015-10-15 Thread Peter Otten
Vincent Davis wrote: > I have a csv file I have to make some changes to before I read it into > pandas. Currently I open the csv read each row, make changes and save it > to a new file. Then read it into pandas with pandas.read_csv(). How do I > skip writing the file to disk? Using python3.5. > >

write csv to object and read into pandas

2015-10-14 Thread Vincent Davis
I have a csv file I have to make some changes to before I read it into pandas. Currently I open the csv read each row, make changes and save it to a new file. Then read it into pandas with pandas.read_csv(). How do I skip writing the file to disk? Using python3.5. This is what I am doing now. wit