Data management with Python, Pandas, Matplotlib and Openpyxl
- Détails
- 40891
Pandas is an excellent Python librarie to manage data. Matplotlib allows to create advanced charts and Openpyxl is very usefull to read/write Excel files. These 3 tools, combined with other classic Python features, allow to do data analysis and engineering.
First install or check Python and Pip, then the 3 libraries:
pip install pandas pip install matplotlib pip install openpyxl
Data management with Python, Pandas, Matplotlib and Openpyxl
Installer Postgres 15 et son extension GIS sous Windows
- Détails
- 313
...et afficher quelques données géographiques PostGIS sous QGIS
Salut toi ! Prêt à bénéficier de toute la puissance de Postgres 15 ? Tu as bien mis ta ceinture de sécurité ?
Maîtrise tes tremblements, bien compréhensibles face à ce déluge de technologies aux performances abyssales, et prépare-toi à entrer dans un monde nouveau, où l'imagination est la seule limite !
🤖🤟🌐💪🧭🐘
Tutoriel avancé QGIS et Python
- Détails
- 46934
Interopérabilité Python/QGIS - Principaux concepts de Python, indentation, itération, variable, méthode, boucle, fonction, condition, liste, tuple, paramètre, argument, chaîne formatée, importation - Fonctions géométriques - Écriture de fichiers - Fonctions SIG - Génération de cartes - Standalone - Milieu alpin
Sources et liens divers :
- Tutoriel d'initiation à Python dans QGIS3 (débutant) : http://www.qgistutorials.com/fr/docs/3/getting_started_with_pyqgis.html
- Blog spécialisé d'Underdark, aka Anita Graser : https://anitagraser.com/
- Documentation QGIS : https://docs.qgis.org/3.10/en/docs/
- Documentation Python : https://docs.python.org/fr/3/
- Documentation ArcGIS/Python : https://desktop.arcgis.com/search/?q=python&language=fr
- Processing providers and algorithms : https://docs.qgis.org/3.10/en/docs/user_manual/processing_algs/
- OSMDownloader : https://github.com/lcoandrade/OSMDownloader
- QuickOSM : https://github.com/3liz/QuickOSM
- Wikidata : https://www.wikidata.org/
- Landscape Archaeology : https://landscapearchaeology.org/
- AppDividend : https://appdividend.com/
- OpenSourceOptions: https://opensourceoptions.com/
- webgeodatavore : https://webgeodatavore.com/
- QGIS StackExchange : https://gis.stackexchange.com
Tutoriel écrit sur QGIS 3.14 'Py' et Python 3.8, mais j'ai pu constater qu'il fonctionne de façon assez similaire sur des versions précédentes, ainsi que sur QGIS 3.16.
Sur des versions plus récentes comme QGIS 3.2 il semble que certaines API n'aient pas encore été portées (wikipedia et wikidata), mais cela ne posera pas de problème pour 99% du tutoriel.
Quelques regex sur Notepad
- Détails
- 38884
Les expressions régulières (regex) sur Notepad++ sont très pratiques pour standardiser un fichier de données avant import par exemple, récupérer des données, corriger des chaînes particulières, avec des conditions, etc...
Ici quelques astuces propres à mon usage personnel.
Auto submit a form with Python, Selenium and Chromium
- Détails
- 3602
Here a simple Selenium example where we go to fill then submit a form from data previously converted in XML.
I choose XML because this flat format is easy to grab with Python, and it can be created from an Excel file with Access for example. Morever, if the auto-submit crashs during the execution (it is possible even with a good code, depending on the website providing the form), Chromium will stop on the last record and you could remove the begining of the XML before to re-execute the same code (to avoid duplicates).
For those in a hurry (🧐) my code is here on GitHub. But for a full understanding just see below.
Web scraping with Python and BeautifulSoup
- Détails
- 2434
Let's go web scraping with Python and BeautifulSoup! Here BeautifulSoup will be able to extract formatted data from HTML and its CCS code. For confidentiality reasons, we will not name the parsed website, but a lot are built like that: pages containing record from a database use their ID in the URL. So you will to adapt the codes below to your own website and purposes.
We will use a complex website as example, where the IDs to guess are listed in a large pagination.
First, we will get the links to articles (with IDs in URLs) from all pages of the pagination, then we will store data in a CSV file, if interesting (we search emails). So we will do a loop in a loop, with a condition, but if the website you want to parse is simpler (without pagination), you will not need the first loop.
Libraries and receptacle
We start by importing some necessary libraries and creating the receptacle file for our data.
from bs4 import BeautifulSoup import requests import re import csv # CSV file to receive data out_file = open('C:/python_projects/webscraping/email.csv', 'w', encoding='cp1252') out_file.write("email" + "\n")
Page 1 sur 6