我利用该领域的参数上的巨蟒略任api检索某些数据从访问用户试图分析@时间戳在iso格式,用于在熊猫据框.
fields = \
[{
"field": "@timestamp",
"format": "strict_date_optional_time"
}]
通过默认略任返回的结果列表格式看文档:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html
The fields response always returns an array of values for each field, even when there is a single value in the _source.
由于这种所得的数据框含有对象名单甲不可解析的日期时间系列通过常规的方法。
Name: fields.@timestamp, Length: 18707, dtype: object
0 [2021-11-04T01:30:00.263Z]
1 [2021-11-04T01:30:00.385Z]
2 [2021-11-04T01:30:00.406Z]
3 [2021-11-04T01:30:00.996Z]
4 [2021-11-04T01:30:01.001Z]
...
8368 [2021-11-04T02:00:00.846Z]
8369 [2021-11-04T02:00:00.894Z]
8370 [2021-11-04T02:00:00.895Z]
8371 [2021-11-04T02:00:00.984Z]
8372 [2021-11-04T02:00:00.988Z]
当设法分析甲到datetime甲:
pd.to_datetime(["fields.@timestamp"])
这导致:
TypeError: <class 'list'> is not convertible to datetime
我的使用情况下需要大量的时间日期格式和领域的参数非常适合查询的多个格式,但对列出的目datetime串困难的事情。