Skip to content

Commit

Permalink
fix(pandas): don't reassign the same column to silence SettingWithCop…
Browse files Browse the repository at this point in the history
…yWarning warning

The warning is valid in many contexts, but it's spurious here and it's
quite loud.
  • Loading branch information
gforsyth authored and cpcloud committed Apr 7, 2022
1 parent 0822174 commit 75dc616
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ibis/backends/pandas/execution/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ def build_df_from_selection(
renamed_cols[from_col] = to_cols[0]
else:
for new_col in to_cols:
result[new_col] = result.loc[:, from_col]
if from_col != new_col:
result[new_col] = result[from_col]

if renamed_cols:
result = result.rename(columns=renamed_cols)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ filterwarnings = [
'ignore:Using \.astype to convert from timezone-(naive|aware) dtype:FutureWarning',
"ignore:This pattern is interpreted as a regular expression, and has match groups:UserWarning",
"ignore:The default dtype for empty Series will be 'object':FutureWarning",
'ignore:\nA value is trying to be set on a copy of a slice from a DataFrame:',
"ignore:the `interpolation=` argument to percentile was renamed to `method=`:DeprecationWarning",
"ignore:Explicitly passing `name=None`:FutureWarning",
# the warning suggestion to simply remove the argument in the call isn't correct
Expand Down

0 comments on commit 75dc616

Please sign in to comment.