Created
March 10, 2026 11:09
-
-
Save ColinMaudry/66d363982fa645678fd0b36839c0009b to your computer and use it in GitHub Desktop.
Selection des marchés de travaux supérieurs à 75000€ remportés par des entreprises qui en ont remporté au moins 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import polars as pl | |
| from pathlib import Path | |
| df = pl.read_parquet("https://www.data.gouv.fr/fr/datasets/r/11cea8e8-df3e-4ed1-932b-781e2635e432") | |
| df = df.select("uid", "titulaire_nom", "titulaire_id", "titulaire_categorie", | |
| "titulaire_departement_code", "acheteur_departement_code", "titulaire_distance", | |
| "codeCPV", "type", "montant").filter((pl.col("type") == 'Travaux') & (pl.col("montant") >= 75000)) | |
| df2 = df.select("uid", "titulaire_id").group_by("titulaire_id").len(name="nb_marches").filter(pl.col("nb_marches") >= 3) | |
| df = df.join(df2, on="titulaire_id", how="inner") | |
| df = df.sort("titulaire_id") | |
| df.write_csv(Path("../sillant.csv")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment