Skip to content

Instantly share code, notes, and snippets.

@mzaradzki
Last active July 3, 2017 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzaradzki/ca1b2b34c7e6af9bcf459e6aa65fbfbb to your computer and use it in GitHub Desktop.
Save mzaradzki/ca1b2b34c7e6af9bcf459e6aa65fbfbb to your computer and use it in GitHub Desktop.
# Find columns with Null values
nullcols = []
for col in dfX.columns:
nbnull = (dfX[col].isnull()*1).sum()
if ( nbnull > 0 ):
tp = type(dfX[dfX[col].notnull()][col].iat[0]) # type of first non null value
nullcols.append([col, tp])
print(col, nbnull, t)
# Output
# funder 3635 <type 'str'>
# installer 3655 <type 'str'>
# subvillage 371 <type 'str'>
# public_meeting 3334 <type 'bool'>
# scheme_management 3877 <type 'str'>
# scheme_name 28166 <type 'str'>
# permit 3056 <type 'bool'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment