For this project, I used three types of data: the data of the rooftops from here: https://opendata.swiss/de/dataset/eignung-von-hausdachern-fur-die-nutzung-von-sonnenenergie/resource/2446ce7b-8709-42a1-b293-49b48129a5b4 This is geographical and geometrical data of all rooftops in switzerland. Some of them have inproper geometries and they are not associated with a canton or municipality.
Then, the data of the PV devices can be found here:
https://opendata.swiss/de/dataset/elektrizitatsproduktionsanlagen/resource/222c10df-57c7-4fe2-a3de-7979eb41260d Here are also other sources of electric energy generators included.
Then, a geodata file is needed for the borders of the municipals. This can be loaded from following plugin: Swiss Geo Downloader
You first have to run the preprocess function (comment it out in main function) to merge the datasets.
Afterwards, you can either look at the data in qgis (output stored in out/households.gpkg) or create some plots using geopandas.