【问题标题】:How can I convert two lists from JSON into a Pandas DataFrame?如何将两个列表从 JSON 转换为 Pandas DataFrame?
【发布时间】:2020-06-21 17:53:45
【问题描述】:

这是我的 JSON:

{'date': [1498017600, 1498018500, 1498019400], 'plotPoints': [80.767918, 221.597006, 405.602822]}

我怎样才能将其转换为 Pandas DataFrame?

<table>
  <tr>
    <th>date</th>
    <th>plotPoints</th>
  </tr>
  <tr>
    <td>1498017600</td>
    <td>80.767918</td>
  </tr>
  <tr>
    <td>1498018500</td>
    <td>221.597006</td>
  </tr>
  <tr>
    <td>1498019400</td>
    <td>405.602822</td>
  </tr>
</table>

【问题讨论】:

    标签: json python-3.x pandas


    【解决方案1】:

    这是你要找的那个吗?

    pd.DataFrame.from_dict(data_l)
    

    制作这个

             date  plotPoints
    0  1498017600   80.767918
    1  1498018500  221.597006
    2  1498019400  405.602822
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-28
      • 2018-07-13
      • 2022-01-23
      • 2017-04-13
      • 2021-03-29
      • 1970-01-01
      • 2013-02-13
      相关资源
      最近更新 更多