-3

I have a DataFrame with 1 Row and 33 Columns. I want to delete the columns where it finds a number between 0 and 30 and also nan values.

Is there any efficient way to do that?

  • 1
    Please search before posting. https://stackoverflow.com/questions/31614804/how-to-delete-a-column-in-pandas-dataframe-based-on-a-condition – Alfonso Nov 13 '19 at 13:30

1 Answers1

1

Just wanted to try doing it:

filtered = df.loc[:, ~((df.isnull()) | (df.sum(axis=0)<=30) & (df.sum(axis=0)>=0)).iloc[0]]