{ "cells": [ { "cell_type": "markdown", "metadata": { "tags": [ "setup" ] }, "source": [ "(c) 2016 - present. Enplus Advisors, Inc." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "setup" ] }, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "pd.set_option('display.float_format', '{:,.1f}'.format)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "setup" ] }, "outputs": [], "source": [ "dat = pd.read_csv('data/weather-6m.csv')" ] }, { "cell_type": "markdown", "metadata": { "tags": [ "exercise" ] }, "source": [ "**Exercise:**\n", "\n", "Calculate the average `air_temp` by `month`." ] }, { "cell_type": "markdown", "metadata": { "tags": [ "exercise" ] }, "source": [ "**Exercise:**\n", "\n", "Compute summary statistics on `air_temp` and `dew_point` using \n", "the `describe` method." ] }, { "cell_type": "markdown", "metadata": { "tags": [ "exercise" ] }, "source": [ "**Exercise:**\n", "\n", "For January and February and 0 - 11 hours, calculate the average and standard deviation of `air_temp` grouping by month and hour of the day. Name your result columns `air_temp_mean` and `air_temp_sd`.\n", "\n", "Your result `DataFrame` should have 24 rows, the number of months (2) times the number of hours (12). \n", "\n", "$2 * 12 = 24$\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "tags": [ "exercise" ] }, "source": [ "**Exercise:**\n", "\n", "By month, calculate quantiles for `air_temp` using the quantiles defined in `breaks`. \n", "\n", "Hint: Use the `quantile` method defined on a `Series` (`pd.Series.quantile`).\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "exercise" ] }, "outputs": [], "source": [ "breaks = [0.01, 0.25, 0.5, 0.75, 0.99]" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" } }, "nbformat": 4, "nbformat_minor": 1 }