Answers for "remove none from dataframe python"

25

drop if nan in column pandas

df = df[df['EPS'].notna()]
Posted by: Guest on March-17-2020
1

if none in column remove row

import pandas as pd
df = df[pd.notnull(df['Gender'])]
Posted by: Guest on December-25-2020
0

threshold meaning in pandas dropna

>>>df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
                   "toy": [np.nan, 'Batmobile', 'Bullwhip'],
                   "born": [pd.NaT, pd.Timestamp("1940-04-25"),
                            pd.NaT]}) 
df.dropna(thresh=2)
       name        toy       born
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT
Posted by: Guest on June-09-2020

Code answers related to "remove none from dataframe python"

Python Answers by Framework

Browse Popular Code Answers by Language