-
-
Notifications
You must be signed in to change notification settings - Fork 19k
Closed
Description
Migrated from StackOverflow comment : http://stackoverflow.com/questions/12598520/set-index-on-multiple-columns-with-one-empty-column
df = DataFrame([
dict(a=1, p=0),
dict(a=2, m=10),
dict(a=3, m=11, p=20),
dict(a=4, m=12, p=21)
], columns=('a', 'm', 'p', 'x'))
. a m p x
0 1 NaN 0 NaN
1 2 10 NaN NaN
2 3 11 20 NaN
3 4 12 21 NaN
Applying fillna(None) turns one value to 0 !
df.fillna(None)
. a m p x
0 1 NaN 0 NaN
1 2 10 0 NaN
2 3 11 20 NaN
3 4 12 21 NaN
Applying fillna(1) works as expected :
df.fillna(1)
. a m p x
0 1 1 0 1
1 2 10 1 1
2 3 11 20 1
3 4 12 21 1
Applying fillna(np.NaN) works as expected :
df.fillna(np.NaN)
. a m p x
0 1 NaN 0 NaN
1 2 10 NaN NaN
2 3 11 20 NaN
3 4 12 21 NaN
Could be related to #1971
rayne-hernandez
Metadata
Metadata
Assignees
Labels
No labels