Is there a way to create a funnel plot in Python using Pandas? The documentation does not seem to have something relevant.
3 Answers
Better late than never. With plotly you can perform funnels. Here is a simple example
The best solution I found so far is to use matplotlib library along with pandas to create segmented horizontal bar chart. You will need to add one dummy category in order to shift categories to centre. Detailed explanation can be found here.
There's another solution if you want to use the non-segmented bar chart you can create the function, more details can be found here.
#I am new to Python; I figured it out, did the code below, and it worked. #Doing a simple funnel plot with data from a csv file import pandas as pd import plotly.express as px df=pd.read_csv("C:\Users\User\Desktop\file_name.csv")# path and file df= df.sort_values('scores', ascending= False)# True or False for type of sorting print(df.head(5))# preview data fig = px.funnel(df['category_column'].values, df['column_with_float'].values,color='red') fig.show()