I have a sparse Pandas dataframe with many null values and I want to filter it such that only rows and columns with more than 10 float entries are retained in the final dataset. I have tried using an existing snippet of code but it doesn't seem to work:
df.drop([col for col, val = df.count(axis=1, numeric_only='float') if val < 10], axis=1, inplace=True)
Can anyone let me know what the best way to drop the sparse columns in my dataframe is?