-
Notifications
You must be signed in to change notification settings - Fork 171
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
[DEPR] deprecate pivot_wider
#1263
Conversation
🚀 Deployed on https://deploy-preview-1263--pyjanitor.netlify.app |
Codecov Report
@@ Coverage Diff @@
## dev #1263 +/- ##
===========================================
+ Coverage 87.15% 97.51% +10.36%
===========================================
Files 78 78
Lines 3705 3702 -3
===========================================
+ Hits 3229 3610 +381
+ Misses 476 92 -384 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* simplify logic * minor updates * changelog * fix userwarning on then function --------- Co-authored-by: Eric Ma <[email protected]>
* skeleton * partial implementation * minor edits * add comments * fix notebook * Update conditional_join.ipynb * add changelog * updates * update changelog * add more tests * shortcut for monotonic increasing groups * use 0/1 for counter check for monotonicity * fix test failure * [DEPR] deprecate `pivot_wider` (#1263) * simplify logic * minor updates * changelog * fix userwarning on then function --------- Co-authored-by: Eric Ma <[email protected]> * fix range count * remove irrelevant imports * fix test fail * Update CHANGELOG.md * Update CHANGELOG.md * fix test failure * remove caching * add force parameter * update docstrings * fix failing test * remove strict eq join check --------- Co-authored-by: samuel.oranyeli <[email protected]> Co-authored-by: Eric Ma <[email protected]>
Too bad you are deprecating pivot_wider. Seems like a better useful function. What is the most efficient way to use pivot to get the same outputs pivot_wider? Because by default you get multi-index which are very inconvenient |
Hi @fkgruber kindly share an example you have and I can show how to deal with it. There is also the collapse_levels function to handle multiindex. We would like to not duplicate existing pandas functions. Open to suggestions/feedback. Thanks |
Here is an example in R. Would love to see the equivalent in pyjanitor using non-deprecated functions
|
@fkgruber this is a similar approach in pandas
|
Thanks, With janitor and pivot_wider we could do:
And if pivot_wider would take of the index as dplyr does, then it would almost be the same number of lines as in R. Seems like pivot_wider is helpful by reducing extra coding |
Kindly share an example where rename_axis does not work. We could raise an issue with the pandas team. The Pandas pivot already does a great job and there is no need to repeat it; if there are edge cases it can be handled (happy to be proven wrong). Pandas does not have pivot_wider_spec or something close to it; pyjanitor has that. If you have any other scenario where pivot is not sufficient happy to work through it with you |
PR Description
Please describe the changes proposed in the pull request:
pivot_wider
in favor of pandas pivotpivot_longer
This PR relates to #1045 .
PR Checklist
Please ensure that you have done the following:
<your_username>
:dev
, but rather from<your_username>
:<feature-branch_name>
.AUTHORS.md
.CHANGELOG.md
under the latest version header (i.e. the one that is "on deck") describing the contribution.Automatic checks
There will be automatic checks run on the PR. These include:
Relevant Reviewers
Please tag maintainers to review.