简体   繁体   中英

how to convert a list of 2D Points in Python to a dataframe

2dpointList = [ Point(2020-01-31 23:00:00, 33.0), Point(2020-02-01 00:00:00, 33.0)]

如何将其转换为索引为数据时间的数据帧

I guess you can use a Python dictionary:

point_list_2d = {
  "2020-01-31 23:00:00": 33.0,
  "2020-02-01 00:00:00": 33.0
}

That should do the job.

first create a dictionary out of your list of points like

x={ i[0]:i[1] for i in 2dpointList}

then create a series using

pd.Series(x)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM