MemoryError when I merge two Pandas data frames

后端 未结 3 2101
半阙折子戏
半阙折子戏 2020-12-01 10:42

I searched almost all over the internet and somehow none of the approaches seem to work in my case.

I have two large csv files (each with a million+ rows and about

3条回答
  •  忘掉有多难
    2020-12-01 11:00

    The reason you might be getting MemoryError: Unable to allocate.. could be due to duplicates or blanks in your dataframe. Check the column you are joining on (when using merge) and see if you have duplicates or blanks. If so get rid of them using this command:

    df.drop_duplicates(subset ='column_name', keep = False, inplace = True) 
    

    Then re-run your python/pandas code. This worked for me.

提交回复
热议问题