Skip to content

Instantly share code, notes, and snippets.

@trcook
Last active June 24, 2023 13:59
Show Gist options
  • Save trcook/cf7789f4bd88bff246936d16f22e91bf to your computer and use it in GitHub Desktop.
Save trcook/cf7789f4bd88bff246936d16f22e91bf to your computer and use it in GitHub Desktop.
strip nan values from pandas data frame by rows
msk=dat.apply(pd.isnull).apply(sum,1)<=0
dat.loc[msk,:]
# to drop missing values by cols:
msk=dat.apply(pd.isnull).apply(sum,0)<=0
dat.loc[:,msk]
@drowe-official
Copy link

Tasty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment