Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated pandas.apply functionality #1069

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions activity_browser/bwutils/superstructure/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def get_relevant_activities(df: pd.DataFrame, part: str = "from") -> dict:
if sub.empty:
return {}

names, products, locations, dbs = sub.iloc[:, 0:4].apply(set, axis=0)
names, products, locations, dbs = list(map(set, sub.iloc[:, 0:4].values.T))
# names, products, locations, dbs = sub.iloc[:, 0:4].apply(set, axis=0)
query = (ActivityDataset
.select(ActivityDataset.name, ActivityDataset.product,
ActivityDataset.location, ActivityDataset.database,
Expand All @@ -113,7 +114,8 @@ def get_relevant_flows(df: pd.DataFrame, part: str = "from") -> dict:
if sub.empty:
return {}

names, categories, dbs = sub.iloc[:, 0:3].apply(set, axis=0)
names, categories, dbs = list(map(set, sub.iloc[:, 0:3].values.T))
# names, categories, dbs = sub.iloc[:, 0:3].apply(set, axis=0)
query = (ActivityDataset
.select(ActivityDataset.name, ActivityDataset.data,
ActivityDataset.database, ActivityDataset.code)
Expand Down
2 changes: 1 addition & 1 deletion activity_browser/bwutils/superstructure/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def import_from_excel(document_path: Union[str, Path], import_sheet: int = 1) ->

# Convert specific columns that may have tuples as strings
columns = ["from categories", "from key", "to categories", "to key"]
data.loc[:, columns] = data[columns].applymap(convert_tuple_str)
data.loc[:, columns] = data[columns].map(convert_tuple_str)
except:
# skip the error checks here, these now occur in the calling layout.tabs.LCA_setup module
pass
Expand Down
Loading