I have a df column where its data are only categorical (e.g., [a, b, c, a, a, d, c, b, etc]). I want to plot the count of these data using plotly count bar (bar chart).
I have calculated the count of the data using df.groupby('<col_name>')['<col_name>'].count(), but this returns a series data structure so I will only have the count data (1-D).
How can I get the count result and the corresponding data item in the resulting output efficiently?
I want to get this output and plot the bar chart using Plotly:
import plotly.express as px
fig = px.bar(count_df, x="<col_name>", y="count", color="count", title="----------")
fig.show()
