You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [41]: df = DataFrame({'A' : [1,1,2], 'B' : list('aba'), 'C' : ['foo', np.nan, 'bar']}).set_index(['A','B'])
In [42]: df.unstack('B')
Out[42]:
C
B a b
A
1 foo NaN
2 bar None
In [43]: df.unstack('B', fill_value=np.nan)
Out[43]:
C
B a b
A
1 foo NaN
2 bar NaN
you can make a case to do this as we DO support None as a fill value, but almost always even with object columns we use np.nan, unless very explicity set by the user.