Skip to content Skip to sidebar Skip to footer

Python, Memory Error In Making Dataframe

When I use pandas DataFrame, occuring the Memory Error. data's row is 200000 and column is 30.(type: list) fieldnames1 has columns name.(type:list) Error occured in: df = pd.Data

Solution 1:

As indicated by Klaus, you're running out of memory. The problem occurs when you try to pull the entire text to memory in one go.

As pointed out in this post by Wes McKinney, "a solution is to read the file in smaller pieces (use iterator=True, chunksize=1000) then concatenate then with pd.concat".

Solution 2:

You can try this line of code:

data=pd.DataFrame.from_csv("train.csv")

This is an alternate of read.csv but it returns Data frame object without giving any memory error P.S the size of the training data is around 73 mb

Post a Comment for "Python, Memory Error In Making Dataframe"