0 votes
1 view
in Data Science by (17.6k points)

Well, I geohash_encoded the geographical coordinates to geohashes. My aim is to calculate the distance with some level of accuracy. I am trying to geohash_decode the geohashes back to geographical coordinates but I have failed to come up with a function that can do that to a column in a dataframe

1 Answer

0 votes
by (38.2k points)

Use this below code, it will works perfectly:

def gh_decode(hash):

    lat, lon = geohash2.decode(hash)

    return pd.Series({"latitude":lat, "longitude":lon})

df = df.join(df["geohash"].apply(gh_decode))

If you wish to learn What is Data Science visit this Data Science Online Course.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...