Rain on Rainy Days
Start Timer
0:00:00
You’re given a dataframe df_rain
containing rainfall data. The dataframe has two columns: day of the week and rainfall in inches.
Write a function median_rainfall
to find the median amount of rainfall for the days on which it rained.
Note: You may assume it rained on at least one of the days.
Input:
import pandas as pd
rainfall = {"Day" : ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], "Inches" : [0, 1.2, 0, 0.8, 1]}
df_rain = pd.DataFrame(rainfall)
Output:
def median_rainfall(df_rain) -> 1
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments