Skip to content Skip to sidebar Skip to footer

Pandas Get_group Causes Memory Error

I have a grouped dataframe created like so: my_gb = pandas.read_csv(filepath_or_buffer=my_file_path, delimiter='\t').groupby(['col1', 'col2', 'col3', 'col4'

Solution 1:

Couldn't get this to work so I did the grouping myself:

data = pandas.read_csv(filepath_or_buffer=my_file_path, delimiter='\t')
grouped = {}
for key, value in data.iterrows():
    grouped[(value['col1'], value['col2'], value['col3'], value['col4'])] = value

Post a Comment for "Pandas Get_group Causes Memory Error"