我对 Python 和 openstack ceilometer 有点陌生。我正在使用以下代码读取云高仪数据:
import ceilometerclient.client
cclient = ceilometerclient.client.get_client(2, os_username="Ceilometeradmin", os_password="blahblah", os_tenant_name="blahblah", os_auth_url="http://xxx.xx.xx.x:5000/v2.0")
query = [dict(field='resource_id', op='eq', value='dd893564-85e5-43f8-a384-086417f1d82c')]
ls = cclient.meters.list(q=query)
(请参阅附件的输出图片)
有谁知道我如何将其转换为数据框?
我试过了 :ls2 = pandas.DataFrame(ls, columns=["user_id", "name", "resource_id", "source", "meter_id", "project_id", "type", "unit"])
但得到以下错误:
Traceback (most recent call last):
File "", line 1, in File "/usr/lib/python2.7/dist-packages/pandas/core/frame.py", line 250, in init copy=copy)
File "/usr/lib/python2.7/dist-packages/pandas/core/frame.py", line 363, in _init_ndarray return create_block_manager_from_blocks([values.T], [columns, index])
File "/usr/lib/python2.7/dist-packages/pandas/core/internals.py", line 3750, in create_block_manager_from_blocks construction_error(tot_items, blocks[0].shape[1:], axes, e)
File "/usr/lib/python2.7/dist-packages/pandas/core/internals.py", line 3732, in construction_error passed,implied))
ValueError: Shape of passed values is (1, 2), indices imply (8, 2)
如果有人可以提供帮助,那将非常感激..
谢谢
最好的祝愿