{ "cells": [ { "cell_type": "markdown", "id": "365d97a4", "metadata": {}, "source": [ "# Python Weather Analysis\n", "\n", "In this notebook, we will perform a basic weather data analysis using Python. We will:\n", "\n", "1. Load weather data from a CSV file using pandas.\n", "2. Visualize the first few rows of the table.\n", "3. Summarize the table and show the information of the dataframe.\n", "4. Compute the mean and maximum temperature from the data.\n", "5. Create a scatter plot of rain over the days using pandas plotting methods.\n", "6. Group the data by seasons and plot a boxplot of the rain data for the four seasons using seaborn.\n" ] }, { "cell_type": "markdown", "id": "e81015fe", "metadata": {}, "source": [ "## Disclaimer\n", "\n", "This code is generated by an AI model using the [bia-bob project](https://github.com/haesleinhuepf/bia-bob). It is good scientific practice to check the code and results it produces carefully." ] }, { "cell_type": "markdown", "id": "fc33c8f5", "metadata": {}, "source": [ "## Import Libraries\n", "\n", "First, we will import the necessary libraries for our analysis." ] }, { "cell_type": "code", "id": "acac3389", "metadata": { "ExecuteTime": { "end_time": "2024-05-29T09:42:01.790500Z", "start_time": "2024-05-29T09:42:01.788623Z" } }, "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns" ], "outputs": [], "execution_count": 1 }, { "cell_type": "markdown", "id": "39269d1f", "metadata": {}, "source": [ "## Load Weather Data\n", "\n", "We will load the weather data from a CSV file called `german_weather_2023.csv` using pandas." ] }, { "cell_type": "code", "id": "d78d3958", "metadata": { "ExecuteTime": { "end_time": "2024-05-29T09:42:01.794266Z", "start_time": "2024-05-29T09:42:01.791072Z" } }, "source": [ "df = pd.read_csv('german_weather_2023.csv')" ], "outputs": [], "execution_count": 2 }, { "cell_type": "markdown", "id": "87731337", "metadata": {}, "source": [ "## Visualize the Head of the Table\n", "\n", "Let's have a look at the first few rows of the dataframe to understand the structure of the data." ] }, { "cell_type": "code", "id": "ad70575f", "metadata": { "ExecuteTime": { "end_time": "2024-05-29T09:42:01.800719Z", "start_time": "2024-05-29T09:42:01.795605Z" } }, "source": [ "display(df.head())" ], "outputs": [ { "data": { "text/plain": [ " date temperature rain\n", "0 2023-01-01 -1.254599 14.507143\n", "1 2023-01-02 0.986585 6.560186\n", "2 2023-01-03 -4.419164 13.661761\n", "3 2023-01-04 2.080726 5.205845\n", "4 2023-01-05 3.324426 7.123391" ], "text/html": [ "
\n", " | date | \n", "temperature | \n", "rain | \n", "
---|---|---|---|
0 | \n", "2023-01-01 | \n", "-1.254599 | \n", "14.507143 | \n", "
1 | \n", "2023-01-02 | \n", "0.986585 | \n", "6.560186 | \n", "
2 | \n", "2023-01-03 | \n", "-4.419164 | \n", "13.661761 | \n", "
3 | \n", "2023-01-04 | \n", "2.080726 | \n", "5.205845 | \n", "
4 | \n", "2023-01-05 | \n", "3.324426 | \n", "7.123391 | \n", "