Last active
February 23, 2019 12:46
-
-
Save tanveer-sayyed/55044b176cd8ac6cac83cbd66d5a1fd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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