Created
July 28, 2025 18:49
-
-
Save rwcitek/8cc463bfc14cc161e8ec573dee99097b to your computer and use it in GitHub Desktop.
TFP-2021-Disaggregated-Market-Basket.ipynb
This file contains hidden or 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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/rwcitek/8cc463bfc14cc161e8ec573dee99097b/tfp-2021-disaggregated-market-basket.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": "lIYdn1woOS1n" | |
}, | |
"outputs": [], | |
"source": [ | |
"import pandas as pd\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"url = \"https://www.fns.usda.gov/sites/default/files/media/file/TFP-2021-Disaggregated-Market-Basket.xlsx\"\n", | |
"url\n" | |
], | |
"metadata": { | |
"id": "5D3TPpLzRFZi" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"wb = pd.ExcelFile( url )\n", | |
"wb.sheet_names\n" | |
], | |
"metadata": { | |
"id": "szy1UhPBQ_Kr", | |
"outputId": "ab34a5a3-63e7-4ff5-f355-2909d7ffd9db", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
} | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"['Cover Sheet', 'Codebook', 'Disaggregated Market Basket']" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 3 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"dfs = { name: wb.parse( name, dtype = { 'EC': str, } ) for name in wb.sheet_names }\n", | |
"dfs.keys()\n" | |
], | |
"metadata": { | |
"id": "YXX6_JW9Voyi", | |
"outputId": "6a4752d7-7af1-46be-e857-707d7bb3a0b2", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
} | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"dict_keys(['Cover Sheet', 'Codebook', 'Disaggregated Market Basket'])" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 4 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"dfs['Codebook']\n" | |
], | |
"metadata": { | |
"id": "zIIst43lRRpd", | |
"outputId": "d1f9d25e-2df7-45ce-9c27-c2aa49254c8f", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 1000 | |
} | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" Column Name \\\n", | |
"0 EC \n", | |
"1 EC_Description \n", | |
"2 Form \n", | |
"3 Form_Description \n", | |
"4 TFP_Market_Basket_Category \n", | |
"5 amount_reffam \n", | |
"6 cost_reffam \n", | |
"7 amount_child1 \n", | |
"8 amount_child2_3 \n", | |
"9 amount_child4_5 \n", | |
"10 amount_child6_8 \n", | |
"11 amount_child9_11 \n", | |
"12 amount_female12_13 \n", | |
"13 amount_female14_19 \n", | |
"14 amount_female20_50 \n", | |
"15 amount_female51_70 \n", | |
"16 amount_female71_ \n", | |
"17 amount_male12_13 \n", | |
"18 amount_male14_19 \n", | |
"19 amount_male20_50 \n", | |
"20 amount_male51_70 \n", | |
"21 amount_male71_ \n", | |
"22 cost_child1 \n", | |
"23 cost_child2_3 \n", | |
"24 cost_child4_5 \n", | |
"25 cost_child6_8 \n", | |
"26 cost_child9_11 \n", | |
"27 cost_female12_13 \n", | |
"28 cost_female14_19 \n", | |
"29 cost_female20_50 \n", | |
"30 cost_female51_70 \n", | |
"31 cost_female71_ \n", | |
"32 cost_male12_13 \n", | |
"33 cost_male14_19 \n", | |
"34 cost_male20_50 \n", | |
"35 cost_male51_70 \n", | |
"36 cost_male71_ \n", | |
"\n", | |
" Description \n", | |
"0 Ensemble Code; links to 2015-16 Purchase to Pl... \n", | |
"1 Ensemble Code Description \n", | |
"2 Form; links to 2015-16 Purchase to Plate Cross... \n", | |
"3 Form Description \n", | |
"4 Thrifty Food Plan, 2021 Market Basket Category \n", | |
"5 Quantity in pounds per week for the reference ... \n", | |
"6 Cost in dollars per week for the reference fam... \n", | |
"7 Quantity in pounds per week for children age 1 \n", | |
"8 Quantity in pounds per week for children age 2-3 \n", | |
"9 Quantity in pounds per week for children age 4-5 \n", | |
"10 Quantity in pounds per week for children age 6-8 \n", | |
"11 Quantity in pounds per week for children age 9-11 \n", | |
"12 Quantity in pounds per week for females age 12-13 \n", | |
"13 Quantity in pounds per week for females age 14-19 \n", | |
"14 Quantity in pounds per week for females age 20-50 \n", | |
"15 Quantity in pounds per week for females age 51-70 \n", | |
"16 Quantity in pounds per week for females age 70... \n", | |
"17 Quantity in pounds per week for males age 12-13 \n", | |
"18 Quantity in pounds per week for males age 14-19 \n", | |
"19 Quantity in pounds per week for males age 20-50 \n", | |
"20 Quantity in pounds per week for males age 51-70 \n", | |
"21 Quantity in pounds per week for males age 70 a... \n", | |
"22 Cost in dollars per week for children age 1 \n", | |
"23 Cost in dollars per week for children age 2-3 \n", | |
"24 Cost in dollars per week for children age 4-5 \n", | |
"25 Cost in dollars per week for children age 6-8 \n", | |
"26 Cost in dollars per week for children age 9-11 \n", | |
"27 Cost in dollars per week for females age 12-13 \n", | |
"28 Cost in dollars per week for females age 14-19 \n", | |
"29 Cost in dollars per week for females age 20-50 \n", | |
"30 Cost in dollars per week for females age 51-70 \n", | |
"31 Cost in dollars per week for females age 70 an... \n", | |
"32 Cost in dollars per week for males age 12-13 \n", | |
"33 Cost in dollars per week for males age 14-19 \n", | |
"34 Cost in dollars per week for males age 20-50 \n", | |
"35 Cost in dollars per week for males age 51-70 \n", | |
"36 Cost in dollars per week for males age 70 and ... " | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-dfb5894c-a8d6-407a-a808-c16ec9a0e661\" 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>Column Name</th>\n", | |
" <th>Description</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>EC</td>\n", | |
" <td>Ensemble Code; links to 2015-16 Purchase to Pl...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>EC_Description</td>\n", | |
" <td>Ensemble Code Description</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>Form</td>\n", | |
" <td>Form; links to 2015-16 Purchase to Plate Cross...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>Form_Description</td>\n", | |
" <td>Form Description</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>TFP_Market_Basket_Category</td>\n", | |
" <td>Thrifty Food Plan, 2021 Market Basket Category</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>amount_reffam</td>\n", | |
" <td>Quantity in pounds per week for the reference ...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>cost_reffam</td>\n", | |
" <td>Cost in dollars per week for the reference fam...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>amount_child1</td>\n", | |
" <td>Quantity in pounds per week for children age 1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>amount_child2_3</td>\n", | |
" <td>Quantity in pounds per week for children age 2-3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>9</th>\n", | |
" <td>amount_child4_5</td>\n", | |
" <td>Quantity in pounds per week for children age 4-5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>10</th>\n", | |
" <td>amount_child6_8</td>\n", | |
" <td>Quantity in pounds per week for children age 6-8</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>11</th>\n", | |
" <td>amount_child9_11</td>\n", | |
" <td>Quantity in pounds per week for children age 9-11</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>12</th>\n", | |
" <td>amount_female12_13</td>\n", | |
" <td>Quantity in pounds per week for females age 12-13</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>13</th>\n", | |
" <td>amount_female14_19</td>\n", | |
" <td>Quantity in pounds per week for females age 14-19</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>14</th>\n", | |
" <td>amount_female20_50</td>\n", | |
" <td>Quantity in pounds per week for females age 20-50</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>15</th>\n", | |
" <td>amount_female51_70</td>\n", | |
" <td>Quantity in pounds per week for females age 51-70</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>16</th>\n", | |
" <td>amount_female71_</td>\n", | |
" <td>Quantity in pounds per week for females age 70...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>17</th>\n", | |
" <td>amount_male12_13</td>\n", | |
" <td>Quantity in pounds per week for males age 12-13</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>18</th>\n", | |
" <td>amount_male14_19</td>\n", | |
" <td>Quantity in pounds per week for males age 14-19</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>19</th>\n", | |
" <td>amount_male20_50</td>\n", | |
" <td>Quantity in pounds per week for males age 20-50</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>20</th>\n", | |
" <td>amount_male51_70</td>\n", | |
" <td>Quantity in pounds per week for males age 51-70</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>21</th>\n", | |
" <td>amount_male71_</td>\n", | |
" <td>Quantity in pounds per week for males age 70 a...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>22</th>\n", | |
" <td>cost_child1</td>\n", | |
" <td>Cost in dollars per week for children age 1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>23</th>\n", | |
" <td>cost_child2_3</td>\n", | |
" <td>Cost in dollars per week for children age 2-3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>24</th>\n", | |
" <td>cost_child4_5</td>\n", | |
" <td>Cost in dollars per week for children age 4-5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>25</th>\n", | |
" <td>cost_child6_8</td>\n", | |
" <td>Cost in dollars per week for children age 6-8</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>26</th>\n", | |
" <td>cost_child9_11</td>\n", | |
" <td>Cost in dollars per week for children age 9-11</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>27</th>\n", | |
" <td>cost_female12_13</td>\n", | |
" <td>Cost in dollars per week for females age 12-13</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>28</th>\n", | |
" <td>cost_female14_19</td>\n", | |
" <td>Cost in dollars per week for females age 14-19</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>29</th>\n", | |
" <td>cost_female20_50</td>\n", | |
" <td>Cost in dollars per week for females age 20-50</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>30</th>\n", | |
" <td>cost_female51_70</td>\n", | |
" <td>Cost in dollars per week for females age 51-70</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>31</th>\n", | |
" <td>cost_female71_</td>\n", | |
" <td>Cost in dollars per week for females age 70 an...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>32</th>\n", | |
" <td>cost_male12_13</td>\n", | |
" <td>Cost in dollars per week for males age 12-13</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>33</th>\n", | |
" <td>cost_male14_19</td>\n", | |
" <td>Cost in dollars per week for males age 14-19</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>34</th>\n", | |
" <td>cost_male20_50</td>\n", | |
" <td>Cost in dollars per week for males age 20-50</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>35</th>\n", | |
" <td>cost_male51_70</td>\n", | |
" <td>Cost in dollars per week for males age 51-70</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>36</th>\n", | |
" <td>cost_male71_</td>\n", | |
" <td>Cost in dollars per week for males age 70 and ...</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>\n", | |
" <div class=\"colab-df-buttons\">\n", | |
"\n", | |
" <div class=\"colab-df-container\">\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-dfb5894c-a8d6-407a-a808-c16ec9a0e661')\"\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 -960 960 960\">\n", | |
" <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
"\n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\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", | |
" .colab-df-buttons div {\n", | |
" margin-bottom: 4px;\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-dfb5894c-a8d6-407a-a808-c16ec9a0e661 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-dfb5894c-a8d6-407a-a808-c16ec9a0e661');\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", | |
"\n", | |
"\n", | |
" <div id=\"df-13693ba5-6733-4e11-8919-dad8d870ddfe\">\n", | |
" <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-13693ba5-6733-4e11-8919-dad8d870ddfe')\"\n", | |
" title=\"Suggest charts\"\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", | |
" <g>\n", | |
" <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n", | |
" </g>\n", | |
"</svg>\n", | |
" </button>\n", | |
"\n", | |
"<style>\n", | |
" .colab-df-quickchart {\n", | |
" --bg-color: #E8F0FE;\n", | |
" --fill-color: #1967D2;\n", | |
" --hover-bg-color: #E2EBFA;\n", | |
" --hover-fill-color: #174EA6;\n", | |
" --disabled-fill-color: #AAA;\n", | |
" --disabled-bg-color: #DDD;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-quickchart {\n", | |
" --bg-color: #3B4455;\n", | |
" --fill-color: #D2E3FC;\n", | |
" --hover-bg-color: #434B5C;\n", | |
" --hover-fill-color: #FFFFFF;\n", | |
" --disabled-bg-color: #3B4455;\n", | |
" --disabled-fill-color: #666;\n", | |
" }\n", | |
"\n", | |
" .colab-df-quickchart {\n", | |
" background-color: var(--bg-color);\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: var(--fill-color);\n", | |
" height: 32px;\n", | |
" padding: 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-quickchart:hover {\n", | |
" background-color: var(--hover-bg-color);\n", | |
" box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: var(--button-hover-fill-color);\n", | |
" }\n", | |
"\n", | |
" .colab-df-quickchart-complete:disabled,\n", | |
" .colab-df-quickchart-complete:disabled:hover {\n", | |
" background-color: var(--disabled-bg-color);\n", | |
" fill: var(--disabled-fill-color);\n", | |
" box-shadow: none;\n", | |
" }\n", | |
"\n", | |
" .colab-df-spinner {\n", | |
" border: 2px solid var(--fill-color);\n", | |
" border-color: transparent;\n", | |
" border-bottom-color: var(--fill-color);\n", | |
" animation:\n", | |
" spin 1s steps(1) infinite;\n", | |
" }\n", | |
"\n", | |
" @keyframes spin {\n", | |
" 0% {\n", | |
" border-color: transparent;\n", | |
" border-bottom-color: var(--fill-color);\n", | |
" border-left-color: var(--fill-color);\n", | |
" }\n", | |
" 20% {\n", | |
" border-color: transparent;\n", | |
" border-left-color: var(--fill-color);\n", | |
" border-top-color: var(--fill-color);\n", | |
" }\n", | |
" 30% {\n", | |
" border-color: transparent;\n", | |
" border-left-color: var(--fill-color);\n", | |
" border-top-color: var(--fill-color);\n", | |
" border-right-color: var(--fill-color);\n", | |
" }\n", | |
" 40% {\n", | |
" border-color: transparent;\n", | |
" border-right-color: var(--fill-color);\n", | |
" border-top-color: var(--fill-color);\n", | |
" }\n", | |
" 60% {\n", | |
" border-color: transparent;\n", | |
" border-right-color: var(--fill-color);\n", | |
" }\n", | |
" 80% {\n", | |
" border-color: transparent;\n", | |
" border-right-color: var(--fill-color);\n", | |
" border-bottom-color: var(--fill-color);\n", | |
" }\n", | |
" 90% {\n", | |
" border-color: transparent;\n", | |
" border-bottom-color: var(--fill-color);\n", | |
" }\n", | |
" }\n", | |
"</style>\n", | |
"\n", | |
" <script>\n", | |
" async function quickchart(key) {\n", | |
" const quickchartButtonEl =\n", | |
" document.querySelector('#' + key + ' button');\n", | |
" quickchartButtonEl.disabled = true; // To prevent multiple clicks.\n", | |
" quickchartButtonEl.classList.add('colab-df-spinner');\n", | |
" try {\n", | |
" const charts = await google.colab.kernel.invokeFunction(\n", | |
" 'suggestCharts', [key], {});\n", | |
" } catch (error) {\n", | |
" console.error('Error during call to suggestCharts:', error);\n", | |
" }\n", | |
" quickchartButtonEl.classList.remove('colab-df-spinner');\n", | |
" quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n", | |
" }\n", | |
" (() => {\n", | |
" let quickchartButtonEl =\n", | |
" document.querySelector('#df-13693ba5-6733-4e11-8919-dad8d870ddfe button');\n", | |
" quickchartButtonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
" })();\n", | |
" </script>\n", | |
" </div>\n", | |
"\n", | |
" </div>\n", | |
" </div>\n" | |
], | |
"application/vnd.google.colaboratory.intrinsic+json": { | |
"type": "dataframe", | |
"summary": "{\n \"name\": \"dfs['Codebook']\",\n \"rows\": 37,\n \"fields\": [\n {\n \"column\": \"Column Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 37,\n \"samples\": [\n \"amount_male12_13\",\n \"amount_female14_19\",\n \"TFP_Market_Basket_Category\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Description\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 37,\n \"samples\": [\n \"Quantity in pounds per week for males age 12-13\",\n \"Quantity in pounds per week for females age 14-19\",\n \"Thrifty Food Plan, 2021 Market Basket Category\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" | |
} | |
}, | |
"metadata": {}, | |
"execution_count": 5 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"dfs['Disaggregated Market Basket']\n" | |
], | |
"metadata": { | |
"collapsed": true, | |
"id": "YW873GhkRbHI", | |
"outputId": "64511d49-1459-4eaf-a744-747e52bcc933", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 652 | |
} | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
" EC EC_Description Form \\\n", | |
"0 1001 Butter, salted RFG-RTS \n", | |
"1 1002 Butter, whipped, with salt RFG-RTS \n", | |
"2 1006 Cheese, brie RFG-RTS \n", | |
"3 1009 Cheese, cheddar RFG-RTS \n", | |
"4 1011 Cheese, colby RFG-RTS \n", | |
"... ... ... ... \n", | |
"3568 95312400 Energy drink, low calorie (Monster) SS-RTS \n", | |
"3569 95320200 Sports drink (Gatorade G) SS-RTS \n", | |
"3570 95320500 Sports drink (Powerade) SS-RTS \n", | |
"3571 95322200 Sports drink, low calorie (Gatorade G2) SS-RTS \n", | |
"3572 95322500 Sports drink, low calorie (Powerade Zero) SS-RTS \n", | |
"\n", | |
" Form_Description TFP_Market_Basket_Category \\\n", | |
"0 Refrigerated, ready-to-serve Table fats and oils \n", | |
"1 Refrigerated, ready-to-serve Table fats and oils \n", | |
"2 Refrigerated, ready-to-serve Cheese \n", | |
"3 Refrigerated, ready-to-serve Cheese \n", | |
"4 Refrigerated, ready-to-serve Cheese \n", | |
"... ... ... \n", | |
"3568 Shelf stable, ready-to-serve Other Miscellaneous Foods and Beverages \n", | |
"3569 Shelf stable, ready-to-serve Other Miscellaneous Foods and Beverages \n", | |
"3570 Shelf stable, ready-to-serve Other Miscellaneous Foods and Beverages \n", | |
"3571 Shelf stable, ready-to-serve Other Miscellaneous Foods and Beverages \n", | |
"3572 Shelf stable, ready-to-serve Other Miscellaneous Foods and Beverages \n", | |
"\n", | |
" amount_reffam cost_reffam amount_child1 amount_child2_3 \\\n", | |
"0 0.162679 0.618663 0.011033 0.020835 \n", | |
"1 0.026869 0.138185 0.000773 0.003072 \n", | |
"2 0.000000 0.000000 0.000000 0.000000 \n", | |
"3 0.095640 0.486519 0.009253 0.007254 \n", | |
"4 0.000000 0.000000 0.000000 0.000000 \n", | |
"... ... ... ... ... \n", | |
"3568 0.000000 0.000000 0.000000 0.000000 \n", | |
"3569 0.000000 0.000000 0.000000 0.000000 \n", | |
"3570 0.000000 0.000000 0.000000 0.000000 \n", | |
"3571 0.000000 0.000000 0.000000 0.000000 \n", | |
"3572 0.000000 0.000000 0.000000 0.000000 \n", | |
"\n", | |
" amount_child4_5 ... cost_female12_13 cost_female14_19 \\\n", | |
"0 0.013115 ... 0.133027 0.068306 \n", | |
"1 0.000840 ... 0.027287 0.005832 \n", | |
"2 0.000000 ... 0.000000 0.000000 \n", | |
"3 0.004298 ... 0.091392 0.000000 \n", | |
"4 0.000000 ... 0.000000 0.000000 \n", | |
"... ... ... ... ... \n", | |
"3568 0.000000 ... 0.000000 0.000000 \n", | |
"3569 0.000000 ... 0.000000 0.000000 \n", | |
"3570 0.000000 ... 0.000000 0.000000 \n", | |
"3571 0.000000 ... 0.000000 0.000000 \n", | |
"3572 0.000000 ... 0.000000 0.000000 \n", | |
"\n", | |
" cost_female20_50 cost_female51_70 cost_female71_ cost_male12_13 \\\n", | |
"0 0.083452 0.066516 0.063130 0.233399 \n", | |
"1 0.008779 0.006083 0.006612 0.059518 \n", | |
"2 0.000000 0.000000 0.000000 0.000000 \n", | |
"3 0.270423 0.079955 0.008555 0.064078 \n", | |
"4 0.000000 0.000000 0.000000 0.000000 \n", | |
"... ... ... ... ... \n", | |
"3568 0.000000 0.000000 0.000000 0.000000 \n", | |
"3569 0.000000 0.000000 0.000000 0.000000 \n", | |
"3570 0.000000 0.000000 0.000000 0.000000 \n", | |
"3571 0.000000 0.000000 0.000000 0.000000 \n", | |
"3572 0.000000 0.000000 0.009541 0.000000 \n", | |
"\n", | |
" cost_male14_19 cost_male20_50 cost_male51_70 cost_male71_ \n", | |
"0 0.236339 0.241486 0.252454 0.087286 \n", | |
"1 0.061711 0.062423 0.069141 0.008189 \n", | |
"2 0.000000 0.000000 0.000000 0.000000 \n", | |
"3 0.024740 0.036079 0.000000 0.000000 \n", | |
"4 0.000000 0.000000 0.000000 0.000000 \n", | |
"... ... ... ... ... \n", | |
"3568 0.000000 0.000000 0.000000 0.000000 \n", | |
"3569 0.000000 0.000000 0.000000 0.000000 \n", | |
"3570 0.000000 0.000000 0.000000 0.000000 \n", | |
"3571 0.000000 0.000000 0.000000 0.000000 \n", | |
"3572 0.000000 0.000000 0.000000 0.000000 \n", | |
"\n", | |
"[3573 rows x 37 columns]" | |
], | |
"text/html": [ | |
"\n", | |
" <div id=\"df-4abc0559-9202-488b-9f5b-a1d3286515b0\" 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>EC</th>\n", | |
" <th>EC_Description</th>\n", | |
" <th>Form</th>\n", | |
" <th>Form_Description</th>\n", | |
" <th>TFP_Market_Basket_Category</th>\n", | |
" <th>amount_reffam</th>\n", | |
" <th>cost_reffam</th>\n", | |
" <th>amount_child1</th>\n", | |
" <th>amount_child2_3</th>\n", | |
" <th>amount_child4_5</th>\n", | |
" <th>...</th>\n", | |
" <th>cost_female12_13</th>\n", | |
" <th>cost_female14_19</th>\n", | |
" <th>cost_female20_50</th>\n", | |
" <th>cost_female51_70</th>\n", | |
" <th>cost_female71_</th>\n", | |
" <th>cost_male12_13</th>\n", | |
" <th>cost_male14_19</th>\n", | |
" <th>cost_male20_50</th>\n", | |
" <th>cost_male51_70</th>\n", | |
" <th>cost_male71_</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>1001</td>\n", | |
" <td>Butter, salted</td>\n", | |
" <td>RFG-RTS</td>\n", | |
" <td>Refrigerated, ready-to-serve</td>\n", | |
" <td>Table fats and oils</td>\n", | |
" <td>0.162679</td>\n", | |
" <td>0.618663</td>\n", | |
" <td>0.011033</td>\n", | |
" <td>0.020835</td>\n", | |
" <td>0.013115</td>\n", | |
" <td>...</td>\n", | |
" <td>0.133027</td>\n", | |
" <td>0.068306</td>\n", | |
" <td>0.083452</td>\n", | |
" <td>0.066516</td>\n", | |
" <td>0.063130</td>\n", | |
" <td>0.233399</td>\n", | |
" <td>0.236339</td>\n", | |
" <td>0.241486</td>\n", | |
" <td>0.252454</td>\n", | |
" <td>0.087286</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>1002</td>\n", | |
" <td>Butter, whipped, with salt</td>\n", | |
" <td>RFG-RTS</td>\n", | |
" <td>Refrigerated, ready-to-serve</td>\n", | |
" <td>Table fats and oils</td>\n", | |
" <td>0.026869</td>\n", | |
" <td>0.138185</td>\n", | |
" <td>0.000773</td>\n", | |
" <td>0.003072</td>\n", | |
" <td>0.000840</td>\n", | |
" <td>...</td>\n", | |
" <td>0.027287</td>\n", | |
" <td>0.005832</td>\n", | |
" <td>0.008779</td>\n", | |
" <td>0.006083</td>\n", | |
" <td>0.006612</td>\n", | |
" <td>0.059518</td>\n", | |
" <td>0.061711</td>\n", | |
" <td>0.062423</td>\n", | |
" <td>0.069141</td>\n", | |
" <td>0.008189</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>1006</td>\n", | |
" <td>Cheese, brie</td>\n", | |
" <td>RFG-RTS</td>\n", | |
" <td>Refrigerated, ready-to-serve</td>\n", | |
" <td>Cheese</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>...</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>1009</td>\n", | |
" <td>Cheese, cheddar</td>\n", | |
" <td>RFG-RTS</td>\n", | |
" <td>Refrigerated, ready-to-serve</td>\n", | |
" <td>Cheese</td>\n", | |
" <td>0.095640</td>\n", | |
" <td>0.486519</td>\n", | |
" <td>0.009253</td>\n", | |
" <td>0.007254</td>\n", | |
" <td>0.004298</td>\n", | |
" <td>...</td>\n", | |
" <td>0.091392</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.270423</td>\n", | |
" <td>0.079955</td>\n", | |
" <td>0.008555</td>\n", | |
" <td>0.064078</td>\n", | |
" <td>0.024740</td>\n", | |
" <td>0.036079</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>1011</td>\n", | |
" <td>Cheese, colby</td>\n", | |
" <td>RFG-RTS</td>\n", | |
" <td>Refrigerated, ready-to-serve</td>\n", | |
" <td>Cheese</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>...</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</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", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3568</th>\n", | |
" <td>95312400</td>\n", | |
" <td>Energy drink, low calorie (Monster)</td>\n", | |
" <td>SS-RTS</td>\n", | |
" <td>Shelf stable, ready-to-serve</td>\n", | |
" <td>Other Miscellaneous Foods and Beverages</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>...</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3569</th>\n", | |
" <td>95320200</td>\n", | |
" <td>Sports drink (Gatorade G)</td>\n", | |
" <td>SS-RTS</td>\n", | |
" <td>Shelf stable, ready-to-serve</td>\n", | |
" <td>Other Miscellaneous Foods and Beverages</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>...</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3570</th>\n", | |
" <td>95320500</td>\n", | |
" <td>Sports drink (Powerade)</td>\n", | |
" <td>SS-RTS</td>\n", | |
" <td>Shelf stable, ready-to-serve</td>\n", | |
" <td>Other Miscellaneous Foods and Beverages</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>...</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3571</th>\n", | |
" <td>95322200</td>\n", | |
" <td>Sports drink, low calorie (Gatorade G2)</td>\n", | |
" <td>SS-RTS</td>\n", | |
" <td>Shelf stable, ready-to-serve</td>\n", | |
" <td>Other Miscellaneous Foods and Beverages</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>...</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3572</th>\n", | |
" <td>95322500</td>\n", | |
" <td>Sports drink, low calorie (Powerade Zero)</td>\n", | |
" <td>SS-RTS</td>\n", | |
" <td>Shelf stable, ready-to-serve</td>\n", | |
" <td>Other Miscellaneous Foods and Beverages</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>...</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.009541</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>3573 rows × 37 columns</p>\n", | |
"</div>\n", | |
" <div class=\"colab-df-buttons\">\n", | |
"\n", | |
" <div class=\"colab-df-container\">\n", | |
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-4abc0559-9202-488b-9f5b-a1d3286515b0')\"\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 -960 960 960\">\n", | |
" <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n", | |
" </svg>\n", | |
" </button>\n", | |
"\n", | |
" <style>\n", | |
" .colab-df-container {\n", | |
" display:flex;\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", | |
" .colab-df-buttons div {\n", | |
" margin-bottom: 4px;\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-4abc0559-9202-488b-9f5b-a1d3286515b0 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-4abc0559-9202-488b-9f5b-a1d3286515b0');\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", | |
"\n", | |
"\n", | |
" <div id=\"df-2f10f619-3677-4016-b91b-cb315837262b\">\n", | |
" <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-2f10f619-3677-4016-b91b-cb315837262b')\"\n", | |
" title=\"Suggest charts\"\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", | |
" <g>\n", | |
" <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n", | |
" </g>\n", | |
"</svg>\n", | |
" </button>\n", | |
"\n", | |
"<style>\n", | |
" .colab-df-quickchart {\n", | |
" --bg-color: #E8F0FE;\n", | |
" --fill-color: #1967D2;\n", | |
" --hover-bg-color: #E2EBFA;\n", | |
" --hover-fill-color: #174EA6;\n", | |
" --disabled-fill-color: #AAA;\n", | |
" --disabled-bg-color: #DDD;\n", | |
" }\n", | |
"\n", | |
" [theme=dark] .colab-df-quickchart {\n", | |
" --bg-color: #3B4455;\n", | |
" --fill-color: #D2E3FC;\n", | |
" --hover-bg-color: #434B5C;\n", | |
" --hover-fill-color: #FFFFFF;\n", | |
" --disabled-bg-color: #3B4455;\n", | |
" --disabled-fill-color: #666;\n", | |
" }\n", | |
"\n", | |
" .colab-df-quickchart {\n", | |
" background-color: var(--bg-color);\n", | |
" border: none;\n", | |
" border-radius: 50%;\n", | |
" cursor: pointer;\n", | |
" display: none;\n", | |
" fill: var(--fill-color);\n", | |
" height: 32px;\n", | |
" padding: 0;\n", | |
" width: 32px;\n", | |
" }\n", | |
"\n", | |
" .colab-df-quickchart:hover {\n", | |
" background-color: var(--hover-bg-color);\n", | |
" box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n", | |
" fill: var(--button-hover-fill-color);\n", | |
" }\n", | |
"\n", | |
" .colab-df-quickchart-complete:disabled,\n", | |
" .colab-df-quickchart-complete:disabled:hover {\n", | |
" background-color: var(--disabled-bg-color);\n", | |
" fill: var(--disabled-fill-color);\n", | |
" box-shadow: none;\n", | |
" }\n", | |
"\n", | |
" .colab-df-spinner {\n", | |
" border: 2px solid var(--fill-color);\n", | |
" border-color: transparent;\n", | |
" border-bottom-color: var(--fill-color);\n", | |
" animation:\n", | |
" spin 1s steps(1) infinite;\n", | |
" }\n", | |
"\n", | |
" @keyframes spin {\n", | |
" 0% {\n", | |
" border-color: transparent;\n", | |
" border-bottom-color: var(--fill-color);\n", | |
" border-left-color: var(--fill-color);\n", | |
" }\n", | |
" 20% {\n", | |
" border-color: transparent;\n", | |
" border-left-color: var(--fill-color);\n", | |
" border-top-color: var(--fill-color);\n", | |
" }\n", | |
" 30% {\n", | |
" border-color: transparent;\n", | |
" border-left-color: var(--fill-color);\n", | |
" border-top-color: var(--fill-color);\n", | |
" border-right-color: var(--fill-color);\n", | |
" }\n", | |
" 40% {\n", | |
" border-color: transparent;\n", | |
" border-right-color: var(--fill-color);\n", | |
" border-top-color: var(--fill-color);\n", | |
" }\n", | |
" 60% {\n", | |
" border-color: transparent;\n", | |
" border-right-color: var(--fill-color);\n", | |
" }\n", | |
" 80% {\n", | |
" border-color: transparent;\n", | |
" border-right-color: var(--fill-color);\n", | |
" border-bottom-color: var(--fill-color);\n", | |
" }\n", | |
" 90% {\n", | |
" border-color: transparent;\n", | |
" border-bottom-color: var(--fill-color);\n", | |
" }\n", | |
" }\n", | |
"</style>\n", | |
"\n", | |
" <script>\n", | |
" async function quickchart(key) {\n", | |
" const quickchartButtonEl =\n", | |
" document.querySelector('#' + key + ' button');\n", | |
" quickchartButtonEl.disabled = true; // To prevent multiple clicks.\n", | |
" quickchartButtonEl.classList.add('colab-df-spinner');\n", | |
" try {\n", | |
" const charts = await google.colab.kernel.invokeFunction(\n", | |
" 'suggestCharts', [key], {});\n", | |
" } catch (error) {\n", | |
" console.error('Error during call to suggestCharts:', error);\n", | |
" }\n", | |
" quickchartButtonEl.classList.remove('colab-df-spinner');\n", | |
" quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n", | |
" }\n", | |
" (() => {\n", | |
" let quickchartButtonEl =\n", | |
" document.querySelector('#df-2f10f619-3677-4016-b91b-cb315837262b button');\n", | |
" quickchartButtonEl.style.display =\n", | |
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n", | |
" })();\n", | |
" </script>\n", | |
" </div>\n", | |
"\n", | |
" </div>\n", | |
" </div>\n" | |
], | |
"application/vnd.google.colaboratory.intrinsic+json": { | |
"type": "dataframe" | |
} | |
}, | |
"metadata": {}, | |
"execution_count": 6 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [], | |
"metadata": { | |
"id": "OE-xnh1UScYQ" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
} | |
], | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"display_name": "Python 3", | |
"name": "python3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment