尝试使用DataFrameClient将一些数据写入数据库(InfluxDB),但显然我的时间戳格式不正确:
DataFrameClient.write_points(json_body, measurement=Obj.project_handle, protocol='json')
File "/usr/lib/python3.6/site-packages/influxdb/_dataframe_client.py", line 131, in write_points
File "/usr/lib/python3.6/site-packages/influxdb/_dataframe_client.py", line 230, in _convert_dataframe_to_json
raise TypeError('Must be DataFrame with DatetimeIndex or '
TypeError: Must be DataFrame with DatetimeIndex or PeriodIndex.
好像我必须将时间戳转换为DatetimeIndex格式...我正在尝试用pd.DatetimeIndex(datetime_index)
来获取错误:
DatetimeIndex() must be called with a collection of some kind, datetime.datetime(2019, 11, 18, 18, 21, 39, 596050, tzinfo=<UTC>) was passed.