Skip to content

Task 04: Initial Exploration

This is a suggested solution. It is meant to help you out if you struggle with a certain aspect of the exercise. Your own solution may differ widely and can still be perfectly valid.

Statistics

Since the way to obtain the statistics is the same for all the columns we are interested in, we can do it in a convenient loop.

for topic in [LABEL_TEMP, LABEL_DEW, LABEL_RAIN_1H]:
    print(
        "Statistics on", topic, "…",
        "Min:", weather_data[topic].min(), 
        "Max:", weather_data[topic].max(), 
        "Mean:" weather_data[topic].mean()
    )

Hint

For a quick inspection, the describe()-method for DataFrames is also a good choice. Try it!

Calculating the Overall Rain

Since we have hourly reports it makes sense to add up the measurements in the last hour (instead of the 6-hour summaries that are also given).

print("Total precipitation measured:", weather_data[LABEL_RAIN_1H].sum())