← All Python interview questions

Show each category as a percent of its city revenue

MediumPandas — GroupByNykaaTata CLiQ

The city dashboard shows revenue mix, not absolute revenue.

Write share(df) that returns a DataFrame with city, category and pct — each category's share of that city's total revenue as a percentage rounded to 1 decimal — sorted by city then descending share.

Practising alone only goes so far — our live cohorts pair Python and Pandas depth with dashboards, agentic analytics projects and mock interviews.

Explore the program