Little fixes for weekdays

#6
main
mmaurostoffel 2025-01-09 17:40:58 +01:00
parent 65b63d1326
commit 60a3d7d9b3
1 changed files with 2 additions and 3 deletions

View File

@ -25,10 +25,9 @@ def property_capacities_weekdays(id: int, scrapeDate: str):
df_calendar = df_calendar.drop("dates") df_calendar = df_calendar.drop("dates")
df_calendar = df_calendar.group_by(["weekday", "weekday_num"]).agg(pl.col("column_0").sum()) df_calendar = df_calendar.group_by(["weekday", "weekday_num"]).agg(pl.col("column_0").sum())
df_calendar = df_calendar.with_columns((pl.col("column_0") / numWeeks).alias("column_0")) df_calendar = df_calendar.with_columns((pl.col("column_0") / numWeeks * 100).alias("column_0"))
df_calendar = df_calendar.sort('weekday_num') df_calendar = df_calendar.sort('weekday_num')
df_calendar = df_calendar.drop('weekday_num') df_calendar = df_calendar.drop('weekday_num')
print(df_calendar)
result = {"scraping-date": scrapeDate, "weekday": df_calendar['weekday'].to_list(), 'capacities': df_calendar['column_0'].to_list()} result = {"scraping-date": scrapeDate, "weekdays": df_calendar['weekday'].to_list(), 'capacities': df_calendar['column_0'].to_list()}
return result return result