如何用熊猫重塑数据框?
python 199
原文标题 :How to reshape dataframe with pandas?
我有一个数据框,其中包含从 2018 年到 2021 年每天的产品销售情况。 Dataframe 包含四列(日期、地点、产品类别和销售)。从前两列(日期、地点)中,我想使用可用数据来填补空白。添加数据后,我想删除 ProductCategory 中没有数据的行。我想在 python pandas 中做。
我的数据集样本如下所示:
我希望数据框看起来像这样: