Filter a dataframe by the sum of rows:
df = df[df.sum(axis=1) > 0]
df = df.loc[df.sum(axis=1) > 0,:]
Filter by sum of columns:
df = df.loc[:,df.sum() > 0]
df = df.loc[:,df.sum(axis=0) > 0]
Source:
https://stackoverflow.com/questions/40425484/filter-dataframe-in-pandas-on-sum-of-rows