4

I'm working on a dataset that is readily available as a pandas dataframe object. Now, I would like to import this data as a layer in QGIS. I didn't find any helpful library or code to do so. So, I resorted to converting the dataframe to a csv file and then importing this as a layer using PyQGIS api.

Is there any way I can import the dataframe directly, without having to write it to a shapefile or a csv file?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jul 5, 2018 at 4:28
4
  • Do you have geometries in the dataframe or is it only a table? Commented Jul 5, 2018 at 5:16
  • It is only a table. Commented Jul 5, 2018 at 5:22
  • Can you show us what your dataframe looks like? You can probably use memory layer. Just convert each line of your dataframe to feature. Commented Jan 6, 2019 at 15:54
  • If you use pandas inside QGIS you can write to a QGSVectorLayer stored in memory Commented Sep 8, 2019 at 8:17

1 Answer 1

2

Dataframe is in-memory object that lives inside your Jupyter Notebook (or other development tool) and QGIS reads from file. There is no simple way to move objects between different processes.

answered Oct 24, 2018 at 6:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.