You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.
Is your feature request related to a problem? Please describe.
Pivoting is a common task in data processing. It is used when we want to calculate statistics of specific attributes.
Describe the solution you'd like
I've been looking to libraries capable of pivoting dataframes. Pandas, in my view, has a very complete implementation of the method.
Describe alternatives you've considered
This is a need I had at work. Since I could only find one library – AlaSQL – and with only a simple implementation, that does not pivot over multiple columns or allows pivoting without explicit index, I've written my own version of the function. To derive the algorithm, I replicated the behavior seen in the pivot_table function of Pandas.
Additional context
I have already written the function, and it works for a few test cases I listed:
✓ with one value, one index, and one column (130ms)
✓ without index, aggregates values only by columns (61ms)
✓ without columns, aggregates values only by columns (69ms)
✓ with multiple values, one index, and one column (67ms)
✓ with one value, one index, and multiple columns (97ms)
✓ with one value, multiple index, and one column (84ms)
✓ with one value, multiple index, and multiple columns (177ms)
My function is not integrated into dataframe-js, but it works on dataframes generated with dataframe-js. Would you be interested in bringing this feature in? If so, I may need some help on reviewing it to ensure it follows the conventions of the project – of source code and unit tests. I could open a WIP pull request and we discuss the necessary changes on the go.
Yes, I have look at them, but they don't seem to cover all the cases I needed and Pandas supports. There's always the chance they are too specific, so in this case, let me know and we can close this issue.
My major pain-point was doing operations with multiple attributes, either in index, columns, or the attribute to aggregate on.
Here are all the cases I implemented using dataframe-js and are supported by Pandas:
And here, my attempt to reproduce them using [email protected]. The only case that can be fully reproduced, at least with my understanding of the docs, is the first.
Is your feature request related to a problem? Please describe.
Pivoting is a common task in data processing. It is used when we want to calculate statistics of specific attributes.
From Pandas' documentation:
Describe the solution you'd like
I've been looking to libraries capable of pivoting dataframes. Pandas, in my view, has a very complete implementation of the method.
Describe alternatives you've considered
This is a need I had at work. Since I could only find one library – AlaSQL – and with only a simple implementation, that does not pivot over multiple columns or allows pivoting without explicit index, I've written my own version of the function. To derive the algorithm, I replicated the behavior seen in the
pivot_table
function of Pandas.Additional context
I have already written the function, and it works for a few test cases I listed:
My function is not integrated into dataframe-js, but it works on dataframes generated with dataframe-js. Would you be interested in bringing this feature in? If so, I may need some help on reviewing it to ensure it follows the conventions of the project – of source code and unit tests. I could open a WIP pull request and we discuss the necessary changes on the go.
The text was updated successfully, but these errors were encountered: