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

SettingWithCopyWarning on Regression runs #120

Closed
AndreRicoPSU opened this issue Feb 7, 2023 · 1 comment
Closed

SettingWithCopyWarning on Regression runs #120

AndreRicoPSU opened this issue Feb 7, 2023 · 1 comment

Comments

@AndreRicoPSU
Copy link
Contributor

No description provided.

@AndreRicoPSU
Copy link
Contributor Author

AndreRicoPSU commented Feb 7, 2023

When running association analyses in debug environment, python generates warnings for improvements. When searching the two links below, the warning point was located at the moment when it was updating the data for regression without invalid categories.

  1. API: raise/warn SettingWithCopy when chained assignment is detected pandas-dev/pandas#5390
  2. spurious SettingWithCopyWarning  pandas-dev/pandas#5597

The correction was just changing the way of assigning new data with .loc

{utilities.py}
# GITHUB ISSUE #120: SettingWithCopyWarning on Regression runs
# data[var] = data[var].cat.remove_unused_categories()
data.loc[:, var] = data[var].cat.remove_unused_categories()

release 3.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant