File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ - ** 1.0.2** (2026-01-16):
2+ - BREAKING: require cartogram_attribute to be a positional argument
3+ - fix inheritance from geopandas.GeoDataFrame
4+ - update geopandas dependency
5+
16- ** 1.0.1** (2025-06-27):
27 - workaround for change in geopandas inheritance
38
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ authors = [
1212]
1313
1414dependencies = [
15- " geopandas<1.1.0 " ,
15+ " geopandas" ,
1616 " joblib" ,
1717 " numpy" ,
1818 " pandas" ,
Original file line number Diff line number Diff line change 22
33"""Compute continuous cartograms."""
44
5- __version__ = "1.0.1 "
5+ __version__ = "1.0.2 "
66
77from .cartogram import Cartogram
88
Original file line number Diff line number Diff line change 3434class Cartogram (geopandas .GeoDataFrame ):
3535 """Compute continuous cartograms."""
3636
37+ _constructor = geopandas .GeoDataFrame
38+
39+ _constructor_sliced = pandas .Series
40+
41+ @classmethod
42+ def _geodataframe_constructor_with_fallback (
43+ cls , * args , ** kwargs
44+ ):
45+ """
46+ A flexible constructor for Cartogram.
47+
48+ It which checks whether or not arguments of the child class are used.
49+ """
50+ if "cartogram_attribute" in kwargs .keys ():
51+ df = cls (* args , ** kwargs )
52+ else :
53+ df = geopandas .GeoDataFrame (* args , ** kwargs )
54+ geometry_cols_mask = df .dtypes == "geometry"
55+ if len (geometry_cols_mask ) == 0 or geometry_cols_mask .sum () == 0 :
56+ df = pandas .DataFrame (df )
57+
58+ return df
59+
3760 def __init__ (
3861 self ,
3962 input_polygon_geodataframe ,
63+ / ,
4064 cartogram_attribute ,
4165 max_iterations = 10 ,
4266 max_average_error = 0.1 ,
You can’t perform that action at this time.
0 commit comments