How to reduce the size of a Dataframe in Python - Weddo

v32457_p

Member
Oct 25, 2021
151
0
16
How to reduce the size of a Dataframe in Python

Hello ! I have a dataframe in Python that has a column called "animal" with rows that contain the name of 4 animals: some rows with "bird", some with "dolphin", some with "dog" and finally some rows with "Others". I check the number of rows corresponding to each one of these with:

Code:

from collections import Counter

cnt = Counter(data.animal)
print(cnt)
and I obtain:
Code:

Counter({'Others': 1366, 'dog': 922, 'bird': 133, 'dolphin': 10})
I would like to reduce the size...

How to reduce the size of a Dataframe in Python