In a dataframe, columns A and B are categorical data, while columns X and Y is numerical and continuous. How can I use plotly to draw a parallel coordinates+categories plot such that the first two y-axis corresponding to A and B are categorical, and the latter two corresponding to X and Y are numerical?
For example, consider the following data:
df = pd.DataFrame({'A':['a','a','b','b'],
'B':['1','2','1','2'],
'X':[5.3,6.7,3.1,0.8],
'Y':[0.4,0.6,3.6,4.8]})
I tried plotly.express.parallel_categories. But this treats all numerical values as categories. On the other hand, plotly.express.parallel_coordinates omits categorical columns.
You can first convert categorical data to numerical data and then use the
plotly.express.parallel_coordinatesfunction to plot the graph.Because
plotly.express.parallel_coordinatesis mainly used to process numerical data, whileplotly.express.parallel_categoriesis used to process categorical data.Example: