17. Practice Exercises with Answer Hints
17.4 Reshape and EDA
Exercise G. Melt a city×month GMV wide table to long; find the max city-month.
Hint G
melt(id_vars="city", var_name="month", value_name="gmv") then long.loc[long["gmv"].idxmax()].
Exercise H. Crosstab city vs status with margins. Write one sentence finding.
Hint H
pd.crosstab(df["city"], df["status"], margins=True).