Skip to content

Commit

Permalink
use s.index instead of other.index
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeroto521 committed Sep 9, 2022
1 parent 6497598 commit 93ebeb1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dtoolkit/geoaccessor/geoseries/geodistance_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ def geodistance_matrix(
raise ValueError(f"Only support 'EPSG:4326' CRS, but got {s.crs!r}.")

if other is None:
other = s.copy()

if isinstance(other, gpd.base.GeoPandasBase):
Y = None
elif isinstance(other, gpd.base.GeoPandasBase):
if other.crs != 4326:
raise ValueError(f"Only support 'EPSG:4326' CRS, but got {other.crs!r}.")

Expand All @@ -123,5 +122,5 @@ def geodistance_matrix(
return pd.DataFrame(
radius * haversine_distances(X, Y),
index=s.index,
columns=other.index,
columns=other.index if other is not None else s.index,
)

0 comments on commit 93ebeb1

Please sign in to comment.