Open psychemedia opened 6 years ago
I agree this would be nice, but there isn't really a nice one-to-one correspondence between PivotTable.js' output and pandas code, for example anything to do with graphics, and the various aggregators. Mimicking the state of the filter menus would also be a challenge to generate succint python code, unfortunately.
One of the things the pivot table gadget is good for is helping novices get a feel for reshaping a dataset and looking at the output from a particular transformation.
I would be really handy to be able to export he pandas equivalent code for a transformation so it could be applied directly to the pandas dataframe that feeds the pivot_table in the parent notebook.
I can think of one corollary to this - the jigsaw magic embeds an HTML blockly code editor and optionally allows the exporting of code equivalent to the program in the editor into a code cell created beneath the widget.
It would be handy if jupyter_pivottablejs could do something similar, by exporting pandas code equivalent to the transformation operation applied in the pivottable, if not the visualisation.