pivot table but keep nan

Solutions on MaxInterview for pivot table but keep nan by the best coders in the world

showing results for - "pivot table but keep nan"
Amelie
06 Feb 2016
1(df.groupby(['Date', 'A']).B
2   .apply(lambda x: np.nan if x.isna().all() else x.sum())
3   .unstack('A')
4)