Skip to content

Task 05: Advanced 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.

Maximum Temperature Differences

To solve this task, we basically need a new data frame with the differences between each of our rows of data. Pandas offers the diff()-method for this exact purpose. Besides the max() and min()-methods, there is also the idxmax() and idxmin()-method, that returns the index (in our case the date and hour) of the extreme values.

temperature_differences = weather_data[LABEL_TEMP].diff()

    "Largest temperature rise on", temperature_differences.idxmax(),
    "with" temperature_differences.max(), "K"

    "Largest temperature drop on", temperature_differences.idxmin(),
    "with" temperature_differences.min(), "K"