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
Thanks! This bug arises from JavaScript's built-in key ordering semantics for objects (integers always come first), which Arquero uses currently but of course needs to circumvent. I'm aware of the issue (I bumped into it more or less the same way you did!) and have started work on a fix.
I love
pivot
andfold
fonctions in Arquero, they are so powerful !I just ran into few small difficulties.
Here is a use case:
t = aq.table({x:['01','01','01','02','02','02'], y:['1','2','3','1','2','3'], z:[123,256,854, 652,734,222]})
I pivot that table:
t.groupby(0).pivot(1,2)
The problem is that
x
is now located on the right, i'd like it to stay in the first position.I am trying all these variants, but in vain,
x
doesn't want to move ;)Maybe i am missing something there. Of course i can write a select.
The fact that new column names are not by default prefixed probably does not help.
My humble suggestions would be:
pivot
, make the groupby columns appear at firstprefix
option inpivot
(andfold
as well)For instance:
p = t.groupby(0).pivot(1,2, {prefix:'age_'})
could produce:
and conversely:
p.fold(aq.range(1,3),{as:['y','z'], prefix:'age_'})
would take me back to the original table.
For the moment i use for
pivot
something like:p = t.groupby(0).pivot({ d: d => 'age_' + d.y },2, {prefix:'age_'})
But after a
fold
i have to write something like this this, which i find not very elegant:.derive({y: d => op.substring(d.y,4)})
cf. for inspiration (and old habits):
https://tidyr.tidyverse.org/reference/pivot_longer.html (aka fold) and names_prefix option
https://tidyr.tidyverse.org/reference/pivot_wider.html (aka pivot) and names_prefix option
The text was updated successfully, but these errors were encountered: