From ca356662428f16acde03372d320fcd933098d348 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Sat, 17 Mar 2018 20:11:57 +0100 Subject: [PATCH] BUG: fix GeoSeries construction from scalar on pandas master (#692) --- geopandas/geoseries.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/geopandas/geoseries.py b/geopandas/geoseries.py index 3427a06..d90d90c 100644 --- a/geopandas/geoseries.py +++ b/geopandas/geoseries.py @@ -32,9 +32,11 @@ class GeoSeries(GeoPandasBase, Series): return arr.view(GeoSeries) def __init__(self, *args, **kwargs): - # fix problem for scalar geometries passed + # fix problem for scalar geometries passed, ensure the list of + # scalars is of correct length if index is specified if len(args) == 1 and isinstance(args[0], BaseGeometry): - args = ([args[0]],) + n = len(kwargs.get('index', [1])) + args = ([args[0]] * n,) crs = kwargs.pop('crs', None)