-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
"""Function to create sets.""" | ||
|
||
from data import format_transmission_name | ||
import pandas as pd | ||
|
||
def create_tech_set_trn(df_lines): | ||
def get_unique_technologies(ar: pd.DataFrame) -> list[str]: | ||
"""Gets unique technologies from activity ratio dataframe""" | ||
return ar.TECHNOLOGY.unique().tolist() | ||
|
||
df = df_lines[['From', 'To']].copy() | ||
df = format_transmission_name(df) | ||
df = df.rename(columns = {'TECHNOLOGY' : 'VALUE'}) | ||
def get_unique_fuels(ar: pd.DataFrame) -> list[str]: | ||
"""Gets unique fuels from activity ratio dataframe""" | ||
return ar.FUEL.unique().tolist() | ||
|
||
def create_set_from_iterators(*args: list[str] | set[str]) -> pd.DataFrame: | ||
"""Creates a set formatted dataframe from an arbitrary number of arguments""" | ||
|
||
data = [] | ||
|
||
for arg in args: | ||
data += arg | ||
|
||
data = list(set(data)) | ||
|
||
return df | ||
return pd.Series(data, name="VALUE").to_frame() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters