使用2列组元素然后创建数据框

时间:2017-04-05 23:47:00

标签: python pandas

我有以下pandas数据帧:

enter image description here

该表包含有关客户购买的产品及其各自数量的信息。

我想创建一个Client(行)x Product(columns)矩阵,并在客户没有购买产品时填入数量和输入零,如下所示:

enter image description here

我该怎么做?

谢谢,

罗德里戈。

1 个答案:

答案 0 :(得分:2)

  {
    "animal": {
      "cat": {
        "name": "snowball",
        "color": "black",
        "age": "7"
      }
    }
    "age": "10"
  }