tabel pivot tapi tetap nan
(df.groupby(['Date', 'A']).B
.apply(lambda x: np.nan if x.isna().all() else x.sum())
.unstack('A')
)
Smoggy Sandpiper
(df.groupby(['Date', 'A']).B
.apply(lambda x: np.nan if x.isna().all() else x.sum())
.unstack('A')
)