{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Time Series Visualizations\n", "\n", "This notebook demonstrates how to use Lets-Plot to investigate time series.\n", "\n", "The data is provided by [Kaggle](https://www.kaggle.com/sumanthvrao/daily-climate-time-series-data)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:43:39.774104Z", "iopub.status.busy": "2024-08-23T10:43:39.774024Z", "iopub.status.idle": "2024-08-23T10:43:40.096340Z", "shell.execute_reply": "2024-08-23T10:43:40.095883Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:43:40.098297Z", "iopub.status.busy": "2024-08-23T10:43:40.098132Z", "iopub.status.idle": "2024-08-23T10:43:40.100575Z", "shell.execute_reply": "2024-08-23T10:43:40.100300Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Preparation" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:43:40.114070Z", "iopub.status.busy": "2024-08-23T10:43:40.113987Z", "iopub.status.idle": "2024-08-23T10:43:40.548043Z", "shell.execute_reply": "2024-08-23T10:43:40.547523Z" } }, "outputs": [], "source": [ "df = pd.read_csv(\"https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/delhi_climate.csv\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:43:40.549766Z", "iopub.status.busy": "2024-08-23T10:43:40.549622Z", "iopub.status.idle": "2024-08-23T10:43:40.562731Z", "shell.execute_reply": "2024-08-23T10:43:40.562539Z" } }, "outputs": [], "source": [ "df = df.rename(columns={\"meantemp\": \"mean temperature\", \"wind_speed\": \"wind speed\"})\n", "df.date = pd.to_datetime(df.date)\n", "df[\"day\"] = df.date.dt.day\n", "df[\"month\"] = df.date.dt.month\n", "df[\"year\"] = df.date.dt.year\n", "df = df[df.year < 2017]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### General Information" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:43:40.563827Z", "iopub.status.busy": "2024-08-23T10:43:40.563752Z", "iopub.status.idle": "2024-08-23T10:43:40.607236Z", "shell.execute_reply": "2024-08-23T10:43:40.606909Z" } }, "outputs": [ { "data": { "text/html": [ " \n", " " ], "text/plain": [ "