Fix: lot, type and locataire extraction

This commit is contained in:
Bertrand Benjamin 2022-09-28 15:35:21 +02:00
parent c0c550bd59
commit 9c06c64ae4
1 changed files with 5 additions and 12 deletions

View File

@ -5,18 +5,11 @@ import pandas as pd
def parse_above_loc(content): def parse_above_loc(content):
row = {} row = {}
try: app, loc, *_ = content.split("\n")
app, loc = content.split("\n") app_ = app.split(" ")
except ValueError: row["lot"] = app_[1]
row["lot"] = "" row["type"] = " ".join(app_[2:])
row["type"] = "" row["locataire"] = loc
row["locataire"] = content
else:
app_ = app.split(" ")
row["lot"] = app_[1]
row["type"] = " ".join(app_[2:])
row["locataire"] = loc
return pd.Series(row) return pd.Series(row)