Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
API/REGR: construction of Series with scalar-like / len-1 lists #20391
At geopandas some tests started failing with pandas master:
previously this replicated the single point multiple times, just as
This is related to #19714, which removed the broadcasting of 1-length lists in the Series constructor (pd.Series(, index=['a', 'b', 'c', 'd'])
The reason that geopandas converted the geometry to single element lists, is because geometries are convertable to array (and some are also iterable), and hence not seen as a 'scalar' by pandas (added 4 years ago: geopandas/geopandas#70).
It still works when you do not pass an index:
Note there is also some inconsistency within pandas itself:
(because in the first case when no index is specifed,
So the question is, do we want to keep the special case of len-1 lists being broadcasted? (so add that behaviour back)
And if not, do we have others ways to ensure pandas regards something as a scalar?
This was referenced
Mar 17, 2018
its already there: https://github.com/pandas-dev/pandas/pull/19714/files