ValueError: DataFrame constructor not properly called!

刘超 11天前 ⋅ 87 阅读   编辑

一、描述

  构建pandas的dataframe,报如下错误

Traceback (most recent call last):
  File "difference_bigquery_local.py", line 91, in <module>
    print run(args)
  File "difference_bigquery_local.py", line 75, in run
    difference(args) 
  File "difference_bigquery_local.py", line 42, in difference
    locaDateframe = DataFrame(local_data)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 422, in __init__
    raise ValueError('DataFrame constructor not properly called!')
ValueError: DataFrame constructor not properly called!

二、分析

  1、支持list<dict>类型的数据直接构建dataframe,但这里是tuple<dict>类型,所以报错,将tuple<dict>转list<dict>即可

三、解决方法

  MySQLdb返回的结果构造成list<dict>


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: