mirror of
https://github.com/wassname/geopandas.git
synced 2026-09-12 12:20:25 +08:00
CLN: remove pandas <1.0 check (#2440)
* CLN: remove pandas <1.0 check * CLN: more old pandas
This commit is contained in:
@@ -157,7 +157,6 @@ class GeoDataFrame(GeoPandasBase, DataFrame):
|
||||
)
|
||||
|
||||
# only if we have actual geometry values -> call set_geometry
|
||||
index = self.index
|
||||
try:
|
||||
if (
|
||||
hasattr(self["geometry"].values, "crs")
|
||||
@@ -170,11 +169,6 @@ class GeoDataFrame(GeoPandasBase, DataFrame):
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
if self.index is not index:
|
||||
# With pandas < 1.0 and an empty frame (no rows), the index
|
||||
# gets reset to a default RangeIndex -> set back the original
|
||||
# index if needed
|
||||
self.index = index
|
||||
geometry = "geometry"
|
||||
|
||||
if geometry is not None:
|
||||
@@ -346,12 +340,7 @@ class GeoDataFrame(GeoPandasBase, DataFrame):
|
||||
|
||||
# Check that we are using a listlike of geometries
|
||||
level = _ensure_geometry(level, crs=crs)
|
||||
index = frame.index
|
||||
frame[geo_column_name] = level
|
||||
if frame.index is not index and len(frame.index) == len(index):
|
||||
# With pandas < 1.0 and an empty frame (no rows), the index gets reset
|
||||
# to a default RangeIndex -> set back the original index if needed
|
||||
frame.index = index
|
||||
frame._geometry_column_name = geo_column_name
|
||||
frame.crs = crs
|
||||
if not inplace:
|
||||
|
||||
@@ -268,7 +268,7 @@ def test_convert_dtypes(df):
|
||||
|
||||
# Test geometry col is first col, first, geom_col_name=geometry
|
||||
# (order is important in concat, used internally)
|
||||
res1 = df.convert_dtypes() # note res1 done first for pandas < 1 xfail check
|
||||
res1 = df.convert_dtypes()
|
||||
|
||||
expected1 = GeoDataFrame(
|
||||
pd.DataFrame(df).convert_dtypes(), crs=df.crs, geometry=df.geometry.name
|
||||
|
||||
Reference in New Issue
Block a user