Skip to content

Commit

Permalink
👔 Add marker_size column
Browse files Browse the repository at this point in the history
  • Loading branch information
jh0ker committed Dec 18, 2023
1 parent 0262d87 commit 53421b1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ddj_cloud/scrapers/talsperren/exporters/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ def _add_monthly_fill_percent_to_map(

return df_map

def _add_marker_size(self, df_map: pd.DataFrame) -> pd.DataFrame:
source_column = df_map["capacity_mio_m3"]
df_map.insert(
1,
"marker_size",
(source_column - source_column.min()) / (source_column.max() - source_column.min()) * 95
+ 5,
)
return df_map

def run(self, df_base: pd.DataFrame) -> pd.DataFrame:
df_base.insert(0, "id", df_base["federation_name"] + "_" + df_base["name"])

Expand All @@ -180,6 +190,9 @@ def run(self, df_base: pd.DataFrame) -> pd.DataFrame:
# Add monthly fill ratio
df_map = self._add_monthly_fill_percent_to_map(df_base, df_map)

# Add marker size
df_map = self._add_marker_size(df_map)

# round all floats to 5 decimals
df_map = df_map.round(5)

Expand Down

0 comments on commit 53421b1

Please sign in to comment.