I was trying to explore this dataset https://www.kaggle.com/datasets/thedevastator/analyzing-credit-card-spending-habits-in-india/code?datasetId=2731425&sortBy=voteCount and I want to create a stacked bar of the 4 countries with the highest spend I use this syntax
dfg = df.groupby(['City']).sum().sort_values(by='Amount', ascending = False).head(4).reset_index()
fig = px.histogram(dfg, x='City', y = 'Amount')
fig.show()
but I found it difficult to make it stacked, I tried using pivot but it ain't work too, any way to make this possible?