Survey banner
The Dataiku Community is moving to a new home! Some short term disruption starting next week: LEARN MORE

Reading in a file

Level 1
Reading in a file

So I have some geoplotting code within a python recipe.  Something similar to this:

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))

usa = world[ == "United States of America"]

# Plots
ax = world[ == 'United States of America'].plot(
color='white', edgecolor='black')

# We can now plot our ``GeoDataFrame``.
nothing_df.plot(ax=ax, color='red')

So I would like to read in and overlay a shapefile of my own instead of using the geopandas naturalearth_lowres file.

So I uploaded the shapefile and tried this:, tho I think that is not what I want.  I just want the raw shapefile.

So then I created a managed folder and tried to upload the shapefile from there and tried reading it in.  The code looks similar to this:

handle = dataiku.Folder("shapefiles")
paths = handle.file_path("CA_Counties_TIGER2016.shp")
ca = gpd.read_file(paths)

This gives me an error of:

CPLE_OpenFailedError: Unable to open /home/ubuntu/DATA_DIR/bucket/dataiku/DYNAMICDEPARTUREROUTING/JmYR0Zm2/CA_Counties_TIGER2016.shx or /home/ubuntu/DATA_DIR/bucket/dataiku/DYNAMICDEPARTUREROUTING/JmYR0Zm2/CA_Counties_TIGER2016.SHX. Set SHAPE_RESTORE_SHX config option to YES to restore or create it.



 How do I get ahold of that managed file to pass it into geopandas?


0 Kudos
2 Replies
Level 1

I'm sorry I think I actually was grabbing the file correctly.  I was missing another shapefile needed.  My apologies.

0 Kudos


Welcome to the Dataiku Community. So pleased that you found your answer, and shared your question.  I suspect that someone in the future will have a similar question.  You have provided some insights on how you solved your problem. 

Hope you are having a great day.  

0 Kudos