是非墨 2023-02-12 09:54 采纳率: 100%
浏览 103
已结题

module ‘geohash’ has no attribute ‘neighbors’

使用geohash时,将geohash化的地点字符串编码解码为经纬度,并计算出8个相邻区域的经纬度
df['start_lat_lng'] = df['geohashed_start_loc'].apply(lambda s : geohash.decode(s))
df['end_lat_lng'] = df['geohashed_end_loc'].apply(lambda s : geohash.decode(s))
df['start_neighbors'] = df['geohashed_start_loc'].apply(lambda s : geohash.neighbors(s))
后面还有内容,报错的时候标了这一段
主要标在geohash.neighbors 上
显示为:
AttributeError:module 'geohash' has no attribute 'neighbors'
使用的是jupyter
前面数据库导入是下面这样的
#导入需要的包和库
import pandas as pd
import seaborn as sns
import geohash
import matplotlib.pyplot as plt
from math import radians, cos, sin, asin, sqrt

求问哪里出问题了,要怎么解决

  • 写回答

2条回答 默认 最新

  • 元气少女缘结神 2023-02-12 10:38
    关注

    你看下geohash是否在lib/site-package/下面,然后打开geohash文件夹,看下有没有neighbors。
    然后你去重新下一个这个包,下载后改一下__int__里的import就行.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 2月20日
  • 已采纳回答 2月12日
  • 修改了问题 2月12日
  • 创建了问题 2月12日