-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
fix: improve pivot post-processing #16289
Conversation
c737916
to
58a025f
Compare
Codecov Report
@@ Coverage Diff @@
## master #16289 +/- ##
==========================================
- Coverage 76.64% 76.53% -0.12%
==========================================
Files 997 997
Lines 53246 53264 +18
Branches 6777 6777
==========================================
- Hits 40808 40763 -45
- Misses 12208 12271 +63
Partials 230 230
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
] | ||
parts: List[Any] = list(label) | ||
metric = parts[-1] | ||
parts[-1] = metrics.index(metric) |
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.
would it be more or less pythonic to pop and then push instead?
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.
@betodealmeida walked me through this and it looks good. The tests are fantastic!
* fix: improve pivot post-processing * Add tests * Trim space from column name
🏷️ 2021.31 |
* fix: improve pivot post-processing * Add tests * Trim space from column name (cherry picked from commit ac8e54d)
@betodealmeida the new post processing seems to not export row headers when choosing the csv output? |
* fix: improve pivot post-processing * Add tests * Trim space from column name (cherry picked from commit ac8e54d)
I see this one is tagged to be included in v1.3, but it seems to me that the missing headers is quite crucial for a csv export? |
* fix: improve pivot post-processing * Add tests * Trim space from column name
* fix: improve pivot post-processing * Add tests * Trim space from column name
SUMMARY
This PR fixes many cases when applying the pivot table post-processing.
I reimplemented the algorithm from scratch to make sure it matches the JS logic, testing as many combinations as I could and comparing the Python results with the JS visualization.
For each of those cases I added a unit test showing the pivot. The resulting table in each of the unit tests matches the table from the visualization.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
N/A
ADDITIONAL INFORMATION