Skip to content

Commit

Permalink
Prevent pandas contains method to crash on NAN values
Browse files Browse the repository at this point in the history
  • Loading branch information
biwano committed Sep 6, 2023
1 parent 2f40334 commit 393b003
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/apps/tco2_dashboard/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def merge_retirements_data_for_retirement_chart(
"Beneficiary",
] = df_retired_polygon_merged["Tx From Address"]
df_retired_polygon_merged.loc[
df_retired_polygon_merged["Beneficiary"].str.contains("Polygon", case=False),
df_retired_polygon_merged["Beneficiary"].str.contains("Polygon", case=False, na=False),
"Beneficiary",
] = "Polygon"

Expand All @@ -353,7 +353,7 @@ def merge_retirements_data_for_retirement_chart(
] = df_retired_polygon_merged["Quantity_klima_agg"]

df_retired_polygon_merged.loc[
df_retired_polygon_merged["Beneficiary"].str.contains("Polygon", case=False),
df_retired_polygon_merged["Beneficiary"].str.contains("Polygon", case=False, na=False),
"Beneficiary",
] = "Polygon"

Expand Down Expand Up @@ -388,11 +388,11 @@ def merge_retirements_data_for_retirement_chart(

# Prettify known beneficiaries
df_retired_eth_merged.loc[
df_retired_eth_merged["Beneficiary"].str.contains("ifood|IFOOD", case=False),
df_retired_eth_merged["Beneficiary"].str.contains("ifood|IFOOD", case=False, na=False),
"Beneficiary",
] = "iFood"
df_retired_eth_merged.loc[
df_retired_eth_merged["Beneficiary"].str.contains("SKYBRIDGE", case=False),
df_retired_eth_merged["Beneficiary"].str.contains("SKYBRIDGE", case=False, na=False),
"Beneficiary",
] = "SkyBridge Capital"

Expand Down

0 comments on commit 393b003

Please sign in to comment.