Skip to content

Commit

Permalink
feat: use iloc for string replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
kayjan committed Nov 3, 2024
1 parent 3841978 commit 82d5a6b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions bigtree/tree/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,10 @@ def add_suffix_to_path(
Returns:
(pd.DataFrame)
"""
data_replace = _data[_condition]
data_replace[path_col] = data_replace[path_col].str.replace(
_original_name, f"{_original_name} ({suffix})", regex=True
)
data_not_replace = _data[~_condition]
return data_replace._append(data_not_replace).sort_index()
_data.iloc[_condition.values, _data.columns.get_loc(path_col)] = _data.iloc[
_condition.values, _data.columns.get_loc(path_col)
].str.replace(_original_name, f"{_original_name} ({suffix})", regex=True)
return _data

for node_removed, move_indicator in zip(nodes_removed, moved_from_indicator):
if not detail:
Expand Down

0 comments on commit 82d5a6b

Please sign in to comment.