【问题标题】:Python Pandas QuestionsPython 熊猫问题
【发布时间】:2017-07-26 20:53:27
【问题描述】:

您好,我正在使用 Python 版本 3 通过 RESTapi 查询从楼宇自动化系统中检索数据。这会返回很多数据,但我不认为它是熊猫系列格式......我还附上了 python shell 输出的片段。最终,我想要创建一个熊猫系列来做一些简单的数学运算,但我做错了!

hwr = session.find_entity(filter_expr='secondaryhwr').result
hwr_df = session.his_read_frame(hwr, rng= '2017-05-01,2017-07-25').result

print(hwr_df.tail())
print(hwr_df.head())
print(hwr_df.describe())

print(type(hwr_df))
print(hwr_df.columns)
print(type(hwr_df.index))

Python Shell Output

【问题讨论】:

    标签: python python-3.x pandas python-requests


    【解决方案1】:

    看起来正在返回一个 DataFrame。您可以通过以下方式将其转换为系列:

    hwr_df = pd.Series(hwr_df[hwr_df.columns[0]])
    

    【讨论】:

    • 感谢一百万的小费,这完全有效......!如果 stackoverflow 有这个要求,请告诉我是否应该将此标记为“已解决”...祝您有美好的一天!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-05
    • 1970-01-01
    • 2023-03-11
    • 2018-01-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多