Reputation: 44
simple i make pandas data frame from dictionary then use dropna I dont know why its not removing NaN
df=pd.DataFrame(dic)
df.dropna(axis=1,inplace=True)
df.head()
my code link(not completed) https://colab.research.google.com/drive/1HoniG14dUZbERxDm9QKowjkpacK3wyt5?usp=sharing
Upvotes: 0
Views: 3242
Reputation: 260570
You likely have "NaN" strings. You should first convert them to real NA values. Let's use pd.NA
:
df = df.replace('NaN', pd.NA).dropna(axis=1)
Upvotes: 4