Answers for "pivot table but keep nan"

0

pivot table but keep nan

(df.groupby(['Date', 'A']).B
   .apply(lambda x: np.nan if x.isna().all() else x.sum())
   .unstack('A')
)
Posted by: Guest on July-17-2020

Code answers related to "pivot table but keep nan"

Python Answers by Framework

Browse Popular Code Answers by Language