Hi I am new to pandas and struggling with a manipulation. I have a dataframe df with a huge number of columns, and I only want to keep the number of columns that have a count of above 5000 values.
I tried the loop below but it does not work. Is there any easy way to do this? Also is there a function I could create to apply this to any dataframe where I want to keep columns with only n values or more?
for column in df.columns:
if df[column].count() > 5000:
column = column
else:
df[column].drop()
Thanks