在将dict转为DataFrame时会报错:If using all scalar values, you must pass an index

例如:

summary = pd.DataFrame({key:value for key,value in test.items()if key in index}) #查看汇总表情况

【解决办法】

添加参数:index = [0]

summary = pd.DataFrame({key:value for key,value in test.items()if key in index},index = [0]) #查看汇总表情况

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-10-21
猜你喜欢
  • 2022-03-01
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2021-04-15
相关资源
相似解决方案