CLN: remove pandas <1.0 check (#2440)

* CLN: remove pandas <1.0 check

* CLN: more old pandas
This commit is contained in:
Matt Richards
2022-05-29 22:26:47 +02:00
committed by GitHub
parent 351ef71eb3
commit bf2e951846
2 changed files with 1 additions and 12 deletions
-11
View File
@@ -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:
+1 -1
View File
@@ -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