ฉันใช้พารามิเตอร์ฟิลด์ที่เป็นภาษาไพธอน-elasticsearch รูปแบบ api ที่เก็บข้อมูลบางอย่างจาก elasticsearch พยายามที่จะวิเคราะห์@วันที่และเวลาในรูปแบบมาตรฐาน iso สำหรับใช้ใน pandas dataframe.
fields = \
[{
"field": "@timestamp",
"format": "strict_date_optional_time"
}]
ค่าปริยายของ elasticsearch อบแทนที่ผลตรวจในอาเรย์-รายการรูปแบบที่เห็นในหมอ:
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.
เนื่องจากมันผลลัพธ์จาก dataframe มีวัตถุ-รายการ serie ที่ไม่สามารถต่างๆที่วิเคราะห์ต้องเป็น datetime serie โดยบูวิธีการของ.
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]
ตอนที่พยายามที่จะวิเคราะห์ serie จะ datetime serie:
pd.to_datetime(["fields.@timestamp"])
นั่นผลอยู่ใน:
TypeError: <class 'list'> is not convertible to datetime
ฉันใช้กรณีต้องการมากมาย datetime รูปแบบและช่องข้อมูลพารามิเตอร์เหมาะกับดี querying หลายในรูปแบบ,แต่บมีวัตถุ datetime ข้อความลำบากอย่าง.