コード例 #1
0
def test_geohash_decode():
    # decode lon/lat from geohash
    post_df = geohash_decode(
        df=lonlat_df[["city", "geohash"]],
        geohash="geohash",
        latitude="latitude",
        longitude="longitude",
    )
    assert sorted(post_df.columns.tolist()) == sorted(
        ["city", "geohash", "latitude", "longitude"])
    assert round_floats(series_to_list(post_df["longitude"]),
                        6) == round_floats(
                            series_to_list(lonlat_df["longitude"]), 6)
    assert round_floats(series_to_list(post_df["latitude"]),
                        6) == round_floats(
                            series_to_list(lonlat_df["latitude"]), 6)
コード例 #2
0
 def test_geohash_decode(self):
     # decode lon/lat from geohash
     post_df = proc.geohash_decode(
         df=lonlat_df[["city", "geohash"]],
         geohash="geohash",
         latitude="latitude",
         longitude="longitude",
     )
     self.assertListEqual(
         sorted(post_df.columns.tolist()),
         sorted(["city", "geohash", "latitude", "longitude"]),
     )
     self.assertListEqual(
         round_floats(series_to_list(post_df["longitude"]), 6),
         round_floats(series_to_list(lonlat_df["longitude"]), 6),
     )
     self.assertListEqual(
         round_floats(series_to_list(post_df["latitude"]), 6),
         round_floats(series_to_list(lonlat_df["latitude"]), 6),
     )