使 Pandas 数据帧中的 H3 单元格转换更快

问题描述

我有一个表名Rides

start_lat start_long 结束_纬度 end_long
29.682413 78.997065 27.682413 76.997065
25.682413 74.997065 24.682413 76.997065

我想在 h3 单元格中转换它们并将它们添加回表格。我正在使用以下代码

lst1=[]
lst2=[]
for i in range(rides.shape[0]):
    hex1,hex2=0,0
    hex1 = h3.geo_to_h3(rides['start_lat'][i],rides['start_long'][i],8)
    hex2 = h3.geo_to_h3(rides['end_lat'][i],rides['end_long'][i],8)
    lst1.append(hex1)
    lst2.append(hex2)
rides['hex_ID1'] = lst1
rides['hex_ID1'] = lst2

这需要很多时间,我在想是否有更快的方法来做到这一点。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)