Skip to content

Instantly share code, notes, and snippets.

@tanveer-sayyed
Last active February 23, 2019 12:46
Show Gist options
  • Save tanveer-sayyed/55044b176cd8ac6cac83cbd66d5a1fd4 to your computer and use it in GitHub Desktop.
Save tanveer-sayyed/55044b176cd8ac6cac83cbd66d5a1fd4 to your computer and use it in GitHub Desktop.
In [25]:
df = pd.DataFrame(data=[[1, 2, np.nan, 3],
[np.NaN, None, np.NAN, np.nan], # Notice 3 different NaNs here
[4, 5, 'NA', '#$%'],
[6, 7, np.nan, 8],
["missing", 9, np.nan, 10],
[11, 12, np.nan, "not available"]],
index='i0,i1,i2,i3,i4,i5'.split(','),
columns='c0,c1,c2,c3'.split(','))
df # Pandas has recognised "by default" None and all types of NaNs;
# but not the strings --> ["missing”, “not available”, “NA”]
Out[25]:
c0 c1 c2 c3
i0 1 2.0 NaN 3
i1 NaN NaN NaN NaN
i2 4 5.0 NA #$%
i3 6 7.0 NaN 8
i4 missing 9.0 NaN 10
i5 11 12.0 NaN not available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment