Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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