Linkx_lair
Linkx_lair

Reputation: 653

How to concatenate large dataset into dataframe pandas

So I am working with a fairly substantial CSV dataset that has couple hundred megabytes. I have managed to read in the data in chunks (~100 rows). How do i then elegantly convert those chunks into a dataframe and apply the describe function to it? Thank you

Upvotes: 2

Views: 981

Answers (1)

jezrael
jezrael

Reputation: 862661

It seems you need concat of TextFileReader object what is output of read_csv if parameter chunksize with describe:

df = pd.concat([x for x in pd.read_csv('filename', chunksize=1000)], ignore_index=True)
df = df.describe()
print (df)

Upvotes: 3

Related Questions