Skip to content

Commit 4e85c7a

Browse files
authored
Merge pull request #319 from kayjan/bugfix/tree-diff-substring
Use iloc instead of df._append
2 parents ffb365f + 82d5a6b commit 4e85c7a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

bigtree/tree/helper.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,10 @@ def add_suffix_to_path(
444444
Returns:
445445
(pd.DataFrame)
446446
"""
447-
data_replace = _data[_condition]
448-
data_replace[path_col] = data_replace[path_col].str.replace(
449-
_original_name, f"{_original_name} ({suffix})", regex=True
450-
)
451-
data_not_replace = _data[~_condition]
452-
return data_replace._append(data_not_replace).sort_index()
447+
_data.iloc[_condition.values, _data.columns.get_loc(path_col)] = _data.iloc[
448+
_condition.values, _data.columns.get_loc(path_col)
449+
].str.replace(_original_name, f"{_original_name} ({suffix})", regex=True)
450+
return _data
453451

454452
for node_removed, move_indicator in zip(nodes_removed, moved_from_indicator):
455453
if not detail:

0 commit comments

Comments
 (0)