Skip to content

Move dummy coding related functions from reshape/reshape into separate file #45215

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

Merged
merged 14 commits into from
Jan 29, 2022

Conversation

pckSF
Copy link
Contributor

@pckSF pckSF commented Jan 6, 2022

Moves get_dummies into separate file reshape/dummy_coding.py.

  • Potential precursor PR to from_dummies
  • Passes atomic options tests
  • Passes linting tests
  • Whatsnew entry

With from_dummies being added, it seems clearer to have a separate file for dummy coding related transformations - as suggested here

To Discuss:

  1. Separate file or not?
  2. Opinions on the name reshape/dummy_coding.py?

@jreback jreback added the Refactor Internal refactoring of code label Jan 10, 2022
@mroeschke
Copy link
Member

Opinions on the name reshape/dummy_coding.py?

Maybe encoding.py to make it more generic?

@pckSF
Copy link
Contributor Author

pckSF commented Jan 14, 2022

Opinions on the name reshape/dummy_coding.py?

Maybe encoding.py to make it more generic?

Good idea, given that from_dummies will be added to this file as well - do you think the name encoding.py implies that the file holds the functions to decode the encodings (In the sense of "all encoding related stuff")?

@mroeschke
Copy link
Member

Opinions on the name reshape/dummy_coding.py?

Maybe encoding.py to make it more generic?

Good idea, given that from_dummies will be added to this file as well - do you think the name encoding.py implies that the file holds the functions to decode the encodings (In the sense of "all encoding related stuff")?

Yeah that's what I was thinking

@pckSF
Copy link
Contributor Author

pckSF commented Jan 19, 2022

Opinions on the name reshape/dummy_coding.py?

Maybe encoding.py to make it more generic?

Good idea, given that from_dummies will be added to this file as well - do you think the name encoding.py implies that the file holds the functions to decode the encodings (In the sense of "all encoding related stuff")?

Yeah that's what I was thinking

I like this name and applied changes accordingly

@jreback jreback added this to the 1.5 milestone Jan 19, 2022
@jreback
Copy link
Contributor

jreback commented Jan 19, 2022

pandas/core/reshape/encoding.py:236: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[signedinteger[Any]]]", variable has type "Index") [assignment]
pandas/core/reshape/encoding.py:246: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "Index") [assignment]

are failing in the typing checks.

@pckSF
Copy link
Contributor Author

pckSF commented Jan 20, 2022

pandas/core/reshape/encoding.py:236: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[signedinteger[Any]]]", variable has type "Index") [assignment]
pandas/core/reshape/encoding.py:246: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "Index") [assignment]

are failing in the typing checks.

Jep, currently investigating this because for some reason I do not get that mypy error on my end - I have merged everything from upstream/main and updated the environment but I do not get any errors on pandas/core/reshape/encoding.py.

@jreback
Copy link
Contributor

jreback commented Jan 28, 2022

sorry you need to merge upstream/master again

@pckSF
Copy link
Contributor Author

pckSF commented Jan 28, 2022

sorry you need to merge upstream/master again

Oh true, I was a little bit overhasty - but I hope mypy should be happy now.

@pep8speaks
Copy link

pep8speaks commented Jan 28, 2022

Hello @pckSF! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-01-28 15:46:02 UTC

@pckSF
Copy link
Contributor Author

pckSF commented Jan 28, 2022

Okay looks like I made the CI even less happy with the last commit - I will sort it out this afternoon

@pckSF
Copy link
Contributor Author

pckSF commented Jan 28, 2022

Okay looks like I made the CI even less happy with the last commit - I will sort it out this afternoon

The problem was that I missed some changes in get_dummies on main due to the entire function being the diff -> things broke. Should work again.

@jreback jreback merged commit 32d3412 into pandas-dev:main Jan 29, 2022
@jreback
Copy link
Contributor

jreback commented Jan 29, 2022

thanks @pckSF

phofl pushed a commit to phofl/pandas that referenced this pull request Feb 14, 2022
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants