I'm relatively new to Python and GIS.

I am attempting to read in a 1.1 GB shapefile using geopandas. I let the code run for an hour and it is still not complete. Is this normal? How can I optimize the time it takes for the file to be read?

Here's my code:

polygons = gpd.read_file(r"path_to_shapefile.shp")

Edit: My system is an SSD, 64bit Python, and 8gb of RAM.

Memory Usage during File Reading

Edit 2: Not sure what was different, but running this code a third time, the shapefile was able to be read by Geopandas in less than 5 minutes.

  • Added those details. How do I check how much RAM the process took to read the shapefile? Is that the memory being used in Task Manager? – Sumit Dalsania Apr 30 '19 at 0:45
  • Added a picture with this info, about 4GB of memory being used – Sumit Dalsania Apr 30 '19 at 0:57
  • 1
    Looks like you're running out of RAM and the process memory is getting swapped to disk which is very slow. Close everything on your PC before running. Don't have a web browser open. Don't use an IDE, use command line to run your code. – user2856 Apr 30 '19 at 1:12

Browse other questions tagged or ask your own question.