-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added Functionality ot Pivot_longer #176
Conversation
Codecov Report
@@ Coverage Diff @@
## master #176 +/- ##
==========================================
+ Coverage 76.59% 76.75% +0.15%
==========================================
Files 85 85
Lines 6439 6482 +43
==========================================
+ Hits 4932 4975 +43
Misses 1507 1507
Continue to review full report at Codecov.
|
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.
Awesome work so far! Made some minor comments about the index behavior of names_sep
and unittesting.
tests/test_pivot.py
Outdated
stang = data.df_stang_wide | ||
long = gr.tran_pivot_longer( | ||
stang, | ||
names_pattern="(E_|mu_)(\\d+)", |
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.
A good test to implement, but the pattern should be names_pattern="(E|mu)_(\\d+)"
.
self.assertTrue(result) | ||
|
||
|
||
def test_pivot_longer_names_sep_and_pattern(self): |
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.
Nice!
tests/test_pivot.py
Outdated
stang = data.df_stang_wide | ||
long = gr.tran_pivot_longer( | ||
stang, | ||
names_sep=-3, |
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.
The sep
argument in tran_separate()
is provided as a list; this is so one can specify multiple separation points for multiple into
entries. The names_sep
argument should provide similar functionality with names_to
; i.e. one should be able to provide arguments where len(names_to) - 1 == len(names_sep)
.
-Fixed test case for pivot_longer, line203 -Positional names_sep now takes a list of x length -CodeCov hit fixed
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.
Small edits to rm experimental code, but overall looks good!
grama/tran_pivot.py
Outdated
return longer | ||
|
||
|
||
def position_split(names, names_sep): |
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.
Maybe outdated code?
stang = data.df_stang_wide | ||
long = gr.tran_pivot_longer( | ||
stang, | ||
columns = gr.matches("\\d+"), |
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.
LOVE IT
stang = data.df_stang_wide | ||
long = gr.tran_pivot_longer( | ||
stang, | ||
names_pattern="(E|mu)_(\\d+)", |
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.
AMAZING
Changes: