Skip to content

pytest warning on machine_learning/k_means_clust.py::k_means_clust.ReportGenerator #2282

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

Closed
cclauss opened this issue Aug 5, 2020 · 3 comments

Comments

@cclauss
Copy link
Member

cclauss commented Aug 5, 2020

@beqakd Each time there is a commit to this repo, we run Travis CI tests and pytest is generating the following warning:

machine_learning/k_means_clust.py::k_means_clust.ReportGenerator

  /home/travis/virtualenv/python3.8.3/lib/python3.8/site-packages/pandas/core/generic.py:5159: SettingWithCopyWarning: 

  A value is trying to be set on a copy of a slice from a DataFrame.

  Try using .loc[row_indexer,col_indexer] = value instead

  See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

    self[name] = value

-- Docs: https://docs.pytest.org/en/stable/warnings.html

Can you please modify the algorithm so that this warning is no longer generated?

@beqakd
Copy link
Contributor

beqakd commented Aug 5, 2020

For sure. Will work on this issue!

@sjadlakha
Copy link

Would like to help solving this problem.

sjadlakha added a commit to sjadlakha/Python that referenced this issue Aug 5, 2020
@beqakd
Copy link
Contributor

beqakd commented Aug 5, 2020 via email

@cclauss cclauss added awaiting reviews This PR is ready to be reviewed and removed awaiting reviews This PR is ready to be reviewed labels Aug 23, 2020
cclauss pushed a commit that referenced this issue Aug 23, 2020
* Fix SettingWithCopy warning in pandas

#2282

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py
@cclauss cclauss closed this as completed Aug 23, 2020
stokhos pushed a commit to stokhos/Python that referenced this issue Jan 3, 2021
* Fix SettingWithCopy warning in pandas

TheAlgorithms#2282

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

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

No branches or pull requests

3 participants