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?
-
Do you have geometries in the dataframe or is it only a table?Bera– Bera2018年07月05日 05:16:25 +00:00Commented Jul 5, 2018 at 5:16
-
It is only a table.Yashdeep Singh Dahiya– Yashdeep Singh Dahiya2018年07月05日 05:22:19 +00:00Commented 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.YoLecomte– YoLecomte2019年01月06日 15:54:12 +00:00Commented Jan 6, 2019 at 15:54
-
If you use pandas inside QGIS you can write to a QGSVectorLayer stored in memoryBera– Bera2019年09月08日 08:17:17 +00:00Commented Sep 8, 2019 at 8:17
1 Answer 1
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.