question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: explode() raises ValueError

See original GitHub issue

Hi,

as reported here https://github.com/martinfleis/momepy/issues/123, at certain situation gdf.explode() raises ValueError: Shape of passed values is (132850, 183), indices imply (132842, 183). Using data retrieved from OSM using OSMnx. (Warning - Vancouver gdf is large)

import geopandas as gpd
import osmnx as ox

gdf = ox.footprints.footprints_from_place(place='Vancouver, Canada')
gdf_projected = ox.project_gdf(gdf)
exploded = gdf_projected.explode()

I tried to save a small set to geojson, but after loading back to geopandas it does not cause the error 🤔

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
martinfleiscommented, Mar 7, 2020

@seizethedata This bug is super strange with your data. I wasn’t able to figure out what happens there nor find a workaround with current version of geopandas. But I was able to patch explode to work with your data - #1319.

1reaction
martinfleiscommented, Mar 7, 2020

@seizethedata Try reset_index() before exploding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pandas explode error - column must be scalar - Stack Overflow
New in version 1.3.0: Multi-column explode. If you see this ValueError you must be using an older version of pandas.
Read more >
How to Use the Pandas explode() Function? - Scaler Topics
This method raises an error in the following cases: When applying the explode() method to a dataframe: If we don't pass in any...
Read more >
What's new in 1.2.0 (December 26, 2020) - Pandas
Bug in Series.loc() and Series.iloc() raising ValueError when inserting a list-like np.array , list or tuple in an object Series of equal length...
Read more >
Pandas Explode Multiple Columns - Python - Linux Hint
The explode() function will also raise an error when the row-wise count of elements in a DataFrame does not match the column to...
Read more >
ipaddress — IPv4/IPv6 manipulation library — Python 3.11.1 ...
A ValueError is raised if address does not represent a valid IPv4 or IPv6 address. ... IPv4 address strings are now parsed as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found