Premium problem112. Cities Above the National Average

Medium Locked

listings has columns listing_id, city and market_price.

The national average is the mean of every listing, not the mean of the city averages. Return the cities whose own average price exceeds it, as a DataFrame with columns city and city_average, sorted by city_average descending then city, with the index renumbered from 0.

Input

   listing_id   city  market_price
0           1  Aspen         900.0
1           2  Aspen        1100.0
2           3  Dover         200.0
3           4  Dover         220.0
4           5   Erie         300.0

Output

    city  city_average
0  Aspen        1000.0

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)