Created
December 24, 2022 19:45
-
-
Save ngupta23/4aaab9205ef3de3921c3a5a580f7701d to your computer and use it in GitHub Desktop.
arima_vs_ma.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": { | |
"provenance": [], | |
"authorship_tag": "ABX9TyMOZCr7H4IJQ/r0FczHPod5", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/ngupta23/4aaab9205ef3de3921c3a5a580f7701d/arima_vs_ma.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"id": "xL_eTYkLntfi" | |
}, | |
"outputs": [], | |
"source": [ | |
"!pip install --pre pycaret" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"from pycaret.datasets import get_data\n", | |
"from pycaret.time_series import TSForecastingExperiment" | |
], | |
"metadata": { | |
"id": "7aertc8fnu83" | |
}, | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"data = get_data(\"airline\", verbose=False)" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 17 | |
}, | |
"id": "Zcx-M-ZIoYBH", | |
"outputId": "4e6cae75-1a78-4e89-bb54-e99556db01be" | |
}, | |
"execution_count": 4, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
], | |
"text/html": [] | |
}, | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"exp = TSForecastingExperiment()\n", | |
"exp.setup(data=data, session_id=42, fh=6)" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 1000 | |
}, | |
"id": "frHRAo_Uoar-", | |
"outputId": "d60562c8-57b6-44e2-8a45-ab801ecf89a1" | |
}, | |
"execution_count": 5, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/plain": [ | |
"<pandas.io.formats.style.Styler at 0x7f6fbb1cb130>" | |
], | |
"text/html": [ | |
"<style type=\"text/css\">\n", | |
"#T_3ef8c_row22_col1 {\n", | |
" background-color: lightgreen;\n", | |
"}\n", | |
"</style>\n", | |
"<table id=\"T_3ef8c_\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr>\n", | |
" <th class=\"blank level0\" > </th>\n", | |
" <th class=\"col_heading level0 col0\" >Description</th>\n", | |
" <th class=\"col_heading level0 col1\" >Value</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n", | |
" <td id=\"T_3ef8c_row0_col0\" class=\"data row0 col0\" >session_id</td>\n", | |
" <td id=\"T_3ef8c_row0_col1\" class=\"data row0 col1\" >42</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n", | |
" <td id=\"T_3ef8c_row1_col0\" class=\"data row1 col0\" >Target</td>\n", | |
" <td id=\"T_3ef8c_row1_col1\" class=\"data row1 col1\" >Number of airline passengers</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n", | |
" <td id=\"T_3ef8c_row2_col0\" class=\"data row2 col0\" >Approach</td>\n", | |
" <td id=\"T_3ef8c_row2_col1\" class=\"data row2 col1\" >Univariate</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n", | |
" <td id=\"T_3ef8c_row3_col0\" class=\"data row3 col0\" >Exogenous Variables</td>\n", | |
" <td id=\"T_3ef8c_row3_col1\" class=\"data row3 col1\" >Not Present</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n", | |
" <td id=\"T_3ef8c_row4_col0\" class=\"data row4 col0\" >Original data shape</td>\n", | |
" <td id=\"T_3ef8c_row4_col1\" class=\"data row4 col1\" >(144, 1)</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n", | |
" <td id=\"T_3ef8c_row5_col0\" class=\"data row5 col0\" >Transformed data shape</td>\n", | |
" <td id=\"T_3ef8c_row5_col1\" class=\"data row5 col1\" >(144, 1)</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row6\" class=\"row_heading level0 row6\" >6</th>\n", | |
" <td id=\"T_3ef8c_row6_col0\" class=\"data row6 col0\" >Transformed train set shape</td>\n", | |
" <td id=\"T_3ef8c_row6_col1\" class=\"data row6 col1\" >(138, 1)</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row7\" class=\"row_heading level0 row7\" >7</th>\n", | |
" <td id=\"T_3ef8c_row7_col0\" class=\"data row7 col0\" >Transformed test set shape</td>\n", | |
" <td id=\"T_3ef8c_row7_col1\" class=\"data row7 col1\" >(6, 1)</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row8\" class=\"row_heading level0 row8\" >8</th>\n", | |
" <td id=\"T_3ef8c_row8_col0\" class=\"data row8 col0\" >Rows with missing values</td>\n", | |
" <td id=\"T_3ef8c_row8_col1\" class=\"data row8 col1\" >0.0%</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row9\" class=\"row_heading level0 row9\" >9</th>\n", | |
" <td id=\"T_3ef8c_row9_col0\" class=\"data row9 col0\" >Fold Generator</td>\n", | |
" <td id=\"T_3ef8c_row9_col1\" class=\"data row9 col1\" >ExpandingWindowSplitter</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row10\" class=\"row_heading level0 row10\" >10</th>\n", | |
" <td id=\"T_3ef8c_row10_col0\" class=\"data row10 col0\" >Fold Number</td>\n", | |
" <td id=\"T_3ef8c_row10_col1\" class=\"data row10 col1\" >3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row11\" class=\"row_heading level0 row11\" >11</th>\n", | |
" <td id=\"T_3ef8c_row11_col0\" class=\"data row11 col0\" >Enforce Prediction Interval</td>\n", | |
" <td id=\"T_3ef8c_row11_col1\" class=\"data row11 col1\" >False</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row12\" class=\"row_heading level0 row12\" >12</th>\n", | |
" <td id=\"T_3ef8c_row12_col0\" class=\"data row12 col0\" >Seasonality Detection Algo</td>\n", | |
" <td id=\"T_3ef8c_row12_col1\" class=\"data row12 col1\" >auto</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row13\" class=\"row_heading level0 row13\" >13</th>\n", | |
" <td id=\"T_3ef8c_row13_col0\" class=\"data row13 col0\" >Max Period to Consider</td>\n", | |
" <td id=\"T_3ef8c_row13_col1\" class=\"data row13 col1\" >None</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row14\" class=\"row_heading level0 row14\" >14</th>\n", | |
" <td id=\"T_3ef8c_row14_col0\" class=\"data row14 col0\" >Seasonal Period(s) Tested</td>\n", | |
" <td id=\"T_3ef8c_row14_col1\" class=\"data row14 col1\" >[12, 24, 36, 11, 48]</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row15\" class=\"row_heading level0 row15\" >15</th>\n", | |
" <td id=\"T_3ef8c_row15_col0\" class=\"data row15 col0\" >Significant Seasonal Period(s)</td>\n", | |
" <td id=\"T_3ef8c_row15_col1\" class=\"data row15 col1\" >[12, 24, 36, 11, 48]</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row16\" class=\"row_heading level0 row16\" >16</th>\n", | |
" <td id=\"T_3ef8c_row16_col0\" class=\"data row16 col0\" >Significant Seasonal Period(s) without Harmonics</td>\n", | |
" <td id=\"T_3ef8c_row16_col1\" class=\"data row16 col1\" >[48, 36, 11]</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row17\" class=\"row_heading level0 row17\" >17</th>\n", | |
" <td id=\"T_3ef8c_row17_col0\" class=\"data row17 col0\" >Remove Harmonics</td>\n", | |
" <td id=\"T_3ef8c_row17_col1\" class=\"data row17 col1\" >False</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row18\" class=\"row_heading level0 row18\" >18</th>\n", | |
" <td id=\"T_3ef8c_row18_col0\" class=\"data row18 col0\" >Harmonics Order Method</td>\n", | |
" <td id=\"T_3ef8c_row18_col1\" class=\"data row18 col1\" >harmonic_max</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row19\" class=\"row_heading level0 row19\" >19</th>\n", | |
" <td id=\"T_3ef8c_row19_col0\" class=\"data row19 col0\" >Num Seasonalities to Use</td>\n", | |
" <td id=\"T_3ef8c_row19_col1\" class=\"data row19 col1\" >1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row20\" class=\"row_heading level0 row20\" >20</th>\n", | |
" <td id=\"T_3ef8c_row20_col0\" class=\"data row20 col0\" >All Seasonalities to Use</td>\n", | |
" <td id=\"T_3ef8c_row20_col1\" class=\"data row20 col1\" >[12]</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row21\" class=\"row_heading level0 row21\" >21</th>\n", | |
" <td id=\"T_3ef8c_row21_col0\" class=\"data row21 col0\" >Primary Seasonality</td>\n", | |
" <td id=\"T_3ef8c_row21_col1\" class=\"data row21 col1\" >12</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row22\" class=\"row_heading level0 row22\" >22</th>\n", | |
" <td id=\"T_3ef8c_row22_col0\" class=\"data row22 col0\" >Seasonality Present</td>\n", | |
" <td id=\"T_3ef8c_row22_col1\" class=\"data row22 col1\" >True</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row23\" class=\"row_heading level0 row23\" >23</th>\n", | |
" <td id=\"T_3ef8c_row23_col0\" class=\"data row23 col0\" >Target Strictly Positive</td>\n", | |
" <td id=\"T_3ef8c_row23_col1\" class=\"data row23 col1\" >True</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row24\" class=\"row_heading level0 row24\" >24</th>\n", | |
" <td id=\"T_3ef8c_row24_col0\" class=\"data row24 col0\" >Target White Noise</td>\n", | |
" <td id=\"T_3ef8c_row24_col1\" class=\"data row24 col1\" >No</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row25\" class=\"row_heading level0 row25\" >25</th>\n", | |
" <td id=\"T_3ef8c_row25_col0\" class=\"data row25 col0\" >Recommended d</td>\n", | |
" <td id=\"T_3ef8c_row25_col1\" class=\"data row25 col1\" >1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row26\" class=\"row_heading level0 row26\" >26</th>\n", | |
" <td id=\"T_3ef8c_row26_col0\" class=\"data row26 col0\" >Recommended Seasonal D</td>\n", | |
" <td id=\"T_3ef8c_row26_col1\" class=\"data row26 col1\" >1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row27\" class=\"row_heading level0 row27\" >27</th>\n", | |
" <td id=\"T_3ef8c_row27_col0\" class=\"data row27 col0\" >Preprocess</td>\n", | |
" <td id=\"T_3ef8c_row27_col1\" class=\"data row27 col1\" >False</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row28\" class=\"row_heading level0 row28\" >28</th>\n", | |
" <td id=\"T_3ef8c_row28_col0\" class=\"data row28 col0\" >CPU Jobs</td>\n", | |
" <td id=\"T_3ef8c_row28_col1\" class=\"data row28 col1\" >-1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row29\" class=\"row_heading level0 row29\" >29</th>\n", | |
" <td id=\"T_3ef8c_row29_col0\" class=\"data row29 col0\" >Use GPU</td>\n", | |
" <td id=\"T_3ef8c_row29_col1\" class=\"data row29 col1\" >False</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row30\" class=\"row_heading level0 row30\" >30</th>\n", | |
" <td id=\"T_3ef8c_row30_col0\" class=\"data row30 col0\" >Log Experiment</td>\n", | |
" <td id=\"T_3ef8c_row30_col1\" class=\"data row30 col1\" >False</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row31\" class=\"row_heading level0 row31\" >31</th>\n", | |
" <td id=\"T_3ef8c_row31_col0\" class=\"data row31 col0\" >Experiment Name</td>\n", | |
" <td id=\"T_3ef8c_row31_col1\" class=\"data row31 col1\" >ts-default-name</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th id=\"T_3ef8c_level0_row32\" class=\"row_heading level0 row32\" >32</th>\n", | |
" <td id=\"T_3ef8c_row32_col0\" class=\"data row32 col0\" >USI</td>\n", | |
" <td id=\"T_3ef8c_row32_col1\" class=\"data row32 col1\" >0352</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n" | |
] | |
}, | |
"metadata": {} | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"<pycaret.time_series.forecasting.oop.TSForecastingExperiment at 0x7f6fbaceb1f0>" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 5 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"model1 = exp.create_model(\"arima\", order=(0,0,3), seasonal_order=(0, 0, 0, 0), with_intercept=False, verbose=False)\n", | |
"type(model1), model1" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "jes2hd50ol_O", | |
"outputId": "b7d42ce8-6b0e-48ab-c824-376bc3b0b675" | |
}, | |
"execution_count": 15, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"(sktime.forecasting.arima.ARIMA, ARIMA(order=(0, 0, 3), with_intercept=False))" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 15 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"exp.predict_model(model1, verbose=False)" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 238 | |
}, | |
"id": "10RhY2QPo8kZ", | |
"outputId": "e9e0feb5-5a92-4314-df91-dd00914d14f9" | |
}, | |
"execution_count": 16, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" y_pred\n", | |
"1960-07 487.2285\n", | |
"1960-08 332.1251\n", | |
"1960-09 172.5590\n", | |
"1960-10 0.0000\n", | |
"1960-11 0.0000\n", | |
"1960-12 0.0000" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-02308735-f6a4-497c-b681-f6f234ebf354\">\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>y_pred</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>1960-07</th>\n", | |
" <td>487.2285</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1960-08</th>\n", | |
" <td>332.1251</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1960-09</th>\n", | |
" <td>172.5590</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1960-10</th>\n", | |
" <td>0.0000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1960-11</th>\n", | |
" <td>0.0000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1960-12</th>\n", | |
" <td>0.0000</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-02308735-f6a4-497c-b681-f6f234ebf354')\"\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-02308735-f6a4-497c-b681-f6f234ebf354 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-02308735-f6a4-497c-b681-f6f234ebf354');\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": 16 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [], | |
"metadata": { | |
"id": "eoDnJFRMpQ51" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment