Last active
June 13, 2022 03:58
-
-
Save taruma/aca7f90c8fbb0034587809883d0d9e92 to your computer and use it in GitHub Desktop.
taruma_hk98_rekap_deret_waktu.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "taruma_hk98_rekap_deret_waktu.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/taruma/aca7f90c8fbb0034587809883d0d9e92/taruma_hk98_rekap_deret_waktu.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "MaSOFhUSmz8A" | |
}, | |
"source": [ | |
"Berdasarkan isu [#98](https://github.com/taruma/hidrokit/issues/98): **buat ringkasan/rekap data deret waktu**\n", | |
"\n", | |
"Deskripsi permasalahan: \n", | |
"- Membuat ringkasan/rekapitulasi/laporan dari data deret waktu (_time series_).\n", | |
"\n", | |
"Strategi Penyelesaian:\n", | |
"- Membuat fungsi yang memudahkan kostumisasi saat menggunakan fungsi buatan sendiri.\n", | |
"\n", | |
"Catatan:\n", | |
"- Fungsi ini hanya diuji pada data harian dengan kepentingan merekapitulasi setiap bulannya." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "cXNT0CMkn-Bf" | |
}, | |
"source": [ | |
"# PERSIAPAN DAN DATASET" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "GaXYLfvUmO5m" | |
}, | |
"source": [ | |
"import numpy as np\n", | |
"import pandas as pd" | |
], | |
"execution_count": 48, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "2nnPlg4toC6M", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "7a0ac7a9-f5b5-4913-db9b-6dcca917871b" | |
}, | |
"source": [ | |
"try:\n", | |
" import hidrokit\n", | |
"except ModuleNotFoundError:\n", | |
" !pip install git+https://github.com/taruma/hidrokit.git@latest -q\n", | |
" import hidrokit\n", | |
"\n", | |
"print(f'hidrokit version: {hidrokit.__version__}')" | |
], | |
"execution_count": 49, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"hidrokit version: 0.4.1\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "yZOlKYgwsGzs" | |
}, | |
"source": [ | |
"!wget -O sample.xlsx \"https://taruma.github.io/assets/hidrokit_dataset/data_daily_sample.xlsx\" -q\n", | |
"dataset_path = 'sample.xlsx'" | |
], | |
"execution_count": 50, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "j6zB5QFetQLs", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 397 | |
}, | |
"outputId": "c81495e0-7db4-496d-ff12-1e4278a158ee" | |
}, | |
"source": [ | |
"from hidrokit.contrib.taruma import hk88\n", | |
"\n", | |
"_data = hk88.read_workbook(dataset_path, ['STA_A', 'STA_B', 'STA_C'])\n", | |
"dataset = _data.infer_objects()\n", | |
"dataset.info()\n", | |
"dataset.head()" | |
], | |
"execution_count": 51, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"<class 'pandas.core.frame.DataFrame'>\n", | |
"DatetimeIndex: 5478 entries, 2001-01-01 to 2015-12-31\n", | |
"Freq: D\n", | |
"Data columns (total 3 columns):\n", | |
" # Column Non-Null Count Dtype \n", | |
"--- ------ -------------- ----- \n", | |
" 0 STA_A 5477 non-null float64\n", | |
" 1 STA_B 5470 non-null float64\n", | |
" 2 STA_C 5475 non-null float64\n", | |
"dtypes: float64(3)\n", | |
"memory usage: 171.2 KB\n" | |
] | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" STA_A STA_B STA_C\n", | |
"2001-01-01 0.0 0.0 0.00\n", | |
"2001-01-02 0.0 0.0 0.65\n", | |
"2001-01-03 0.0 45.0 9.16\n", | |
"2001-01-04 0.0 0.0 0.00\n", | |
"2001-01-05 0.0 5.0 1.03" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-a3d8b11d-f70c-4b1c-abbd-7a9d085101e9\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>STA_A</th>\n", | |
" <th>STA_B</th>\n", | |
" <th>STA_C</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2001-01-01</th>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.00</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-02</th>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.65</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-03</th>\n", | |
" <td>0.0</td>\n", | |
" <td>45.0</td>\n", | |
" <td>9.16</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-04</th>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.00</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-05</th>\n", | |
" <td>0.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>1.03</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-a3d8b11d-f70c-4b1c-abbd-7a9d085101e9')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-a3d8b11d-f70c-4b1c-abbd-7a9d085101e9 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-a3d8b11d-f70c-4b1c-abbd-7a9d085101e9');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 51 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "UQU1Nv0moBT5" | |
}, | |
"source": [ | |
"# KODE" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "_OZbv2sDrrQk" | |
}, | |
"source": [ | |
"def summary_station(dataset, column, ufunc, ufunc_col, n_days='MS'):\n", | |
" grouped = [dataset.index.year, dataset.index.month]\n", | |
"\n", | |
" ufunc = ufunc if isinstance(ufunc, (list, tuple)) else (ufunc,)\n", | |
" ufunc_col = (ufunc_col\n", | |
" if isinstance(ufunc_col, (list, tuple)) else (ufunc_col,))\n", | |
"\n", | |
" if len(ufunc) != len(ufunc_col):\n", | |
" raise ValueError('length ufunc and ufunc_col are not matched.')\n", | |
"\n", | |
" if n_days.endswith(\"D\") or n_days.endswith(\"MS\") or n_days.endswith(\"M\"):\n", | |
" ix_month = []\n", | |
" val_month = []\n", | |
" for _, x in dataset[column].groupby(by=grouped):\n", | |
" each_month = x.groupby(pd.Grouper(freq=n_days)).agg(ufunc)\n", | |
" val_month.append(each_month.values)\n", | |
" ix_month.append(each_month.index.to_numpy())\n", | |
" return pd.DataFrame(\n", | |
" data=np.vstack(val_month),\n", | |
" index=np.hstack(ix_month),\n", | |
" columns=pd.MultiIndex.from_product([[column], ufunc_col]),\n", | |
" ).rename_axis(\"DATE\")\n", | |
" else:\n", | |
" summary = dataset[[column]].resample(n_days).agg(ufunc)\n", | |
" summary.columns = pd.MultiIndex.from_product([[column], ufunc_col])\n", | |
" return summary\n", | |
"\n", | |
"def summary_all(dataset, ufunc, ufunc_col, columns=None, n_days='MS', verbose=False):\n", | |
" res = []\n", | |
"\n", | |
" columns = columns if columns is not None else list(dataset.columns)\n", | |
" columns = columns if isinstance(columns, (list, tuple)) else [columns]\n", | |
"\n", | |
" for column in columns:\n", | |
" if verbose:\n", | |
" print('PROCESSING:', column)\n", | |
" res.append(\n", | |
" summary_station(dataset, column, ufunc, ufunc_col, n_days=n_days)\n", | |
" )\n", | |
" return pd.concat(res, axis=1)" | |
], | |
"execution_count": 52, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "ck-RQB5kWcJB" | |
}, | |
"source": [ | |
"# FUNGSI" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "l6DX4sTkbQ14" | |
}, | |
"source": [ | |
"## Fungsi `summary_station()`\n", | |
"\n", | |
"Fungsi ini membuat rekap untuk stasiun/kolom tunggal dalam bentuk keluaran `pandas.DataFrame`. Argumen yang dibutuhkan antara lain:\n", | |
"\n", | |
"- `dataset`: DataFrame dataset. Isian berupa `pandas.DataFrame`. \n", | |
"- `column`: kolom tunggal yang akan diproses. Isian berupa _string_.\n", | |
"- `ufunc`: fungsi atau _list_ fungsi yang akan digunakan. Isian berupa `object` atau _list of `object`_.\n", | |
"- `ufunc_col`: nama atau _list_ nama dari fungsi `ufunc`. Isian berupa _list of string_.\n", | |
"- `n_days='M'`: indikator jumlah hari/bulan yang diproses. Isian merupakan isian valid untuk parameter `freq` pada objek `pd.Grouper` ([referensi](https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases)). Isian `'M'` berarti setiap bulan (*M*onth), isian `'9D'` berarti setiap 9 hari (*D*ays). " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "Bn5O9OEDenXj" | |
}, | |
"source": [ | |
"### Argumen `ufunc` dan `ufunc_col`\n", | |
"\n", | |
"Pengguna diberi kebebasan dalam melakukan perhitungan pada fungsi `summary_station`. Dalam _notebook_ ini akan diberikan contoh menggunakan fungsi yang tersedia pada python, numpy, dan membuatnya sendiri." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "LMu8A0I0Wdpp" | |
}, | |
"source": [ | |
"# Fungsi buatan sendiri\n", | |
"def n_rain(x):\n", | |
" \"Jumlah hari hujan\"\n", | |
" return (x > 0).sum()\n", | |
"\n", | |
"myfunc = [np.sum, n_rain, len]\n", | |
"myfunc_col = ['sum', 'n_rain', 'n_days']" | |
], | |
"execution_count": 53, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "BOaPl7t8ffQo" | |
}, | |
"source": [ | |
"### Penggunaan (_default_)\n", | |
"\n", | |
"Jika tidak diberi argumen `n_days` maka fungsi ini akan memproses data setiap bulan." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "9Mw-SjOKWdVy", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 486 | |
}, | |
"outputId": "5744fed1-1a2d-40a3-f469-b121e0e9ad7a" | |
}, | |
"source": [ | |
"summary_station(\n", | |
" dataset=dataset, column='STA_B', \n", | |
" ufunc=myfunc, ufunc_col=myfunc_col)" | |
], | |
"execution_count": 54, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" STA_B \n", | |
" sum n_rain n_days\n", | |
"DATE \n", | |
"2001-01-01 454.0 18.0 31.0\n", | |
"2001-02-01 298.0 12.0 28.0\n", | |
"2001-03-01 475.0 18.0 31.0\n", | |
"2001-04-01 272.0 12.0 30.0\n", | |
"2001-05-01 86.0 4.0 31.0\n", | |
"... ... ... ...\n", | |
"2015-08-01 0.0 0.0 31.0\n", | |
"2015-09-01 0.0 0.0 30.0\n", | |
"2015-10-01 14.0 1.0 31.0\n", | |
"2015-11-01 165.0 3.0 30.0\n", | |
"2015-12-01 216.0 11.0 31.0\n", | |
"\n", | |
"[180 rows x 3 columns]" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-b42ce8c5-10a7-4e44-9fa7-441d4cb480a3\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr th {\n", | |
" text-align: left;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr:last-of-type th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th colspan=\"3\" halign=\"left\">STA_B</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th>sum</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_days</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>DATE</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2001-01-01</th>\n", | |
" <td>454.0</td>\n", | |
" <td>18.0</td>\n", | |
" <td>31.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-02-01</th>\n", | |
" <td>298.0</td>\n", | |
" <td>12.0</td>\n", | |
" <td>28.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-03-01</th>\n", | |
" <td>475.0</td>\n", | |
" <td>18.0</td>\n", | |
" <td>31.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-04-01</th>\n", | |
" <td>272.0</td>\n", | |
" <td>12.0</td>\n", | |
" <td>30.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-05-01</th>\n", | |
" <td>86.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>31.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-08-01</th>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>31.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-09-01</th>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>30.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-10-01</th>\n", | |
" <td>14.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>31.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-11-01</th>\n", | |
" <td>165.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>30.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-01</th>\n", | |
" <td>216.0</td>\n", | |
" <td>11.0</td>\n", | |
" <td>31.0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>180 rows × 3 columns</p>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-b42ce8c5-10a7-4e44-9fa7-441d4cb480a3')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-b42ce8c5-10a7-4e44-9fa7-441d4cb480a3 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-b42ce8c5-10a7-4e44-9fa7-441d4cb480a3');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 54 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "29sA49LffqAU" | |
}, | |
"source": [ | |
"### Argumen `n_days`\n", | |
"\n", | |
"`n_days` bisa diisi dengan jumlah hari yang ingin diproses **setiap bulan**-nya. " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "zaP9x1g7gCkc", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 486 | |
}, | |
"outputId": "5cb09ebf-3319-4779-9f48-8c065c2a2b62" | |
}, | |
"source": [ | |
"# Setiap 8 Hari\n", | |
"summary_station(\n", | |
" dataset=dataset, column='STA_B', \n", | |
" ufunc=myfunc, ufunc_col=myfunc_col,\n", | |
" n_days='8D')" | |
], | |
"execution_count": 55, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" STA_B \n", | |
" sum n_rain n_days\n", | |
"DATE \n", | |
"2001-01-01 90.0 4.0 8.0\n", | |
"2001-01-09 123.0 5.0 8.0\n", | |
"2001-01-17 192.0 6.0 8.0\n", | |
"2001-01-25 49.0 3.0 7.0\n", | |
"2001-02-01 129.0 5.0 8.0\n", | |
"... ... ... ...\n", | |
"2015-11-25 48.0 1.0 6.0\n", | |
"2015-12-01 78.0 2.0 8.0\n", | |
"2015-12-09 48.0 4.0 8.0\n", | |
"2015-12-17 52.0 3.0 8.0\n", | |
"2015-12-25 38.0 2.0 7.0\n", | |
"\n", | |
"[720 rows x 3 columns]" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-ab4c563a-cd52-4e67-a62a-74dee7ff0b96\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr th {\n", | |
" text-align: left;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr:last-of-type th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th colspan=\"3\" halign=\"left\">STA_B</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th>sum</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_days</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>DATE</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2001-01-01</th>\n", | |
" <td>90.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>8.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-09</th>\n", | |
" <td>123.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>8.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-17</th>\n", | |
" <td>192.0</td>\n", | |
" <td>6.0</td>\n", | |
" <td>8.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-25</th>\n", | |
" <td>49.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>7.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-02-01</th>\n", | |
" <td>129.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>8.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-11-25</th>\n", | |
" <td>48.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>6.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-01</th>\n", | |
" <td>78.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>8.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-09</th>\n", | |
" <td>48.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>8.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-17</th>\n", | |
" <td>52.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>8.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-25</th>\n", | |
" <td>38.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>7.0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>720 rows × 3 columns</p>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-ab4c563a-cd52-4e67-a62a-74dee7ff0b96')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-ab4c563a-cd52-4e67-a62a-74dee7ff0b96 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-ab4c563a-cd52-4e67-a62a-74dee7ff0b96');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 55 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "kN49MzTlgLVF", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 486 | |
}, | |
"outputId": "e3163078-5300-4108-81ff-26c2ac8dcb19" | |
}, | |
"source": [ | |
"# Setiap 15 Hari\n", | |
"summary_station(\n", | |
" dataset=dataset, column='STA_C', \n", | |
" ufunc=myfunc, ufunc_col=myfunc_col,\n", | |
" n_days='15D')" | |
], | |
"execution_count": 56, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" STA_C \n", | |
" sum n_rain n_days\n", | |
"DATE \n", | |
"2001-01-01 158.08 13.0 15.0\n", | |
"2001-01-16 146.94 14.0 15.0\n", | |
"2001-01-31 22.96 1.0 1.0\n", | |
"2001-02-01 157.80 12.0 15.0\n", | |
"2001-02-16 77.45 11.0 13.0\n", | |
"... ... ... ...\n", | |
"2015-11-01 152.00 7.0 15.0\n", | |
"2015-11-16 76.00 4.0 15.0\n", | |
"2015-12-01 23.00 1.0 15.0\n", | |
"2015-12-16 46.00 8.0 15.0\n", | |
"2015-12-31 0.00 0.0 1.0\n", | |
"\n", | |
"[465 rows x 3 columns]" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-b96d0f22-3fce-4825-8667-782497aec5e3\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr th {\n", | |
" text-align: left;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr:last-of-type th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th colspan=\"3\" halign=\"left\">STA_C</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th>sum</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_days</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>DATE</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2001-01-01</th>\n", | |
" <td>158.08</td>\n", | |
" <td>13.0</td>\n", | |
" <td>15.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-16</th>\n", | |
" <td>146.94</td>\n", | |
" <td>14.0</td>\n", | |
" <td>15.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-31</th>\n", | |
" <td>22.96</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-02-01</th>\n", | |
" <td>157.80</td>\n", | |
" <td>12.0</td>\n", | |
" <td>15.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-02-16</th>\n", | |
" <td>77.45</td>\n", | |
" <td>11.0</td>\n", | |
" <td>13.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-11-01</th>\n", | |
" <td>152.00</td>\n", | |
" <td>7.0</td>\n", | |
" <td>15.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-11-16</th>\n", | |
" <td>76.00</td>\n", | |
" <td>4.0</td>\n", | |
" <td>15.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-01</th>\n", | |
" <td>23.00</td>\n", | |
" <td>1.0</td>\n", | |
" <td>15.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-16</th>\n", | |
" <td>46.00</td>\n", | |
" <td>8.0</td>\n", | |
" <td>15.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-31</th>\n", | |
" <td>0.00</td>\n", | |
" <td>0.0</td>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>465 rows × 3 columns</p>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-b96d0f22-3fce-4825-8667-782497aec5e3')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-b96d0f22-3fce-4825-8667-782497aec5e3 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-b96d0f22-3fce-4825-8667-782497aec5e3');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 56 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "MqVw8aWIgiPm" | |
}, | |
"source": [ | |
"## Fungsi `summary_all()`\n", | |
"\n", | |
"Fungsi ini hanya melakukan proses `summary_station()` untuk seluruh kolom atau kolom tertentu yang diatur dengan argumen `columns`. Argumen `dataset`, `ufunc`, `ufunc_col`, `n_days='M'` sama dengan `summary_station()`, yang membedakan adalah argumen `columns`.\n", | |
"\n", | |
"Baru di versi `0.4.0` (isu [#115](https://github.com/hidrokit/hidrokit/issues/115)): Penambahan argumen `verbose` untuk menampilkan/tidak menampilkan tulisan `PROCESSING: ...`. Nilai default `False` (tidak ditampilkan). " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "OKewkFKUhoN-" | |
}, | |
"source": [ | |
"# Menggunakan fungsi yang lebih banyak\n", | |
"def n_rain(x):\n", | |
" \"Jumlah hari hujan\"\n", | |
" return (x > 0).sum()\n", | |
"\n", | |
"def n_dry(x):\n", | |
" \"Jumlah hari kering\"\n", | |
" return np.logical_or(x == 0, x.isna()).sum()\n", | |
"\n", | |
"myfunc_all = [len, n_rain, n_dry, np.sum, np.mean, np.std]\n", | |
"myfunc_all_col = ['n_days', 'n_rain', 'n_dry', 'SUM', 'MEAN', 'STD']" | |
], | |
"execution_count": 57, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "AgPAPhD7g9Hr" | |
}, | |
"source": [ | |
"### Seluruh kolom" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "WaUftKLovZ97", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 486 | |
}, | |
"outputId": "94c88af2-5674-488c-ed93-3e3fcd363361" | |
}, | |
"source": [ | |
"summary_all(\n", | |
" dataset=dataset,\n", | |
" ufunc=myfunc_all, ufunc_col=myfunc_all_col,\n", | |
" n_days='7D')" | |
], | |
"execution_count": 58, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" STA_A STA_B \\\n", | |
" n_days n_rain n_dry SUM MEAN STD n_days n_rain \n", | |
"DATE \n", | |
"2001-01-01 7.0 0.0 7.0 0.0 0.000000 0.000000 7.0 3.0 \n", | |
"2001-01-08 7.0 0.0 7.0 0.0 0.000000 0.000000 7.0 4.0 \n", | |
"2001-01-15 7.0 0.0 7.0 0.0 0.000000 0.000000 7.0 5.0 \n", | |
"2001-01-22 7.0 0.0 7.0 0.0 0.000000 0.000000 7.0 4.0 \n", | |
"2001-01-29 3.0 0.0 3.0 0.0 0.000000 0.000000 3.0 2.0 \n", | |
"... ... ... ... ... ... ... ... ... \n", | |
"2015-12-01 7.0 3.0 4.0 86.0 12.285714 25.408098 7.0 1.0 \n", | |
"2015-12-08 7.0 5.0 2.0 55.0 7.857143 12.266874 7.0 3.0 \n", | |
"2015-12-15 7.0 7.0 0.0 105.0 15.000000 11.503623 7.0 4.0 \n", | |
"2015-12-22 7.0 7.0 0.0 136.0 19.428571 12.053452 7.0 3.0 \n", | |
"2015-12-29 3.0 3.0 0.0 15.0 5.000000 2.000000 3.0 0.0 \n", | |
"\n", | |
" STA_C \\\n", | |
" n_dry SUM MEAN STD n_days n_rain n_dry SUM \n", | |
"DATE \n", | |
"2001-01-01 4.0 58.0 8.285714 16.499639 7.0 5.0 2.0 15.43 \n", | |
"2001-01-08 3.0 68.0 9.714286 13.300555 7.0 7.0 0.0 125.30 \n", | |
"2001-01-15 2.0 224.0 32.000000 37.434387 7.0 7.0 0.0 93.38 \n", | |
"2001-01-22 3.0 60.0 8.571429 10.906529 7.0 6.0 1.0 55.88 \n", | |
"2001-01-29 1.0 44.0 14.666667 13.650397 3.0 3.0 0.0 37.99 \n", | |
"... ... ... ... ... ... ... ... ... \n", | |
"2015-12-01 6.0 43.0 6.142857 16.252472 7.0 0.0 7.0 0.00 \n", | |
"2015-12-08 4.0 67.0 9.571429 13.513662 7.0 0.0 7.0 0.00 \n", | |
"2015-12-15 3.0 55.0 7.857143 9.118271 7.0 5.0 2.0 44.00 \n", | |
"2015-12-22 4.0 51.0 7.285714 11.954278 7.0 2.0 5.0 18.00 \n", | |
"2015-12-29 3.0 0.0 0.000000 0.000000 3.0 2.0 1.0 7.00 \n", | |
"\n", | |
" \n", | |
" MEAN STD \n", | |
"DATE \n", | |
"2001-01-01 2.204286 3.384252 \n", | |
"2001-01-08 17.900000 32.992996 \n", | |
"2001-01-15 13.340000 12.806884 \n", | |
"2001-01-22 7.982857 5.429001 \n", | |
"2001-01-29 12.663333 11.376741 \n", | |
"... ... ... \n", | |
"2015-12-01 0.000000 0.000000 \n", | |
"2015-12-08 0.000000 0.000000 \n", | |
"2015-12-15 6.285714 8.220184 \n", | |
"2015-12-22 2.571429 5.255383 \n", | |
"2015-12-29 2.333333 3.214550 \n", | |
"\n", | |
"[888 rows x 18 columns]" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-7d4edf7b-9406-4b2d-bee6-668aec8ee31e\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr th {\n", | |
" text-align: left;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr:last-of-type th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th colspan=\"6\" halign=\"left\">STA_A</th>\n", | |
" <th colspan=\"6\" halign=\"left\">STA_B</th>\n", | |
" <th colspan=\"6\" halign=\"left\">STA_C</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th>n_days</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_dry</th>\n", | |
" <th>SUM</th>\n", | |
" <th>MEAN</th>\n", | |
" <th>STD</th>\n", | |
" <th>n_days</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_dry</th>\n", | |
" <th>SUM</th>\n", | |
" <th>MEAN</th>\n", | |
" <th>STD</th>\n", | |
" <th>n_days</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_dry</th>\n", | |
" <th>SUM</th>\n", | |
" <th>MEAN</th>\n", | |
" <th>STD</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>DATE</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2001-01-01</th>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>7.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>58.0</td>\n", | |
" <td>8.285714</td>\n", | |
" <td>16.499639</td>\n", | |
" <td>7.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>15.43</td>\n", | |
" <td>2.204286</td>\n", | |
" <td>3.384252</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-08</th>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>7.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>68.0</td>\n", | |
" <td>9.714286</td>\n", | |
" <td>13.300555</td>\n", | |
" <td>7.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>125.30</td>\n", | |
" <td>17.900000</td>\n", | |
" <td>32.992996</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-15</th>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>7.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>224.0</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>37.434387</td>\n", | |
" <td>7.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>93.38</td>\n", | |
" <td>13.340000</td>\n", | |
" <td>12.806884</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-22</th>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>7.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>60.0</td>\n", | |
" <td>8.571429</td>\n", | |
" <td>10.906529</td>\n", | |
" <td>7.0</td>\n", | |
" <td>6.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>55.88</td>\n", | |
" <td>7.982857</td>\n", | |
" <td>5.429001</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-29</th>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>3.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>44.0</td>\n", | |
" <td>14.666667</td>\n", | |
" <td>13.650397</td>\n", | |
" <td>3.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>37.99</td>\n", | |
" <td>12.663333</td>\n", | |
" <td>11.376741</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-01</th>\n", | |
" <td>7.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>86.0</td>\n", | |
" <td>12.285714</td>\n", | |
" <td>25.408098</td>\n", | |
" <td>7.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>6.0</td>\n", | |
" <td>43.0</td>\n", | |
" <td>6.142857</td>\n", | |
" <td>16.252472</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.00</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-08</th>\n", | |
" <td>7.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>55.0</td>\n", | |
" <td>7.857143</td>\n", | |
" <td>12.266874</td>\n", | |
" <td>7.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>67.0</td>\n", | |
" <td>9.571429</td>\n", | |
" <td>13.513662</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.00</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-15</th>\n", | |
" <td>7.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>105.0</td>\n", | |
" <td>15.000000</td>\n", | |
" <td>11.503623</td>\n", | |
" <td>7.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>55.0</td>\n", | |
" <td>7.857143</td>\n", | |
" <td>9.118271</td>\n", | |
" <td>7.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>44.00</td>\n", | |
" <td>6.285714</td>\n", | |
" <td>8.220184</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-22</th>\n", | |
" <td>7.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>136.0</td>\n", | |
" <td>19.428571</td>\n", | |
" <td>12.053452</td>\n", | |
" <td>7.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>51.0</td>\n", | |
" <td>7.285714</td>\n", | |
" <td>11.954278</td>\n", | |
" <td>7.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>18.00</td>\n", | |
" <td>2.571429</td>\n", | |
" <td>5.255383</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-29</th>\n", | |
" <td>3.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>15.0</td>\n", | |
" <td>5.000000</td>\n", | |
" <td>2.000000</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>3.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>7.00</td>\n", | |
" <td>2.333333</td>\n", | |
" <td>3.214550</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>888 rows × 18 columns</p>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7d4edf7b-9406-4b2d-bee6-668aec8ee31e')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-7d4edf7b-9406-4b2d-bee6-668aec8ee31e button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-7d4edf7b-9406-4b2d-bee6-668aec8ee31e');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 58 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "vvgo6Yg0hMyE" | |
}, | |
"source": [ | |
"### Kolom tertentu" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "iNipfDFMvfkR", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 486 | |
}, | |
"outputId": "ab115a07-8398-4701-8e49-6a751def39bb" | |
}, | |
"source": [ | |
"summary_all(\n", | |
" dataset=dataset, columns=['STA_A', 'STA_C'],\n", | |
" ufunc=myfunc_all, ufunc_col=myfunc_all_col,\n", | |
" n_days='16D')" | |
], | |
"execution_count": 59, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" STA_A STA_C \\\n", | |
" n_days n_rain n_dry SUM MEAN STD n_days n_rain \n", | |
"DATE \n", | |
"2001-01-01 16.0 0.0 16.0 0.0 0.000000 0.000000 16.0 14.0 \n", | |
"2001-01-17 15.0 0.0 15.0 0.0 0.000000 0.000000 15.0 14.0 \n", | |
"2001-02-01 16.0 0.0 16.0 0.0 0.000000 0.000000 16.0 13.0 \n", | |
"2001-02-17 12.0 0.0 12.0 0.0 0.000000 0.000000 12.0 10.0 \n", | |
"2001-03-01 16.0 0.0 16.0 0.0 0.000000 0.000000 16.0 14.0 \n", | |
"... ... ... ... ... ... ... ... ... \n", | |
"2015-10-17 15.0 9.0 6.0 97.0 6.466667 9.500877 15.0 1.0 \n", | |
"2015-11-01 16.0 12.0 4.0 190.0 11.875000 14.655488 16.0 7.0 \n", | |
"2015-11-17 14.0 13.0 1.0 384.0 27.428571 15.360861 14.0 4.0 \n", | |
"2015-12-01 16.0 10.0 6.0 197.0 12.312500 19.269038 16.0 1.0 \n", | |
"2015-12-17 15.0 15.0 0.0 200.0 13.333333 10.587504 15.0 8.0 \n", | |
"\n", | |
" \n", | |
" n_dry SUM MEAN STD \n", | |
"DATE \n", | |
"2001-01-01 2.0 185.80 11.612500 22.786906 \n", | |
"2001-01-17 1.0 142.18 9.478667 9.163421 \n", | |
"2001-02-01 3.0 157.81 9.863125 15.319503 \n", | |
"2001-02-17 2.0 77.44 6.453333 7.835151 \n", | |
"2001-03-01 2.0 9.01 0.563125 0.719228 \n", | |
"... ... ... ... ... \n", | |
"2015-10-17 14.0 6.00 0.400000 1.549193 \n", | |
"2015-11-01 9.0 152.00 9.500000 19.721393 \n", | |
"2015-11-17 10.0 76.00 5.428571 13.119066 \n", | |
"2015-12-01 15.0 23.00 1.437500 5.750000 \n", | |
"2015-12-17 7.0 46.00 3.066667 4.317186 \n", | |
"\n", | |
"[360 rows x 12 columns]" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-d9baac2a-68fe-44cd-975c-49beff58d931\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr th {\n", | |
" text-align: left;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr:last-of-type th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th colspan=\"6\" halign=\"left\">STA_A</th>\n", | |
" <th colspan=\"6\" halign=\"left\">STA_C</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th>n_days</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_dry</th>\n", | |
" <th>SUM</th>\n", | |
" <th>MEAN</th>\n", | |
" <th>STD</th>\n", | |
" <th>n_days</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_dry</th>\n", | |
" <th>SUM</th>\n", | |
" <th>MEAN</th>\n", | |
" <th>STD</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>DATE</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2001-01-01</th>\n", | |
" <td>16.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>16.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>16.0</td>\n", | |
" <td>14.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>185.80</td>\n", | |
" <td>11.612500</td>\n", | |
" <td>22.786906</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-17</th>\n", | |
" <td>15.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>15.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>15.0</td>\n", | |
" <td>14.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>142.18</td>\n", | |
" <td>9.478667</td>\n", | |
" <td>9.163421</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-02-01</th>\n", | |
" <td>16.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>16.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>16.0</td>\n", | |
" <td>13.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>157.81</td>\n", | |
" <td>9.863125</td>\n", | |
" <td>15.319503</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-02-17</th>\n", | |
" <td>12.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>12.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>12.0</td>\n", | |
" <td>10.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>77.44</td>\n", | |
" <td>6.453333</td>\n", | |
" <td>7.835151</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-03-01</th>\n", | |
" <td>16.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>16.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>16.0</td>\n", | |
" <td>14.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>9.01</td>\n", | |
" <td>0.563125</td>\n", | |
" <td>0.719228</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-10-17</th>\n", | |
" <td>15.0</td>\n", | |
" <td>9.0</td>\n", | |
" <td>6.0</td>\n", | |
" <td>97.0</td>\n", | |
" <td>6.466667</td>\n", | |
" <td>9.500877</td>\n", | |
" <td>15.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>14.0</td>\n", | |
" <td>6.00</td>\n", | |
" <td>0.400000</td>\n", | |
" <td>1.549193</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-11-01</th>\n", | |
" <td>16.0</td>\n", | |
" <td>12.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>190.0</td>\n", | |
" <td>11.875000</td>\n", | |
" <td>14.655488</td>\n", | |
" <td>16.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>9.0</td>\n", | |
" <td>152.00</td>\n", | |
" <td>9.500000</td>\n", | |
" <td>19.721393</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-11-17</th>\n", | |
" <td>14.0</td>\n", | |
" <td>13.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>384.0</td>\n", | |
" <td>27.428571</td>\n", | |
" <td>15.360861</td>\n", | |
" <td>14.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>10.0</td>\n", | |
" <td>76.00</td>\n", | |
" <td>5.428571</td>\n", | |
" <td>13.119066</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-01</th>\n", | |
" <td>16.0</td>\n", | |
" <td>10.0</td>\n", | |
" <td>6.0</td>\n", | |
" <td>197.0</td>\n", | |
" <td>12.312500</td>\n", | |
" <td>19.269038</td>\n", | |
" <td>16.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>15.0</td>\n", | |
" <td>23.00</td>\n", | |
" <td>1.437500</td>\n", | |
" <td>5.750000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-17</th>\n", | |
" <td>15.0</td>\n", | |
" <td>15.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>200.0</td>\n", | |
" <td>13.333333</td>\n", | |
" <td>10.587504</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>46.00</td>\n", | |
" <td>3.066667</td>\n", | |
" <td>4.317186</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>360 rows × 12 columns</p>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d9baac2a-68fe-44cd-975c-49beff58d931')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-d9baac2a-68fe-44cd-975c-49beff58d931 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-d9baac2a-68fe-44cd-975c-49beff58d931');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 59 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"### Penggunaan Verbose" | |
], | |
"metadata": { | |
"id": "yjWynoCFs550" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"summary_all(\n", | |
" dataset=dataset,\n", | |
" ufunc=myfunc_all, ufunc_col=myfunc_all_col,\n", | |
" n_days='7D', verbose=True)" | |
], | |
"metadata": { | |
"id": "QBWtlbbes-x4", | |
"outputId": "2497de33-6c2f-4ab9-d05a-11f9bf4c92bc", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 538 | |
} | |
}, | |
"execution_count": 60, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"PROCESSING: STA_A\n", | |
"PROCESSING: STA_B\n", | |
"PROCESSING: STA_C\n" | |
] | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" STA_A STA_B \\\n", | |
" n_days n_rain n_dry SUM MEAN STD n_days n_rain \n", | |
"DATE \n", | |
"2001-01-01 7.0 0.0 7.0 0.0 0.000000 0.000000 7.0 3.0 \n", | |
"2001-01-08 7.0 0.0 7.0 0.0 0.000000 0.000000 7.0 4.0 \n", | |
"2001-01-15 7.0 0.0 7.0 0.0 0.000000 0.000000 7.0 5.0 \n", | |
"2001-01-22 7.0 0.0 7.0 0.0 0.000000 0.000000 7.0 4.0 \n", | |
"2001-01-29 3.0 0.0 3.0 0.0 0.000000 0.000000 3.0 2.0 \n", | |
"... ... ... ... ... ... ... ... ... \n", | |
"2015-12-01 7.0 3.0 4.0 86.0 12.285714 25.408098 7.0 1.0 \n", | |
"2015-12-08 7.0 5.0 2.0 55.0 7.857143 12.266874 7.0 3.0 \n", | |
"2015-12-15 7.0 7.0 0.0 105.0 15.000000 11.503623 7.0 4.0 \n", | |
"2015-12-22 7.0 7.0 0.0 136.0 19.428571 12.053452 7.0 3.0 \n", | |
"2015-12-29 3.0 3.0 0.0 15.0 5.000000 2.000000 3.0 0.0 \n", | |
"\n", | |
" STA_C \\\n", | |
" n_dry SUM MEAN STD n_days n_rain n_dry SUM \n", | |
"DATE \n", | |
"2001-01-01 4.0 58.0 8.285714 16.499639 7.0 5.0 2.0 15.43 \n", | |
"2001-01-08 3.0 68.0 9.714286 13.300555 7.0 7.0 0.0 125.30 \n", | |
"2001-01-15 2.0 224.0 32.000000 37.434387 7.0 7.0 0.0 93.38 \n", | |
"2001-01-22 3.0 60.0 8.571429 10.906529 7.0 6.0 1.0 55.88 \n", | |
"2001-01-29 1.0 44.0 14.666667 13.650397 3.0 3.0 0.0 37.99 \n", | |
"... ... ... ... ... ... ... ... ... \n", | |
"2015-12-01 6.0 43.0 6.142857 16.252472 7.0 0.0 7.0 0.00 \n", | |
"2015-12-08 4.0 67.0 9.571429 13.513662 7.0 0.0 7.0 0.00 \n", | |
"2015-12-15 3.0 55.0 7.857143 9.118271 7.0 5.0 2.0 44.00 \n", | |
"2015-12-22 4.0 51.0 7.285714 11.954278 7.0 2.0 5.0 18.00 \n", | |
"2015-12-29 3.0 0.0 0.000000 0.000000 3.0 2.0 1.0 7.00 \n", | |
"\n", | |
" \n", | |
" MEAN STD \n", | |
"DATE \n", | |
"2001-01-01 2.204286 3.384252 \n", | |
"2001-01-08 17.900000 32.992996 \n", | |
"2001-01-15 13.340000 12.806884 \n", | |
"2001-01-22 7.982857 5.429001 \n", | |
"2001-01-29 12.663333 11.376741 \n", | |
"... ... ... \n", | |
"2015-12-01 0.000000 0.000000 \n", | |
"2015-12-08 0.000000 0.000000 \n", | |
"2015-12-15 6.285714 8.220184 \n", | |
"2015-12-22 2.571429 5.255383 \n", | |
"2015-12-29 2.333333 3.214550 \n", | |
"\n", | |
"[888 rows x 18 columns]" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-9c3f4b04-0365-41be-b6de-562ab25d25d1\">\n", | |
" <div class=\"colab-df-container\">\n", | |
" <div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr th {\n", | |
" text-align: left;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead tr:last-of-type th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th colspan=\"6\" halign=\"left\">STA_A</th>\n", | |
" <th colspan=\"6\" halign=\"left\">STA_B</th>\n", | |
" <th colspan=\"6\" halign=\"left\">STA_C</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th></th>\n", | |
" <th>n_days</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_dry</th>\n", | |
" <th>SUM</th>\n", | |
" <th>MEAN</th>\n", | |
" <th>STD</th>\n", | |
" <th>n_days</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_dry</th>\n", | |
" <th>SUM</th>\n", | |
" <th>MEAN</th>\n", | |
" <th>STD</th>\n", | |
" <th>n_days</th>\n", | |
" <th>n_rain</th>\n", | |
" <th>n_dry</th>\n", | |
" <th>SUM</th>\n", | |
" <th>MEAN</th>\n", | |
" <th>STD</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>DATE</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2001-01-01</th>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>7.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>58.0</td>\n", | |
" <td>8.285714</td>\n", | |
" <td>16.499639</td>\n", | |
" <td>7.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>15.43</td>\n", | |
" <td>2.204286</td>\n", | |
" <td>3.384252</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-08</th>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>7.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>68.0</td>\n", | |
" <td>9.714286</td>\n", | |
" <td>13.300555</td>\n", | |
" <td>7.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>125.30</td>\n", | |
" <td>17.900000</td>\n", | |
" <td>32.992996</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-15</th>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>7.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>224.0</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>37.434387</td>\n", | |
" <td>7.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>93.38</td>\n", | |
" <td>13.340000</td>\n", | |
" <td>12.806884</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-22</th>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>7.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>60.0</td>\n", | |
" <td>8.571429</td>\n", | |
" <td>10.906529</td>\n", | |
" <td>7.0</td>\n", | |
" <td>6.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>55.88</td>\n", | |
" <td>7.982857</td>\n", | |
" <td>5.429001</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2001-01-29</th>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>3.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>44.0</td>\n", | |
" <td>14.666667</td>\n", | |
" <td>13.650397</td>\n", | |
" <td>3.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>37.99</td>\n", | |
" <td>12.663333</td>\n", | |
" <td>11.376741</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-01</th>\n", | |
" <td>7.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>86.0</td>\n", | |
" <td>12.285714</td>\n", | |
" <td>25.408098</td>\n", | |
" <td>7.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>6.0</td>\n", | |
" <td>43.0</td>\n", | |
" <td>6.142857</td>\n", | |
" <td>16.252472</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.00</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-08</th>\n", | |
" <td>7.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>55.0</td>\n", | |
" <td>7.857143</td>\n", | |
" <td>12.266874</td>\n", | |
" <td>7.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>67.0</td>\n", | |
" <td>9.571429</td>\n", | |
" <td>13.513662</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.00</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-15</th>\n", | |
" <td>7.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>105.0</td>\n", | |
" <td>15.000000</td>\n", | |
" <td>11.503623</td>\n", | |
" <td>7.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>55.0</td>\n", | |
" <td>7.857143</td>\n", | |
" <td>9.118271</td>\n", | |
" <td>7.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>44.00</td>\n", | |
" <td>6.285714</td>\n", | |
" <td>8.220184</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-22</th>\n", | |
" <td>7.0</td>\n", | |
" <td>7.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>136.0</td>\n", | |
" <td>19.428571</td>\n", | |
" <td>12.053452</td>\n", | |
" <td>7.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>4.0</td>\n", | |
" <td>51.0</td>\n", | |
" <td>7.285714</td>\n", | |
" <td>11.954278</td>\n", | |
" <td>7.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>5.0</td>\n", | |
" <td>18.00</td>\n", | |
" <td>2.571429</td>\n", | |
" <td>5.255383</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2015-12-29</th>\n", | |
" <td>3.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>15.0</td>\n", | |
" <td>5.000000</td>\n", | |
" <td>2.000000</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>3.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>3.0</td>\n", | |
" <td>2.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>7.00</td>\n", | |
" <td>2.333333</td>\n", | |
" <td>3.214550</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>888 rows × 18 columns</p>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-9c3f4b04-0365-41be-b6de-562ab25d25d1')\"\n", | |
" title=\"Convert this dataframe to an interactive table.\"\n", | |
" style=\"display:none;\">\n", | |
" \n", | |
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n", | |
" width=\"24px\">\n", | |
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n", | |
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
" \n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\n", | |
" flex-wrap:wrap;\n", | |
" gap: 12px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert {\n", | |
" background-color: #E8F0FE;\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: #1967D2;\n", | |
" height: 32px;\n", | |
" padding: 0 0 0 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-convert:hover {\n", | |
" background-color: #E2EBFA;\n", | |
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: #174EA6;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert {\n", | |
" background-color: #3B4455;\n", | |
" fill: #D2E3FC;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-convert:hover {\n", | |
" background-color: #434B5C;\n", | |
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n", | |
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n", | |
" fill: #FFFFFF;\n", | |
" }\n", | |
" </style>\n", | |
"\n", | |
" <script>\n", | |
" const buttonEl =\n", | |
" document.querySelector('#df-9c3f4b04-0365-41be-b6de-562ab25d25d1 button.colab-df-convert');\n", | |
" buttonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
"\n", | |
" async function convertToInteractive(key) {\n", | |
" const element = document.querySelector('#df-9c3f4b04-0365-41be-b6de-562ab25d25d1');\n", | |
" const dataTable =\n", | |
" await google.colab.kernel.invokeFunction('convertToInteractive',\n", | |
" [key], {});\n", | |
" if (!dataTable) return;\n", | |
"\n", | |
" const docLinkHtml = 'Like what you see? Visit the ' +\n", | |
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n", | |
" + ' to learn more about interactive tables.';\n", | |
" element.innerHTML = '';\n", | |
" dataTable['output_type'] = 'display_data';\n", | |
" await google.colab.output.renderOutput(dataTable, element);\n", | |
" const docLink = document.createElement('div');\n", | |
" docLink.innerHTML = docLinkHtml;\n", | |
" element.appendChild(docLink);\n", | |
" }\n", | |
" </script>\n", | |
" </div>\n", | |
" </div>\n", | |
" " | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 60 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "5-F6J0TcaDUV" | |
}, | |
"source": [ | |
"# Changelog\n", | |
"\n", | |
"```\n", | |
"- 20220613 - 1.1.0 - Fix error concat index (live at v0.4.1) & refactor based on new output from hk88. \n", | |
"- 20220311 - 1.0.1 - Add verbose (#115)\n", | |
"- 20191217 - 1.0.0 - Initial\n", | |
"```\n", | |
"\n", | |
"#### Copyright © 2022 [Taruma Sakti Megariansyah](https://taruma.github.io)\n", | |
"\n", | |
"Source code in this notebook is licensed under a [MIT License](https://choosealicense.com/licenses/mit/). Data in this notebook is licensed under a [Creative Common Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/). \n" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment