Reading in a file

fierstt Registered Posts: 4 ✭✭✭
edited July 16 in Using Dataiku

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?


  • fierstt
    fierstt Registered Posts: 4 ✭✭✭

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

  • tgb417
    tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,595 Neuron


    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.

Setup Info
      Help me…