Skip to content

Commit

Permalink
Super Easy, super Readable, super Performance
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMau committed Jul 18, 2024
1 parent 7137b82 commit 6e07cfc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions data_adapter_oemof/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,15 @@ def find_and_replace_irrelevant_data(group_df: pd.DataFrame) -> pd.DataFrame:
if len(capacity_col) == 1 and (len(invest_col) != 0 or len(max_col) != 0):
# Add Indices where capacity is 0
fill_indices += group_df[capacity_col[0]] == 0
elif len(invest_col) == 1:
elif len(max_col) == 1:
# Add indices where capacity max == 0 (making investment impossible)
fill_indices += group_df[max_col[0]] == 0
elif len(max_col) == 1:
elif len(invest_col) == 1:
# Add indices where investment is not allowed
fill_indices += group_df[invest_col[0]] == 0

# Fill indices
group_df.loc[fill_indices] = group_df.bfill().loc[fill_indices]
group_df.loc[fill_indices] = group_df.ffill().loc[fill_indices]
group_df.loc[fill_indices] = group_df.fillna(group_df.mean(numeric_only=True))

return group_df

Expand Down

0 comments on commit 6e07cfc

Please sign in to comment.