facebookresearch / hiplot

HiPlot makes understanding high dimensional data easy
https://facebookresearch.github.io/hiplot/
MIT License
2.75k stars 143 forks source link

Ordering the columns doesn't work in Streamlit #166

Closed F1nnM closed 3 years ago

F1nnM commented 3 years ago

I supply my data in a dataframe with the columns in a specific order. Behavior doesn't change, even if I supply the order with

exp.display_data(hip.Displays.PARALLEL_PLOT ).update({
    'order': list(data.columns)
})

V 0.1.22: The table shows the columns in exactly the dataframe order. The parallel plot however has some random° order.

V 0.1.23rc116 and V 0.1.23rc118 with the compress option The parallel plot has the same random° order, regardless of the supplied order. The table has as random°° order, but different from the parallel plot.

°The order is not random, but always the same for one dataset It's randomly different between datasets. It's mostly in order, but a couple of columns are wrong. °°The order is always the same, but it seems completely shuffled. No resemblance to the original order

Example, in case it helps and to showcase the weird orders: My columns are ordered this way: run_id, model, mean_*, std_*, param_* The order I get them in the parallel plot: mean_*, std_*, param_*, but run_id and model appear in random places depending on the dataset I load. Same column names -> same order.

Example 2: Columns: run_id, model, m_*, s_*, p_* The order in the parallel plot: run_id, model, and the rest shuffled in a order depending on the dataset I load. Same column names -> same order.

If I use the browser debugger, I can see that the component gets the correct order transmitted at least.

danthe3rd commented 3 years ago

In next version, it'll be possible to specify the default column order for the table plot as well. When importing a dataframe, it will use the columns order as default orders for the parallel plot and the table.

You can test it now with the RC version (I changed the API for streamlit tho, see the other issue):

pip install hiplot==0.1.23rc121
F1nnM commented 3 years ago

Thanks, yes, works perfectly!