Feat: formatage des numéros de lot en 2digits

This commit is contained in:
Bertrand Benjamin 2022-12-18 10:11:15 +01:00
parent bde6a0dfc6
commit 882974cee6
2 changed files with 4 additions and 2 deletions

View File

@ -7,7 +7,7 @@ def parse_above_loc(content):
row = {} row = {}
app, loc, *_ = content.split("\n") app, loc, *_ = content.split("\n")
app_ = app.split(" ") app_ = app.split(" ")
row["lot"] = app_[1] row["lot"] = f"{int(app_[1]):02d}"
row["type"] = " ".join(app_[2:]) row["type"] = " ".join(app_[2:])
row["locataire"] = loc row["locataire"] = loc
return pd.Series(row) return pd.Series(row)

View File

@ -73,7 +73,9 @@ def join(src, dest):
} }
for file in p.glob("*.xlsx"): for file in p.glob("*.xlsx"):
year, month, immeuble, table = file.stem.split("_") year, month, immeuble, table = file.stem.split("_")
df = pd.read_excel(file).assign(annee=year, mois=month, immeuble=immeuble[:3]) df = pd.read_excel(file, dtype={"lot": str}).assign(
annee=year, mois=month, immeuble=immeuble[:3]
)
dfs[table].append(df) dfs[table].append(df)
for tablename, datas in dfs.items(): for tablename, datas in dfs.items():
df = pd.concat(datas) df = pd.concat(datas)