Python/other/Food wastage analysis from 1961-2013 (FAO).ipynb

5917 lines
916 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "1eecdb4a-89ca-4a1e-9c4c-7c44b2e628a1",
"_uuid": "110a8132a8179a9bed2fc8f1096592dc791f1661"
},
"source": [
"# About the dataset\n",
"\n",
"Context\n",
"Our world population is expected to grow from 7.3 billion today to 9.7 billion in the year 2050. Finding solutions for feeding the growing world population has become a hot topic for food and agriculture organizations, entrepreneurs and philanthropists. These solutions range from changing the way we grow our food to changing the way we eat. To make things harder, the world's climate is changing and it is both affecting and affected by the way we grow our food agriculture. This dataset provides an insight on our worldwide food production - focusing on a comparison between food produced for human consumption and feed produced for animals.\n",
"\n",
"Content\n",
"The Food and Agriculture Organization of the United Nations provides free access to food and agriculture data for over 245 countries and territories, from the year 1961 to the most recent update (depends on the dataset). One dataset from the FAO's database is the Food Balance Sheets. It presents a comprehensive picture of the pattern of a country's food supply during a specified reference period, the last time an update was loaded to the FAO database was in 2013. The food balance sheet shows for each food item the sources of supply and its utilization. This chunk of the dataset is focused on two utilizations of each food item available:\n",
"\n",
"Food - refers to the total amount of the food item available as human food during the reference period.\n",
"Feed - refers to the quantity of the food item available for feeding to the livestock and poultry during the reference period.\n",
"Dataset's attributes:\n",
"\n",
"Area code - Country name abbreviation\n",
"Area - County name\n",
"Item - Food item\n",
"Element - Food or Feed\n",
"Latitude - geographic coordinate that specifies the northsouth position of a point on the Earth's surface\n",
"Longitude - geographic coordinate that specifies the east-west position of a point on the Earth's surface\n",
"Production per year - Amount of food item produced in 1000 tonnes\n",
"\n",
"This is a simple exploratory notebook that heavily expolits pandas and seaborn"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
"_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5"
},
"outputs": [],
"source": [
"# Importing libraries\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"%matplotlib inline\n",
"# importing data\n",
"df = pd.read_csv(\"FAO.csv\", encoding = \"ISO-8859-1\")\n",
"pd.options.mode.chained_assignment = None\n",
"from sklearn.linear_model import LinearRegression"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<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>Area Abbreviation</th>\n",
" <th>Area Code</th>\n",
" <th>Area</th>\n",
" <th>Item Code</th>\n",
" <th>Item</th>\n",
" <th>Element Code</th>\n",
" <th>Element</th>\n",
" <th>Unit</th>\n",
" <th>latitude</th>\n",
" <th>longitude</th>\n",
" <th>...</th>\n",
" <th>Y2004</th>\n",
" <th>Y2005</th>\n",
" <th>Y2006</th>\n",
" <th>Y2007</th>\n",
" <th>Y2008</th>\n",
" <th>Y2009</th>\n",
" <th>Y2010</th>\n",
" <th>Y2011</th>\n",
" <th>Y2012</th>\n",
" <th>Y2013</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2511</td>\n",
" <td>Wheat and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>3249.0</td>\n",
" <td>3486.0</td>\n",
" <td>3704.0</td>\n",
" <td>4164.0</td>\n",
" <td>4252.0</td>\n",
" <td>4538.0</td>\n",
" <td>4605.0</td>\n",
" <td>4711.0</td>\n",
" <td>4810</td>\n",
" <td>4895</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2805</td>\n",
" <td>Rice (Milled Equivalent)</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>419.0</td>\n",
" <td>445.0</td>\n",
" <td>546.0</td>\n",
" <td>455.0</td>\n",
" <td>490.0</td>\n",
" <td>415.0</td>\n",
" <td>442.0</td>\n",
" <td>476.0</td>\n",
" <td>425</td>\n",
" <td>422</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2513</td>\n",
" <td>Barley and products</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>58.0</td>\n",
" <td>236.0</td>\n",
" <td>262.0</td>\n",
" <td>263.0</td>\n",
" <td>230.0</td>\n",
" <td>379.0</td>\n",
" <td>315.0</td>\n",
" <td>203.0</td>\n",
" <td>367</td>\n",
" <td>360</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2513</td>\n",
" <td>Barley and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>185.0</td>\n",
" <td>43.0</td>\n",
" <td>44.0</td>\n",
" <td>48.0</td>\n",
" <td>62.0</td>\n",
" <td>55.0</td>\n",
" <td>60.0</td>\n",
" <td>72.0</td>\n",
" <td>78</td>\n",
" <td>89</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2514</td>\n",
" <td>Maize and products</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>120.0</td>\n",
" <td>208.0</td>\n",
" <td>233.0</td>\n",
" <td>249.0</td>\n",
" <td>247.0</td>\n",
" <td>195.0</td>\n",
" <td>178.0</td>\n",
" <td>191.0</td>\n",
" <td>200</td>\n",
" <td>200</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2514</td>\n",
" <td>Maize and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>231.0</td>\n",
" <td>67.0</td>\n",
" <td>82.0</td>\n",
" <td>67.0</td>\n",
" <td>69.0</td>\n",
" <td>71.0</td>\n",
" <td>82.0</td>\n",
" <td>73.0</td>\n",
" <td>77</td>\n",
" <td>76</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2517</td>\n",
" <td>Millet and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>15.0</td>\n",
" <td>21.0</td>\n",
" <td>11.0</td>\n",
" <td>19.0</td>\n",
" <td>21.0</td>\n",
" <td>18.0</td>\n",
" <td>14.0</td>\n",
" <td>14.0</td>\n",
" <td>14</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2520</td>\n",
" <td>Cereals, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>2.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2531</td>\n",
" <td>Potatoes and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>276.0</td>\n",
" <td>294.0</td>\n",
" <td>294.0</td>\n",
" <td>260.0</td>\n",
" <td>242.0</td>\n",
" <td>250.0</td>\n",
" <td>192.0</td>\n",
" <td>169.0</td>\n",
" <td>196</td>\n",
" <td>230</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2536</td>\n",
" <td>Sugar cane</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>50.0</td>\n",
" <td>29.0</td>\n",
" <td>61.0</td>\n",
" <td>65.0</td>\n",
" <td>54.0</td>\n",
" <td>114.0</td>\n",
" <td>83.0</td>\n",
" <td>83.0</td>\n",
" <td>69</td>\n",
" <td>81</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2537</td>\n",
" <td>Sugar beet</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2542</td>\n",
" <td>Sugar (Raw Equivalent)</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>124.0</td>\n",
" <td>152.0</td>\n",
" <td>169.0</td>\n",
" <td>192.0</td>\n",
" <td>217.0</td>\n",
" <td>231.0</td>\n",
" <td>240.0</td>\n",
" <td>240.0</td>\n",
" <td>250</td>\n",
" <td>255</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2543</td>\n",
" <td>Sweeteners, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>9.0</td>\n",
" <td>15.0</td>\n",
" <td>12.0</td>\n",
" <td>6.0</td>\n",
" <td>11.0</td>\n",
" <td>2.0</td>\n",
" <td>9.0</td>\n",
" <td>21.0</td>\n",
" <td>24</td>\n",
" <td>16</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2745</td>\n",
" <td>Honey</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>2.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2549</td>\n",
" <td>Pulses, Other and products</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>3.0</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>5.0</td>\n",
" <td>4.0</td>\n",
" <td>5.0</td>\n",
" <td>4</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2549</td>\n",
" <td>Pulses, Other and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>17.0</td>\n",
" <td>35.0</td>\n",
" <td>37.0</td>\n",
" <td>40.0</td>\n",
" <td>54.0</td>\n",
" <td>80.0</td>\n",
" <td>66.0</td>\n",
" <td>81.0</td>\n",
" <td>63</td>\n",
" <td>74</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2551</td>\n",
" <td>Nuts and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>11.0</td>\n",
" <td>13.0</td>\n",
" <td>24.0</td>\n",
" <td>34.0</td>\n",
" <td>42.0</td>\n",
" <td>28.0</td>\n",
" <td>66.0</td>\n",
" <td>71.0</td>\n",
" <td>70</td>\n",
" <td>44</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2560</td>\n",
" <td>Coconuts - Incl Copra</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2561</td>\n",
" <td>Sesame seed</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>16.0</td>\n",
" <td>16.0</td>\n",
" <td>13.0</td>\n",
" <td>16.0</td>\n",
" <td>16.0</td>\n",
" <td>16.0</td>\n",
" <td>19.0</td>\n",
" <td>17.0</td>\n",
" <td>16</td>\n",
" <td>16</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2563</td>\n",
" <td>Olives (including preserved)</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2571</td>\n",
" <td>Soyabean Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>6.0</td>\n",
" <td>35.0</td>\n",
" <td>18.0</td>\n",
" <td>21.0</td>\n",
" <td>11.0</td>\n",
" <td>6.0</td>\n",
" <td>15.0</td>\n",
" <td>16.0</td>\n",
" <td>16</td>\n",
" <td>16</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2572</td>\n",
" <td>Groundnut Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2573</td>\n",
" <td>Sunflowerseed Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>4.0</td>\n",
" <td>6.0</td>\n",
" <td>5.0</td>\n",
" <td>9.0</td>\n",
" <td>3.0</td>\n",
" <td>8.0</td>\n",
" <td>15.0</td>\n",
" <td>16.0</td>\n",
" <td>17</td>\n",
" <td>23</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2574</td>\n",
" <td>Rape and Mustard Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>1.0</td>\n",
" <td>3.0</td>\n",
" <td>5.0</td>\n",
" <td>6.0</td>\n",
" <td>6.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2575</td>\n",
" <td>Cottonseed Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>4.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2577</td>\n",
" <td>Palm Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>71.0</td>\n",
" <td>69.0</td>\n",
" <td>56.0</td>\n",
" <td>51.0</td>\n",
" <td>36.0</td>\n",
" <td>53.0</td>\n",
" <td>59.0</td>\n",
" <td>51.0</td>\n",
" <td>61</td>\n",
" <td>64</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2579</td>\n",
" <td>Sesameseed Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2580</td>\n",
" <td>Olive Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2586</td>\n",
" <td>Oilcrops Oil, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>3.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2601</td>\n",
" <td>Tomatoes and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>8.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</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>21447</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2765</td>\n",
" <td>Crustaceans</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21448</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2766</td>\n",
" <td>Cephalopods</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21449</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2767</td>\n",
" <td>Molluscs, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21450</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2775</td>\n",
" <td>Aquatic Plants</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21451</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2680</td>\n",
" <td>Infant food</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21452</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2905</td>\n",
" <td>Cereals - Excluding Beer</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>75.0</td>\n",
" <td>54.0</td>\n",
" <td>75.0</td>\n",
" <td>55.0</td>\n",
" <td>63.0</td>\n",
" <td>62.0</td>\n",
" <td>55.0</td>\n",
" <td>55.0</td>\n",
" <td>55</td>\n",
" <td>55</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21453</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2905</td>\n",
" <td>Cereals - Excluding Beer</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>1844.0</td>\n",
" <td>1842.0</td>\n",
" <td>1944.0</td>\n",
" <td>1962.0</td>\n",
" <td>1918.0</td>\n",
" <td>1980.0</td>\n",
" <td>2011.0</td>\n",
" <td>2094.0</td>\n",
" <td>2071</td>\n",
" <td>2016</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21454</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2907</td>\n",
" <td>Starchy Roots</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>223.0</td>\n",
" <td>236.0</td>\n",
" <td>238.0</td>\n",
" <td>228.0</td>\n",
" <td>245.0</td>\n",
" <td>258.0</td>\n",
" <td>258.0</td>\n",
" <td>269.0</td>\n",
" <td>272</td>\n",
" <td>276</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21455</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2908</td>\n",
" <td>Sugar Crops</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21456</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2909</td>\n",
" <td>Sugar &amp; Sweeteners</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>335.0</td>\n",
" <td>313.0</td>\n",
" <td>339.0</td>\n",
" <td>302.0</td>\n",
" <td>285.0</td>\n",
" <td>287.0</td>\n",
" <td>314.0</td>\n",
" <td>336.0</td>\n",
" <td>396</td>\n",
" <td>416</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21457</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2911</td>\n",
" <td>Pulses</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>63.0</td>\n",
" <td>59.0</td>\n",
" <td>61.0</td>\n",
" <td>57.0</td>\n",
" <td>69.0</td>\n",
" <td>78.0</td>\n",
" <td>68.0</td>\n",
" <td>56.0</td>\n",
" <td>52</td>\n",
" <td>55</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21458</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2912</td>\n",
" <td>Treenuts</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" <td>4.0</td>\n",
" <td>2.0</td>\n",
" <td>4</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21459</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2913</td>\n",
" <td>Oilcrops</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>36.0</td>\n",
" <td>46.0</td>\n",
" <td>41.0</td>\n",
" <td>33.0</td>\n",
" <td>31.0</td>\n",
" <td>19.0</td>\n",
" <td>24.0</td>\n",
" <td>17.0</td>\n",
" <td>27</td>\n",
" <td>30</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21460</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2913</td>\n",
" <td>Oilcrops</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>60.0</td>\n",
" <td>59.0</td>\n",
" <td>61.0</td>\n",
" <td>62.0</td>\n",
" <td>48.0</td>\n",
" <td>44.0</td>\n",
" <td>41.0</td>\n",
" <td>40.0</td>\n",
" <td>38</td>\n",
" <td>38</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21461</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2914</td>\n",
" <td>Vegetable Oils</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>111.0</td>\n",
" <td>114.0</td>\n",
" <td>112.0</td>\n",
" <td>114.0</td>\n",
" <td>134.0</td>\n",
" <td>135.0</td>\n",
" <td>137.0</td>\n",
" <td>147.0</td>\n",
" <td>159</td>\n",
" <td>160</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21462</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2918</td>\n",
" <td>Vegetables</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>161.0</td>\n",
" <td>166.0</td>\n",
" <td>208.0</td>\n",
" <td>185.0</td>\n",
" <td>137.0</td>\n",
" <td>179.0</td>\n",
" <td>215.0</td>\n",
" <td>217.0</td>\n",
" <td>227</td>\n",
" <td>227</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21463</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2919</td>\n",
" <td>Fruits - Excluding Wine</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>191.0</td>\n",
" <td>134.0</td>\n",
" <td>167.0</td>\n",
" <td>177.0</td>\n",
" <td>185.0</td>\n",
" <td>184.0</td>\n",
" <td>211.0</td>\n",
" <td>230.0</td>\n",
" <td>246</td>\n",
" <td>217</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21464</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2922</td>\n",
" <td>Stimulants</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>7.0</td>\n",
" <td>21.0</td>\n",
" <td>14.0</td>\n",
" <td>24.0</td>\n",
" <td>16.0</td>\n",
" <td>11.0</td>\n",
" <td>23.0</td>\n",
" <td>11.0</td>\n",
" <td>10</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21465</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2923</td>\n",
" <td>Spices</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>7.0</td>\n",
" <td>11.0</td>\n",
" <td>7.0</td>\n",
" <td>12.0</td>\n",
" <td>16.0</td>\n",
" <td>16.0</td>\n",
" <td>14.0</td>\n",
" <td>11.0</td>\n",
" <td>12</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21466</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2924</td>\n",
" <td>Alcoholic Beverages</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>294.0</td>\n",
" <td>290.0</td>\n",
" <td>316.0</td>\n",
" <td>355.0</td>\n",
" <td>398.0</td>\n",
" <td>437.0</td>\n",
" <td>448.0</td>\n",
" <td>476.0</td>\n",
" <td>525</td>\n",
" <td>516</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21467</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2943</td>\n",
" <td>Meat</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>222.0</td>\n",
" <td>228.0</td>\n",
" <td>233.0</td>\n",
" <td>238.0</td>\n",
" <td>242.0</td>\n",
" <td>265.0</td>\n",
" <td>262.0</td>\n",
" <td>277.0</td>\n",
" <td>280</td>\n",
" <td>258</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21468</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2945</td>\n",
" <td>Offals</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>20.0</td>\n",
" <td>20.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>22</td>\n",
" <td>22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21469</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2946</td>\n",
" <td>Animal fats</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>26.0</td>\n",
" <td>26.0</td>\n",
" <td>29.0</td>\n",
" <td>29.0</td>\n",
" <td>27.0</td>\n",
" <td>31.0</td>\n",
" <td>30.0</td>\n",
" <td>25.0</td>\n",
" <td>26</td>\n",
" <td>20</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21470</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2949</td>\n",
" <td>Eggs</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>15.0</td>\n",
" <td>18.0</td>\n",
" <td>18.0</td>\n",
" <td>21.0</td>\n",
" <td>22.0</td>\n",
" <td>27.0</td>\n",
" <td>27.0</td>\n",
" <td>24.0</td>\n",
" <td>24</td>\n",
" <td>25</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21471</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2948</td>\n",
" <td>Milk - Excluding Butter</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>23.0</td>\n",
" <td>25.0</td>\n",
" <td>25.0</td>\n",
" <td>30</td>\n",
" <td>31</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21472</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2948</td>\n",
" <td>Milk - Excluding Butter</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>373.0</td>\n",
" <td>357.0</td>\n",
" <td>359.0</td>\n",
" <td>356.0</td>\n",
" <td>341.0</td>\n",
" <td>385.0</td>\n",
" <td>418.0</td>\n",
" <td>457.0</td>\n",
" <td>426</td>\n",
" <td>451</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21473</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2960</td>\n",
" <td>Fish, Seafood</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>5.0</td>\n",
" <td>4.0</td>\n",
" <td>9.0</td>\n",
" <td>6.0</td>\n",
" <td>9.0</td>\n",
" <td>5.0</td>\n",
" <td>15.0</td>\n",
" <td>15.0</td>\n",
" <td>15</td>\n",
" <td>15</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21474</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2960</td>\n",
" <td>Fish, Seafood</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>18.0</td>\n",
" <td>14.0</td>\n",
" <td>17.0</td>\n",
" <td>14.0</td>\n",
" <td>15.0</td>\n",
" <td>18.0</td>\n",
" <td>29.0</td>\n",
" <td>40.0</td>\n",
" <td>40</td>\n",
" <td>40</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21475</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2961</td>\n",
" <td>Aquatic Products, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21476</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2928</td>\n",
" <td>Miscellaneous</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>21477 rows × 63 columns</p>\n",
"</div>"
],
"text/plain": [
" Area Abbreviation Area Code Area Item Code \\\n",
"0 AFG 2 Afghanistan 2511 \n",
"1 AFG 2 Afghanistan 2805 \n",
"2 AFG 2 Afghanistan 2513 \n",
"3 AFG 2 Afghanistan 2513 \n",
"4 AFG 2 Afghanistan 2514 \n",
"5 AFG 2 Afghanistan 2514 \n",
"6 AFG 2 Afghanistan 2517 \n",
"7 AFG 2 Afghanistan 2520 \n",
"8 AFG 2 Afghanistan 2531 \n",
"9 AFG 2 Afghanistan 2536 \n",
"10 AFG 2 Afghanistan 2537 \n",
"11 AFG 2 Afghanistan 2542 \n",
"12 AFG 2 Afghanistan 2543 \n",
"13 AFG 2 Afghanistan 2745 \n",
"14 AFG 2 Afghanistan 2549 \n",
"15 AFG 2 Afghanistan 2549 \n",
"16 AFG 2 Afghanistan 2551 \n",
"17 AFG 2 Afghanistan 2560 \n",
"18 AFG 2 Afghanistan 2561 \n",
"19 AFG 2 Afghanistan 2563 \n",
"20 AFG 2 Afghanistan 2571 \n",
"21 AFG 2 Afghanistan 2572 \n",
"22 AFG 2 Afghanistan 2573 \n",
"23 AFG 2 Afghanistan 2574 \n",
"24 AFG 2 Afghanistan 2575 \n",
"25 AFG 2 Afghanistan 2577 \n",
"26 AFG 2 Afghanistan 2579 \n",
"27 AFG 2 Afghanistan 2580 \n",
"28 AFG 2 Afghanistan 2586 \n",
"29 AFG 2 Afghanistan 2601 \n",
"... ... ... ... ... \n",
"21447 ZWE 181 Zimbabwe 2765 \n",
"21448 ZWE 181 Zimbabwe 2766 \n",
"21449 ZWE 181 Zimbabwe 2767 \n",
"21450 ZWE 181 Zimbabwe 2775 \n",
"21451 ZWE 181 Zimbabwe 2680 \n",
"21452 ZWE 181 Zimbabwe 2905 \n",
"21453 ZWE 181 Zimbabwe 2905 \n",
"21454 ZWE 181 Zimbabwe 2907 \n",
"21455 ZWE 181 Zimbabwe 2908 \n",
"21456 ZWE 181 Zimbabwe 2909 \n",
"21457 ZWE 181 Zimbabwe 2911 \n",
"21458 ZWE 181 Zimbabwe 2912 \n",
"21459 ZWE 181 Zimbabwe 2913 \n",
"21460 ZWE 181 Zimbabwe 2913 \n",
"21461 ZWE 181 Zimbabwe 2914 \n",
"21462 ZWE 181 Zimbabwe 2918 \n",
"21463 ZWE 181 Zimbabwe 2919 \n",
"21464 ZWE 181 Zimbabwe 2922 \n",
"21465 ZWE 181 Zimbabwe 2923 \n",
"21466 ZWE 181 Zimbabwe 2924 \n",
"21467 ZWE 181 Zimbabwe 2943 \n",
"21468 ZWE 181 Zimbabwe 2945 \n",
"21469 ZWE 181 Zimbabwe 2946 \n",
"21470 ZWE 181 Zimbabwe 2949 \n",
"21471 ZWE 181 Zimbabwe 2948 \n",
"21472 ZWE 181 Zimbabwe 2948 \n",
"21473 ZWE 181 Zimbabwe 2960 \n",
"21474 ZWE 181 Zimbabwe 2960 \n",
"21475 ZWE 181 Zimbabwe 2961 \n",
"21476 ZWE 181 Zimbabwe 2928 \n",
"\n",
" Item Element Code Element Unit \\\n",
"0 Wheat and products 5142 Food 1000 tonnes \n",
"1 Rice (Milled Equivalent) 5142 Food 1000 tonnes \n",
"2 Barley and products 5521 Feed 1000 tonnes \n",
"3 Barley and products 5142 Food 1000 tonnes \n",
"4 Maize and products 5521 Feed 1000 tonnes \n",
"5 Maize and products 5142 Food 1000 tonnes \n",
"6 Millet and products 5142 Food 1000 tonnes \n",
"7 Cereals, Other 5142 Food 1000 tonnes \n",
"8 Potatoes and products 5142 Food 1000 tonnes \n",
"9 Sugar cane 5521 Feed 1000 tonnes \n",
"10 Sugar beet 5521 Feed 1000 tonnes \n",
"11 Sugar (Raw Equivalent) 5142 Food 1000 tonnes \n",
"12 Sweeteners, Other 5142 Food 1000 tonnes \n",
"13 Honey 5142 Food 1000 tonnes \n",
"14 Pulses, Other and products 5521 Feed 1000 tonnes \n",
"15 Pulses, Other and products 5142 Food 1000 tonnes \n",
"16 Nuts and products 5142 Food 1000 tonnes \n",
"17 Coconuts - Incl Copra 5142 Food 1000 tonnes \n",
"18 Sesame seed 5142 Food 1000 tonnes \n",
"19 Olives (including preserved) 5142 Food 1000 tonnes \n",
"20 Soyabean Oil 5142 Food 1000 tonnes \n",
"21 Groundnut Oil 5142 Food 1000 tonnes \n",
"22 Sunflowerseed Oil 5142 Food 1000 tonnes \n",
"23 Rape and Mustard Oil 5142 Food 1000 tonnes \n",
"24 Cottonseed Oil 5142 Food 1000 tonnes \n",
"25 Palm Oil 5142 Food 1000 tonnes \n",
"26 Sesameseed Oil 5142 Food 1000 tonnes \n",
"27 Olive Oil 5142 Food 1000 tonnes \n",
"28 Oilcrops Oil, Other 5142 Food 1000 tonnes \n",
"29 Tomatoes and products 5142 Food 1000 tonnes \n",
"... ... ... ... ... \n",
"21447 Crustaceans 5142 Food 1000 tonnes \n",
"21448 Cephalopods 5142 Food 1000 tonnes \n",
"21449 Molluscs, Other 5142 Food 1000 tonnes \n",
"21450 Aquatic Plants 5142 Food 1000 tonnes \n",
"21451 Infant food 5142 Food 1000 tonnes \n",
"21452 Cereals - Excluding Beer 5521 Feed 1000 tonnes \n",
"21453 Cereals - Excluding Beer 5142 Food 1000 tonnes \n",
"21454 Starchy Roots 5142 Food 1000 tonnes \n",
"21455 Sugar Crops 5142 Food 1000 tonnes \n",
"21456 Sugar & Sweeteners 5142 Food 1000 tonnes \n",
"21457 Pulses 5142 Food 1000 tonnes \n",
"21458 Treenuts 5142 Food 1000 tonnes \n",
"21459 Oilcrops 5521 Feed 1000 tonnes \n",
"21460 Oilcrops 5142 Food 1000 tonnes \n",
"21461 Vegetable Oils 5142 Food 1000 tonnes \n",
"21462 Vegetables 5142 Food 1000 tonnes \n",
"21463 Fruits - Excluding Wine 5142 Food 1000 tonnes \n",
"21464 Stimulants 5142 Food 1000 tonnes \n",
"21465 Spices 5142 Food 1000 tonnes \n",
"21466 Alcoholic Beverages 5142 Food 1000 tonnes \n",
"21467 Meat 5142 Food 1000 tonnes \n",
"21468 Offals 5142 Food 1000 tonnes \n",
"21469 Animal fats 5142 Food 1000 tonnes \n",
"21470 Eggs 5142 Food 1000 tonnes \n",
"21471 Milk - Excluding Butter 5521 Feed 1000 tonnes \n",
"21472 Milk - Excluding Butter 5142 Food 1000 tonnes \n",
"21473 Fish, Seafood 5521 Feed 1000 tonnes \n",
"21474 Fish, Seafood 5142 Food 1000 tonnes \n",
"21475 Aquatic Products, Other 5142 Food 1000 tonnes \n",
"21476 Miscellaneous 5142 Food 1000 tonnes \n",
"\n",
" latitude longitude ... Y2004 Y2005 Y2006 Y2007 Y2008 \\\n",
"0 33.94 67.71 ... 3249.0 3486.0 3704.0 4164.0 4252.0 \n",
"1 33.94 67.71 ... 419.0 445.0 546.0 455.0 490.0 \n",
"2 33.94 67.71 ... 58.0 236.0 262.0 263.0 230.0 \n",
"3 33.94 67.71 ... 185.0 43.0 44.0 48.0 62.0 \n",
"4 33.94 67.71 ... 120.0 208.0 233.0 249.0 247.0 \n",
"5 33.94 67.71 ... 231.0 67.0 82.0 67.0 69.0 \n",
"6 33.94 67.71 ... 15.0 21.0 11.0 19.0 21.0 \n",
"7 33.94 67.71 ... 2.0 1.0 1.0 0.0 0.0 \n",
"8 33.94 67.71 ... 276.0 294.0 294.0 260.0 242.0 \n",
"9 33.94 67.71 ... 50.0 29.0 61.0 65.0 54.0 \n",
"10 33.94 67.71 ... 0.0 0.0 0.0 0.0 0.0 \n",
"11 33.94 67.71 ... 124.0 152.0 169.0 192.0 217.0 \n",
"12 33.94 67.71 ... 9.0 15.0 12.0 6.0 11.0 \n",
"13 33.94 67.71 ... 3.0 3.0 3.0 3.0 3.0 \n",
"14 33.94 67.71 ... 3.0 2.0 3.0 3.0 3.0 \n",
"15 33.94 67.71 ... 17.0 35.0 37.0 40.0 54.0 \n",
"16 33.94 67.71 ... 11.0 13.0 24.0 34.0 42.0 \n",
"17 33.94 67.71 ... 0.0 0.0 0.0 0.0 0.0 \n",
"18 33.94 67.71 ... 16.0 16.0 13.0 16.0 16.0 \n",
"19 33.94 67.71 ... 1.0 1.0 0.0 0.0 2.0 \n",
"20 33.94 67.71 ... 6.0 35.0 18.0 21.0 11.0 \n",
"21 33.94 67.71 ... 0.0 0.0 0.0 0.0 0.0 \n",
"22 33.94 67.71 ... 4.0 6.0 5.0 9.0 3.0 \n",
"23 33.94 67.71 ... 0.0 1.0 3.0 5.0 6.0 \n",
"24 33.94 67.71 ... 2.0 3.0 3.0 3.0 3.0 \n",
"25 33.94 67.71 ... 71.0 69.0 56.0 51.0 36.0 \n",
"26 33.94 67.71 ... 1.0 1.0 1.0 2.0 2.0 \n",
"27 33.94 67.71 ... 0.0 0.0 0.0 0.0 0.0 \n",
"28 33.94 67.71 ... 0.0 1.0 0.0 0.0 3.0 \n",
"29 33.94 67.71 ... 2.0 2.0 8.0 1.0 0.0 \n",
"... ... ... ... ... ... ... ... ... \n",
"21447 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21448 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21449 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21450 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21451 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21452 -19.02 29.15 ... 75.0 54.0 75.0 55.0 63.0 \n",
"21453 -19.02 29.15 ... 1844.0 1842.0 1944.0 1962.0 1918.0 \n",
"21454 -19.02 29.15 ... 223.0 236.0 238.0 228.0 245.0 \n",
"21455 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21456 -19.02 29.15 ... 335.0 313.0 339.0 302.0 285.0 \n",
"21457 -19.02 29.15 ... 63.0 59.0 61.0 57.0 69.0 \n",
"21458 -19.02 29.15 ... 1.0 2.0 1.0 2.0 2.0 \n",
"21459 -19.02 29.15 ... 36.0 46.0 41.0 33.0 31.0 \n",
"21460 -19.02 29.15 ... 60.0 59.0 61.0 62.0 48.0 \n",
"21461 -19.02 29.15 ... 111.0 114.0 112.0 114.0 134.0 \n",
"21462 -19.02 29.15 ... 161.0 166.0 208.0 185.0 137.0 \n",
"21463 -19.02 29.15 ... 191.0 134.0 167.0 177.0 185.0 \n",
"21464 -19.02 29.15 ... 7.0 21.0 14.0 24.0 16.0 \n",
"21465 -19.02 29.15 ... 7.0 11.0 7.0 12.0 16.0 \n",
"21466 -19.02 29.15 ... 294.0 290.0 316.0 355.0 398.0 \n",
"21467 -19.02 29.15 ... 222.0 228.0 233.0 238.0 242.0 \n",
"21468 -19.02 29.15 ... 20.0 20.0 21.0 21.0 21.0 \n",
"21469 -19.02 29.15 ... 26.0 26.0 29.0 29.0 27.0 \n",
"21470 -19.02 29.15 ... 15.0 18.0 18.0 21.0 22.0 \n",
"21471 -19.02 29.15 ... 21.0 21.0 21.0 21.0 21.0 \n",
"21472 -19.02 29.15 ... 373.0 357.0 359.0 356.0 341.0 \n",
"21473 -19.02 29.15 ... 5.0 4.0 9.0 6.0 9.0 \n",
"21474 -19.02 29.15 ... 18.0 14.0 17.0 14.0 15.0 \n",
"21475 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21476 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"\n",
" Y2009 Y2010 Y2011 Y2012 Y2013 \n",
"0 4538.0 4605.0 4711.0 4810 4895 \n",
"1 415.0 442.0 476.0 425 422 \n",
"2 379.0 315.0 203.0 367 360 \n",
"3 55.0 60.0 72.0 78 89 \n",
"4 195.0 178.0 191.0 200 200 \n",
"5 71.0 82.0 73.0 77 76 \n",
"6 18.0 14.0 14.0 14 12 \n",
"7 0.0 0.0 0.0 0 0 \n",
"8 250.0 192.0 169.0 196 230 \n",
"9 114.0 83.0 83.0 69 81 \n",
"10 0.0 0.0 0.0 0 0 \n",
"11 231.0 240.0 240.0 250 255 \n",
"12 2.0 9.0 21.0 24 16 \n",
"13 3.0 3.0 2.0 2 2 \n",
"14 5.0 4.0 5.0 4 4 \n",
"15 80.0 66.0 81.0 63 74 \n",
"16 28.0 66.0 71.0 70 44 \n",
"17 0.0 0.0 0.0 0 0 \n",
"18 16.0 19.0 17.0 16 16 \n",
"19 3.0 2.0 2.0 2 2 \n",
"20 6.0 15.0 16.0 16 16 \n",
"21 0.0 0.0 0.0 0 0 \n",
"22 8.0 15.0 16.0 17 23 \n",
"23 6.0 1.0 2.0 2 2 \n",
"24 4.0 3.0 3.0 3 4 \n",
"25 53.0 59.0 51.0 61 64 \n",
"26 1.0 1.0 2.0 1 1 \n",
"27 1.0 1.0 1.0 1 1 \n",
"28 1.0 2.0 2.0 2 2 \n",
"29 0.0 0.0 0.0 0 0 \n",
"... ... ... ... ... ... \n",
"21447 0.0 0.0 0.0 0 0 \n",
"21448 0.0 0.0 0.0 0 0 \n",
"21449 0.0 1.0 0.0 0 0 \n",
"21450 0.0 0.0 0.0 0 0 \n",
"21451 0.0 0.0 0.0 0 0 \n",
"21452 62.0 55.0 55.0 55 55 \n",
"21453 1980.0 2011.0 2094.0 2071 2016 \n",
"21454 258.0 258.0 269.0 272 276 \n",
"21455 0.0 0.0 0.0 0 0 \n",
"21456 287.0 314.0 336.0 396 416 \n",
"21457 78.0 68.0 56.0 52 55 \n",
"21458 3.0 4.0 2.0 4 3 \n",
"21459 19.0 24.0 17.0 27 30 \n",
"21460 44.0 41.0 40.0 38 38 \n",
"21461 135.0 137.0 147.0 159 160 \n",
"21462 179.0 215.0 217.0 227 227 \n",
"21463 184.0 211.0 230.0 246 217 \n",
"21464 11.0 23.0 11.0 10 10 \n",
"21465 16.0 14.0 11.0 12 12 \n",
"21466 437.0 448.0 476.0 525 516 \n",
"21467 265.0 262.0 277.0 280 258 \n",
"21468 21.0 21.0 21.0 22 22 \n",
"21469 31.0 30.0 25.0 26 20 \n",
"21470 27.0 27.0 24.0 24 25 \n",
"21471 23.0 25.0 25.0 30 31 \n",
"21472 385.0 418.0 457.0 426 451 \n",
"21473 5.0 15.0 15.0 15 15 \n",
"21474 18.0 29.0 40.0 40 40 \n",
"21475 0.0 0.0 0.0 0 0 \n",
"21476 0.0 0.0 0.0 0 0 \n",
"\n",
"[21477 rows x 63 columns]"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "731a952c-b292-46e3-be7a-4afffe2b4ff1",
"_uuid": "5d165c279ce22afc0a874e32931d7b0ebb0717f9"
},
"source": [
"Let's see what the data looks like..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"_cell_guid": "79c7e3d0-c299-4dcb-8224-4455121ee9b0",
"_uuid": "d629ff2d2480ee46fbb7e2d37f6b5fab8052498a",
"scrolled": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "25c3f986-fd14-4a3f-baff-02571ad665eb",
"_uuid": "5a7da58320ab35ab1bcf83a62209afbe40b672fe"
},
"source": [
"# Plot for annual produce of different countries with quantity in y-axis and years in x-axis"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<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>Area Abbreviation</th>\n",
" <th>Area Code</th>\n",
" <th>Area</th>\n",
" <th>Item Code</th>\n",
" <th>Item</th>\n",
" <th>Element Code</th>\n",
" <th>Element</th>\n",
" <th>Unit</th>\n",
" <th>latitude</th>\n",
" <th>longitude</th>\n",
" <th>...</th>\n",
" <th>Y2004</th>\n",
" <th>Y2005</th>\n",
" <th>Y2006</th>\n",
" <th>Y2007</th>\n",
" <th>Y2008</th>\n",
" <th>Y2009</th>\n",
" <th>Y2010</th>\n",
" <th>Y2011</th>\n",
" <th>Y2012</th>\n",
" <th>Y2013</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2511</td>\n",
" <td>Wheat and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>3249.0</td>\n",
" <td>3486.0</td>\n",
" <td>3704.0</td>\n",
" <td>4164.0</td>\n",
" <td>4252.0</td>\n",
" <td>4538.0</td>\n",
" <td>4605.0</td>\n",
" <td>4711.0</td>\n",
" <td>4810</td>\n",
" <td>4895</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2805</td>\n",
" <td>Rice (Milled Equivalent)</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>419.0</td>\n",
" <td>445.0</td>\n",
" <td>546.0</td>\n",
" <td>455.0</td>\n",
" <td>490.0</td>\n",
" <td>415.0</td>\n",
" <td>442.0</td>\n",
" <td>476.0</td>\n",
" <td>425</td>\n",
" <td>422</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2513</td>\n",
" <td>Barley and products</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>58.0</td>\n",
" <td>236.0</td>\n",
" <td>262.0</td>\n",
" <td>263.0</td>\n",
" <td>230.0</td>\n",
" <td>379.0</td>\n",
" <td>315.0</td>\n",
" <td>203.0</td>\n",
" <td>367</td>\n",
" <td>360</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2513</td>\n",
" <td>Barley and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>185.0</td>\n",
" <td>43.0</td>\n",
" <td>44.0</td>\n",
" <td>48.0</td>\n",
" <td>62.0</td>\n",
" <td>55.0</td>\n",
" <td>60.0</td>\n",
" <td>72.0</td>\n",
" <td>78</td>\n",
" <td>89</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2514</td>\n",
" <td>Maize and products</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>120.0</td>\n",
" <td>208.0</td>\n",
" <td>233.0</td>\n",
" <td>249.0</td>\n",
" <td>247.0</td>\n",
" <td>195.0</td>\n",
" <td>178.0</td>\n",
" <td>191.0</td>\n",
" <td>200</td>\n",
" <td>200</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2514</td>\n",
" <td>Maize and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>231.0</td>\n",
" <td>67.0</td>\n",
" <td>82.0</td>\n",
" <td>67.0</td>\n",
" <td>69.0</td>\n",
" <td>71.0</td>\n",
" <td>82.0</td>\n",
" <td>73.0</td>\n",
" <td>77</td>\n",
" <td>76</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2517</td>\n",
" <td>Millet and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>15.0</td>\n",
" <td>21.0</td>\n",
" <td>11.0</td>\n",
" <td>19.0</td>\n",
" <td>21.0</td>\n",
" <td>18.0</td>\n",
" <td>14.0</td>\n",
" <td>14.0</td>\n",
" <td>14</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2520</td>\n",
" <td>Cereals, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>2.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2531</td>\n",
" <td>Potatoes and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>276.0</td>\n",
" <td>294.0</td>\n",
" <td>294.0</td>\n",
" <td>260.0</td>\n",
" <td>242.0</td>\n",
" <td>250.0</td>\n",
" <td>192.0</td>\n",
" <td>169.0</td>\n",
" <td>196</td>\n",
" <td>230</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2536</td>\n",
" <td>Sugar cane</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>50.0</td>\n",
" <td>29.0</td>\n",
" <td>61.0</td>\n",
" <td>65.0</td>\n",
" <td>54.0</td>\n",
" <td>114.0</td>\n",
" <td>83.0</td>\n",
" <td>83.0</td>\n",
" <td>69</td>\n",
" <td>81</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2537</td>\n",
" <td>Sugar beet</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2542</td>\n",
" <td>Sugar (Raw Equivalent)</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>124.0</td>\n",
" <td>152.0</td>\n",
" <td>169.0</td>\n",
" <td>192.0</td>\n",
" <td>217.0</td>\n",
" <td>231.0</td>\n",
" <td>240.0</td>\n",
" <td>240.0</td>\n",
" <td>250</td>\n",
" <td>255</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2543</td>\n",
" <td>Sweeteners, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>9.0</td>\n",
" <td>15.0</td>\n",
" <td>12.0</td>\n",
" <td>6.0</td>\n",
" <td>11.0</td>\n",
" <td>2.0</td>\n",
" <td>9.0</td>\n",
" <td>21.0</td>\n",
" <td>24</td>\n",
" <td>16</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2745</td>\n",
" <td>Honey</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>2.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2549</td>\n",
" <td>Pulses, Other and products</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>3.0</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>5.0</td>\n",
" <td>4.0</td>\n",
" <td>5.0</td>\n",
" <td>4</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2549</td>\n",
" <td>Pulses, Other and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>17.0</td>\n",
" <td>35.0</td>\n",
" <td>37.0</td>\n",
" <td>40.0</td>\n",
" <td>54.0</td>\n",
" <td>80.0</td>\n",
" <td>66.0</td>\n",
" <td>81.0</td>\n",
" <td>63</td>\n",
" <td>74</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2551</td>\n",
" <td>Nuts and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>11.0</td>\n",
" <td>13.0</td>\n",
" <td>24.0</td>\n",
" <td>34.0</td>\n",
" <td>42.0</td>\n",
" <td>28.0</td>\n",
" <td>66.0</td>\n",
" <td>71.0</td>\n",
" <td>70</td>\n",
" <td>44</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2560</td>\n",
" <td>Coconuts - Incl Copra</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2561</td>\n",
" <td>Sesame seed</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>16.0</td>\n",
" <td>16.0</td>\n",
" <td>13.0</td>\n",
" <td>16.0</td>\n",
" <td>16.0</td>\n",
" <td>16.0</td>\n",
" <td>19.0</td>\n",
" <td>17.0</td>\n",
" <td>16</td>\n",
" <td>16</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2563</td>\n",
" <td>Olives (including preserved)</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2571</td>\n",
" <td>Soyabean Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>6.0</td>\n",
" <td>35.0</td>\n",
" <td>18.0</td>\n",
" <td>21.0</td>\n",
" <td>11.0</td>\n",
" <td>6.0</td>\n",
" <td>15.0</td>\n",
" <td>16.0</td>\n",
" <td>16</td>\n",
" <td>16</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2572</td>\n",
" <td>Groundnut Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2573</td>\n",
" <td>Sunflowerseed Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>4.0</td>\n",
" <td>6.0</td>\n",
" <td>5.0</td>\n",
" <td>9.0</td>\n",
" <td>3.0</td>\n",
" <td>8.0</td>\n",
" <td>15.0</td>\n",
" <td>16.0</td>\n",
" <td>17</td>\n",
" <td>23</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2574</td>\n",
" <td>Rape and Mustard Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>1.0</td>\n",
" <td>3.0</td>\n",
" <td>5.0</td>\n",
" <td>6.0</td>\n",
" <td>6.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2575</td>\n",
" <td>Cottonseed Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>4.0</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2577</td>\n",
" <td>Palm Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>71.0</td>\n",
" <td>69.0</td>\n",
" <td>56.0</td>\n",
" <td>51.0</td>\n",
" <td>36.0</td>\n",
" <td>53.0</td>\n",
" <td>59.0</td>\n",
" <td>51.0</td>\n",
" <td>61</td>\n",
" <td>64</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2579</td>\n",
" <td>Sesameseed Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2580</td>\n",
" <td>Olive Oil</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>1.0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2586</td>\n",
" <td>Oilcrops Oil, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>3.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>AFG</td>\n",
" <td>2</td>\n",
" <td>Afghanistan</td>\n",
" <td>2601</td>\n",
" <td>Tomatoes and products</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>33.94</td>\n",
" <td>67.71</td>\n",
" <td>...</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>8.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</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>21447</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2765</td>\n",
" <td>Crustaceans</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21448</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2766</td>\n",
" <td>Cephalopods</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21449</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2767</td>\n",
" <td>Molluscs, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21450</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2775</td>\n",
" <td>Aquatic Plants</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21451</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2680</td>\n",
" <td>Infant food</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21452</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2905</td>\n",
" <td>Cereals - Excluding Beer</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>75.0</td>\n",
" <td>54.0</td>\n",
" <td>75.0</td>\n",
" <td>55.0</td>\n",
" <td>63.0</td>\n",
" <td>62.0</td>\n",
" <td>55.0</td>\n",
" <td>55.0</td>\n",
" <td>55</td>\n",
" <td>55</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21453</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2905</td>\n",
" <td>Cereals - Excluding Beer</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>1844.0</td>\n",
" <td>1842.0</td>\n",
" <td>1944.0</td>\n",
" <td>1962.0</td>\n",
" <td>1918.0</td>\n",
" <td>1980.0</td>\n",
" <td>2011.0</td>\n",
" <td>2094.0</td>\n",
" <td>2071</td>\n",
" <td>2016</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21454</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2907</td>\n",
" <td>Starchy Roots</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>223.0</td>\n",
" <td>236.0</td>\n",
" <td>238.0</td>\n",
" <td>228.0</td>\n",
" <td>245.0</td>\n",
" <td>258.0</td>\n",
" <td>258.0</td>\n",
" <td>269.0</td>\n",
" <td>272</td>\n",
" <td>276</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21455</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2908</td>\n",
" <td>Sugar Crops</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21456</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2909</td>\n",
" <td>Sugar &amp; Sweeteners</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>335.0</td>\n",
" <td>313.0</td>\n",
" <td>339.0</td>\n",
" <td>302.0</td>\n",
" <td>285.0</td>\n",
" <td>287.0</td>\n",
" <td>314.0</td>\n",
" <td>336.0</td>\n",
" <td>396</td>\n",
" <td>416</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21457</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2911</td>\n",
" <td>Pulses</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>63.0</td>\n",
" <td>59.0</td>\n",
" <td>61.0</td>\n",
" <td>57.0</td>\n",
" <td>69.0</td>\n",
" <td>78.0</td>\n",
" <td>68.0</td>\n",
" <td>56.0</td>\n",
" <td>52</td>\n",
" <td>55</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21458</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2912</td>\n",
" <td>Treenuts</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" <td>3.0</td>\n",
" <td>4.0</td>\n",
" <td>2.0</td>\n",
" <td>4</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21459</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2913</td>\n",
" <td>Oilcrops</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>36.0</td>\n",
" <td>46.0</td>\n",
" <td>41.0</td>\n",
" <td>33.0</td>\n",
" <td>31.0</td>\n",
" <td>19.0</td>\n",
" <td>24.0</td>\n",
" <td>17.0</td>\n",
" <td>27</td>\n",
" <td>30</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21460</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2913</td>\n",
" <td>Oilcrops</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>60.0</td>\n",
" <td>59.0</td>\n",
" <td>61.0</td>\n",
" <td>62.0</td>\n",
" <td>48.0</td>\n",
" <td>44.0</td>\n",
" <td>41.0</td>\n",
" <td>40.0</td>\n",
" <td>38</td>\n",
" <td>38</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21461</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2914</td>\n",
" <td>Vegetable Oils</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>111.0</td>\n",
" <td>114.0</td>\n",
" <td>112.0</td>\n",
" <td>114.0</td>\n",
" <td>134.0</td>\n",
" <td>135.0</td>\n",
" <td>137.0</td>\n",
" <td>147.0</td>\n",
" <td>159</td>\n",
" <td>160</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21462</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2918</td>\n",
" <td>Vegetables</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>161.0</td>\n",
" <td>166.0</td>\n",
" <td>208.0</td>\n",
" <td>185.0</td>\n",
" <td>137.0</td>\n",
" <td>179.0</td>\n",
" <td>215.0</td>\n",
" <td>217.0</td>\n",
" <td>227</td>\n",
" <td>227</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21463</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2919</td>\n",
" <td>Fruits - Excluding Wine</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>191.0</td>\n",
" <td>134.0</td>\n",
" <td>167.0</td>\n",
" <td>177.0</td>\n",
" <td>185.0</td>\n",
" <td>184.0</td>\n",
" <td>211.0</td>\n",
" <td>230.0</td>\n",
" <td>246</td>\n",
" <td>217</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21464</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2922</td>\n",
" <td>Stimulants</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>7.0</td>\n",
" <td>21.0</td>\n",
" <td>14.0</td>\n",
" <td>24.0</td>\n",
" <td>16.0</td>\n",
" <td>11.0</td>\n",
" <td>23.0</td>\n",
" <td>11.0</td>\n",
" <td>10</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21465</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2923</td>\n",
" <td>Spices</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>7.0</td>\n",
" <td>11.0</td>\n",
" <td>7.0</td>\n",
" <td>12.0</td>\n",
" <td>16.0</td>\n",
" <td>16.0</td>\n",
" <td>14.0</td>\n",
" <td>11.0</td>\n",
" <td>12</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21466</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2924</td>\n",
" <td>Alcoholic Beverages</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>294.0</td>\n",
" <td>290.0</td>\n",
" <td>316.0</td>\n",
" <td>355.0</td>\n",
" <td>398.0</td>\n",
" <td>437.0</td>\n",
" <td>448.0</td>\n",
" <td>476.0</td>\n",
" <td>525</td>\n",
" <td>516</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21467</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2943</td>\n",
" <td>Meat</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>222.0</td>\n",
" <td>228.0</td>\n",
" <td>233.0</td>\n",
" <td>238.0</td>\n",
" <td>242.0</td>\n",
" <td>265.0</td>\n",
" <td>262.0</td>\n",
" <td>277.0</td>\n",
" <td>280</td>\n",
" <td>258</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21468</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2945</td>\n",
" <td>Offals</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>20.0</td>\n",
" <td>20.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>22</td>\n",
" <td>22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21469</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2946</td>\n",
" <td>Animal fats</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>26.0</td>\n",
" <td>26.0</td>\n",
" <td>29.0</td>\n",
" <td>29.0</td>\n",
" <td>27.0</td>\n",
" <td>31.0</td>\n",
" <td>30.0</td>\n",
" <td>25.0</td>\n",
" <td>26</td>\n",
" <td>20</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21470</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2949</td>\n",
" <td>Eggs</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>15.0</td>\n",
" <td>18.0</td>\n",
" <td>18.0</td>\n",
" <td>21.0</td>\n",
" <td>22.0</td>\n",
" <td>27.0</td>\n",
" <td>27.0</td>\n",
" <td>24.0</td>\n",
" <td>24</td>\n",
" <td>25</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21471</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2948</td>\n",
" <td>Milk - Excluding Butter</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>21.0</td>\n",
" <td>23.0</td>\n",
" <td>25.0</td>\n",
" <td>25.0</td>\n",
" <td>30</td>\n",
" <td>31</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21472</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2948</td>\n",
" <td>Milk - Excluding Butter</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>373.0</td>\n",
" <td>357.0</td>\n",
" <td>359.0</td>\n",
" <td>356.0</td>\n",
" <td>341.0</td>\n",
" <td>385.0</td>\n",
" <td>418.0</td>\n",
" <td>457.0</td>\n",
" <td>426</td>\n",
" <td>451</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21473</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2960</td>\n",
" <td>Fish, Seafood</td>\n",
" <td>5521</td>\n",
" <td>Feed</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>5.0</td>\n",
" <td>4.0</td>\n",
" <td>9.0</td>\n",
" <td>6.0</td>\n",
" <td>9.0</td>\n",
" <td>5.0</td>\n",
" <td>15.0</td>\n",
" <td>15.0</td>\n",
" <td>15</td>\n",
" <td>15</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21474</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2960</td>\n",
" <td>Fish, Seafood</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>18.0</td>\n",
" <td>14.0</td>\n",
" <td>17.0</td>\n",
" <td>14.0</td>\n",
" <td>15.0</td>\n",
" <td>18.0</td>\n",
" <td>29.0</td>\n",
" <td>40.0</td>\n",
" <td>40</td>\n",
" <td>40</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21475</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2961</td>\n",
" <td>Aquatic Products, Other</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21476</th>\n",
" <td>ZWE</td>\n",
" <td>181</td>\n",
" <td>Zimbabwe</td>\n",
" <td>2928</td>\n",
" <td>Miscellaneous</td>\n",
" <td>5142</td>\n",
" <td>Food</td>\n",
" <td>1000 tonnes</td>\n",
" <td>-19.02</td>\n",
" <td>29.15</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>21477 rows × 63 columns</p>\n",
"</div>"
],
"text/plain": [
" Area Abbreviation Area Code Area Item Code \\\n",
"0 AFG 2 Afghanistan 2511 \n",
"1 AFG 2 Afghanistan 2805 \n",
"2 AFG 2 Afghanistan 2513 \n",
"3 AFG 2 Afghanistan 2513 \n",
"4 AFG 2 Afghanistan 2514 \n",
"5 AFG 2 Afghanistan 2514 \n",
"6 AFG 2 Afghanistan 2517 \n",
"7 AFG 2 Afghanistan 2520 \n",
"8 AFG 2 Afghanistan 2531 \n",
"9 AFG 2 Afghanistan 2536 \n",
"10 AFG 2 Afghanistan 2537 \n",
"11 AFG 2 Afghanistan 2542 \n",
"12 AFG 2 Afghanistan 2543 \n",
"13 AFG 2 Afghanistan 2745 \n",
"14 AFG 2 Afghanistan 2549 \n",
"15 AFG 2 Afghanistan 2549 \n",
"16 AFG 2 Afghanistan 2551 \n",
"17 AFG 2 Afghanistan 2560 \n",
"18 AFG 2 Afghanistan 2561 \n",
"19 AFG 2 Afghanistan 2563 \n",
"20 AFG 2 Afghanistan 2571 \n",
"21 AFG 2 Afghanistan 2572 \n",
"22 AFG 2 Afghanistan 2573 \n",
"23 AFG 2 Afghanistan 2574 \n",
"24 AFG 2 Afghanistan 2575 \n",
"25 AFG 2 Afghanistan 2577 \n",
"26 AFG 2 Afghanistan 2579 \n",
"27 AFG 2 Afghanistan 2580 \n",
"28 AFG 2 Afghanistan 2586 \n",
"29 AFG 2 Afghanistan 2601 \n",
"... ... ... ... ... \n",
"21447 ZWE 181 Zimbabwe 2765 \n",
"21448 ZWE 181 Zimbabwe 2766 \n",
"21449 ZWE 181 Zimbabwe 2767 \n",
"21450 ZWE 181 Zimbabwe 2775 \n",
"21451 ZWE 181 Zimbabwe 2680 \n",
"21452 ZWE 181 Zimbabwe 2905 \n",
"21453 ZWE 181 Zimbabwe 2905 \n",
"21454 ZWE 181 Zimbabwe 2907 \n",
"21455 ZWE 181 Zimbabwe 2908 \n",
"21456 ZWE 181 Zimbabwe 2909 \n",
"21457 ZWE 181 Zimbabwe 2911 \n",
"21458 ZWE 181 Zimbabwe 2912 \n",
"21459 ZWE 181 Zimbabwe 2913 \n",
"21460 ZWE 181 Zimbabwe 2913 \n",
"21461 ZWE 181 Zimbabwe 2914 \n",
"21462 ZWE 181 Zimbabwe 2918 \n",
"21463 ZWE 181 Zimbabwe 2919 \n",
"21464 ZWE 181 Zimbabwe 2922 \n",
"21465 ZWE 181 Zimbabwe 2923 \n",
"21466 ZWE 181 Zimbabwe 2924 \n",
"21467 ZWE 181 Zimbabwe 2943 \n",
"21468 ZWE 181 Zimbabwe 2945 \n",
"21469 ZWE 181 Zimbabwe 2946 \n",
"21470 ZWE 181 Zimbabwe 2949 \n",
"21471 ZWE 181 Zimbabwe 2948 \n",
"21472 ZWE 181 Zimbabwe 2948 \n",
"21473 ZWE 181 Zimbabwe 2960 \n",
"21474 ZWE 181 Zimbabwe 2960 \n",
"21475 ZWE 181 Zimbabwe 2961 \n",
"21476 ZWE 181 Zimbabwe 2928 \n",
"\n",
" Item Element Code Element Unit \\\n",
"0 Wheat and products 5142 Food 1000 tonnes \n",
"1 Rice (Milled Equivalent) 5142 Food 1000 tonnes \n",
"2 Barley and products 5521 Feed 1000 tonnes \n",
"3 Barley and products 5142 Food 1000 tonnes \n",
"4 Maize and products 5521 Feed 1000 tonnes \n",
"5 Maize and products 5142 Food 1000 tonnes \n",
"6 Millet and products 5142 Food 1000 tonnes \n",
"7 Cereals, Other 5142 Food 1000 tonnes \n",
"8 Potatoes and products 5142 Food 1000 tonnes \n",
"9 Sugar cane 5521 Feed 1000 tonnes \n",
"10 Sugar beet 5521 Feed 1000 tonnes \n",
"11 Sugar (Raw Equivalent) 5142 Food 1000 tonnes \n",
"12 Sweeteners, Other 5142 Food 1000 tonnes \n",
"13 Honey 5142 Food 1000 tonnes \n",
"14 Pulses, Other and products 5521 Feed 1000 tonnes \n",
"15 Pulses, Other and products 5142 Food 1000 tonnes \n",
"16 Nuts and products 5142 Food 1000 tonnes \n",
"17 Coconuts - Incl Copra 5142 Food 1000 tonnes \n",
"18 Sesame seed 5142 Food 1000 tonnes \n",
"19 Olives (including preserved) 5142 Food 1000 tonnes \n",
"20 Soyabean Oil 5142 Food 1000 tonnes \n",
"21 Groundnut Oil 5142 Food 1000 tonnes \n",
"22 Sunflowerseed Oil 5142 Food 1000 tonnes \n",
"23 Rape and Mustard Oil 5142 Food 1000 tonnes \n",
"24 Cottonseed Oil 5142 Food 1000 tonnes \n",
"25 Palm Oil 5142 Food 1000 tonnes \n",
"26 Sesameseed Oil 5142 Food 1000 tonnes \n",
"27 Olive Oil 5142 Food 1000 tonnes \n",
"28 Oilcrops Oil, Other 5142 Food 1000 tonnes \n",
"29 Tomatoes and products 5142 Food 1000 tonnes \n",
"... ... ... ... ... \n",
"21447 Crustaceans 5142 Food 1000 tonnes \n",
"21448 Cephalopods 5142 Food 1000 tonnes \n",
"21449 Molluscs, Other 5142 Food 1000 tonnes \n",
"21450 Aquatic Plants 5142 Food 1000 tonnes \n",
"21451 Infant food 5142 Food 1000 tonnes \n",
"21452 Cereals - Excluding Beer 5521 Feed 1000 tonnes \n",
"21453 Cereals - Excluding Beer 5142 Food 1000 tonnes \n",
"21454 Starchy Roots 5142 Food 1000 tonnes \n",
"21455 Sugar Crops 5142 Food 1000 tonnes \n",
"21456 Sugar & Sweeteners 5142 Food 1000 tonnes \n",
"21457 Pulses 5142 Food 1000 tonnes \n",
"21458 Treenuts 5142 Food 1000 tonnes \n",
"21459 Oilcrops 5521 Feed 1000 tonnes \n",
"21460 Oilcrops 5142 Food 1000 tonnes \n",
"21461 Vegetable Oils 5142 Food 1000 tonnes \n",
"21462 Vegetables 5142 Food 1000 tonnes \n",
"21463 Fruits - Excluding Wine 5142 Food 1000 tonnes \n",
"21464 Stimulants 5142 Food 1000 tonnes \n",
"21465 Spices 5142 Food 1000 tonnes \n",
"21466 Alcoholic Beverages 5142 Food 1000 tonnes \n",
"21467 Meat 5142 Food 1000 tonnes \n",
"21468 Offals 5142 Food 1000 tonnes \n",
"21469 Animal fats 5142 Food 1000 tonnes \n",
"21470 Eggs 5142 Food 1000 tonnes \n",
"21471 Milk - Excluding Butter 5521 Feed 1000 tonnes \n",
"21472 Milk - Excluding Butter 5142 Food 1000 tonnes \n",
"21473 Fish, Seafood 5521 Feed 1000 tonnes \n",
"21474 Fish, Seafood 5142 Food 1000 tonnes \n",
"21475 Aquatic Products, Other 5142 Food 1000 tonnes \n",
"21476 Miscellaneous 5142 Food 1000 tonnes \n",
"\n",
" latitude longitude ... Y2004 Y2005 Y2006 Y2007 Y2008 \\\n",
"0 33.94 67.71 ... 3249.0 3486.0 3704.0 4164.0 4252.0 \n",
"1 33.94 67.71 ... 419.0 445.0 546.0 455.0 490.0 \n",
"2 33.94 67.71 ... 58.0 236.0 262.0 263.0 230.0 \n",
"3 33.94 67.71 ... 185.0 43.0 44.0 48.0 62.0 \n",
"4 33.94 67.71 ... 120.0 208.0 233.0 249.0 247.0 \n",
"5 33.94 67.71 ... 231.0 67.0 82.0 67.0 69.0 \n",
"6 33.94 67.71 ... 15.0 21.0 11.0 19.0 21.0 \n",
"7 33.94 67.71 ... 2.0 1.0 1.0 0.0 0.0 \n",
"8 33.94 67.71 ... 276.0 294.0 294.0 260.0 242.0 \n",
"9 33.94 67.71 ... 50.0 29.0 61.0 65.0 54.0 \n",
"10 33.94 67.71 ... 0.0 0.0 0.0 0.0 0.0 \n",
"11 33.94 67.71 ... 124.0 152.0 169.0 192.0 217.0 \n",
"12 33.94 67.71 ... 9.0 15.0 12.0 6.0 11.0 \n",
"13 33.94 67.71 ... 3.0 3.0 3.0 3.0 3.0 \n",
"14 33.94 67.71 ... 3.0 2.0 3.0 3.0 3.0 \n",
"15 33.94 67.71 ... 17.0 35.0 37.0 40.0 54.0 \n",
"16 33.94 67.71 ... 11.0 13.0 24.0 34.0 42.0 \n",
"17 33.94 67.71 ... 0.0 0.0 0.0 0.0 0.0 \n",
"18 33.94 67.71 ... 16.0 16.0 13.0 16.0 16.0 \n",
"19 33.94 67.71 ... 1.0 1.0 0.0 0.0 2.0 \n",
"20 33.94 67.71 ... 6.0 35.0 18.0 21.0 11.0 \n",
"21 33.94 67.71 ... 0.0 0.0 0.0 0.0 0.0 \n",
"22 33.94 67.71 ... 4.0 6.0 5.0 9.0 3.0 \n",
"23 33.94 67.71 ... 0.0 1.0 3.0 5.0 6.0 \n",
"24 33.94 67.71 ... 2.0 3.0 3.0 3.0 3.0 \n",
"25 33.94 67.71 ... 71.0 69.0 56.0 51.0 36.0 \n",
"26 33.94 67.71 ... 1.0 1.0 1.0 2.0 2.0 \n",
"27 33.94 67.71 ... 0.0 0.0 0.0 0.0 0.0 \n",
"28 33.94 67.71 ... 0.0 1.0 0.0 0.0 3.0 \n",
"29 33.94 67.71 ... 2.0 2.0 8.0 1.0 0.0 \n",
"... ... ... ... ... ... ... ... ... \n",
"21447 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21448 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21449 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21450 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21451 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21452 -19.02 29.15 ... 75.0 54.0 75.0 55.0 63.0 \n",
"21453 -19.02 29.15 ... 1844.0 1842.0 1944.0 1962.0 1918.0 \n",
"21454 -19.02 29.15 ... 223.0 236.0 238.0 228.0 245.0 \n",
"21455 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21456 -19.02 29.15 ... 335.0 313.0 339.0 302.0 285.0 \n",
"21457 -19.02 29.15 ... 63.0 59.0 61.0 57.0 69.0 \n",
"21458 -19.02 29.15 ... 1.0 2.0 1.0 2.0 2.0 \n",
"21459 -19.02 29.15 ... 36.0 46.0 41.0 33.0 31.0 \n",
"21460 -19.02 29.15 ... 60.0 59.0 61.0 62.0 48.0 \n",
"21461 -19.02 29.15 ... 111.0 114.0 112.0 114.0 134.0 \n",
"21462 -19.02 29.15 ... 161.0 166.0 208.0 185.0 137.0 \n",
"21463 -19.02 29.15 ... 191.0 134.0 167.0 177.0 185.0 \n",
"21464 -19.02 29.15 ... 7.0 21.0 14.0 24.0 16.0 \n",
"21465 -19.02 29.15 ... 7.0 11.0 7.0 12.0 16.0 \n",
"21466 -19.02 29.15 ... 294.0 290.0 316.0 355.0 398.0 \n",
"21467 -19.02 29.15 ... 222.0 228.0 233.0 238.0 242.0 \n",
"21468 -19.02 29.15 ... 20.0 20.0 21.0 21.0 21.0 \n",
"21469 -19.02 29.15 ... 26.0 26.0 29.0 29.0 27.0 \n",
"21470 -19.02 29.15 ... 15.0 18.0 18.0 21.0 22.0 \n",
"21471 -19.02 29.15 ... 21.0 21.0 21.0 21.0 21.0 \n",
"21472 -19.02 29.15 ... 373.0 357.0 359.0 356.0 341.0 \n",
"21473 -19.02 29.15 ... 5.0 4.0 9.0 6.0 9.0 \n",
"21474 -19.02 29.15 ... 18.0 14.0 17.0 14.0 15.0 \n",
"21475 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"21476 -19.02 29.15 ... 0.0 0.0 0.0 0.0 0.0 \n",
"\n",
" Y2009 Y2010 Y2011 Y2012 Y2013 \n",
"0 4538.0 4605.0 4711.0 4810 4895 \n",
"1 415.0 442.0 476.0 425 422 \n",
"2 379.0 315.0 203.0 367 360 \n",
"3 55.0 60.0 72.0 78 89 \n",
"4 195.0 178.0 191.0 200 200 \n",
"5 71.0 82.0 73.0 77 76 \n",
"6 18.0 14.0 14.0 14 12 \n",
"7 0.0 0.0 0.0 0 0 \n",
"8 250.0 192.0 169.0 196 230 \n",
"9 114.0 83.0 83.0 69 81 \n",
"10 0.0 0.0 0.0 0 0 \n",
"11 231.0 240.0 240.0 250 255 \n",
"12 2.0 9.0 21.0 24 16 \n",
"13 3.0 3.0 2.0 2 2 \n",
"14 5.0 4.0 5.0 4 4 \n",
"15 80.0 66.0 81.0 63 74 \n",
"16 28.0 66.0 71.0 70 44 \n",
"17 0.0 0.0 0.0 0 0 \n",
"18 16.0 19.0 17.0 16 16 \n",
"19 3.0 2.0 2.0 2 2 \n",
"20 6.0 15.0 16.0 16 16 \n",
"21 0.0 0.0 0.0 0 0 \n",
"22 8.0 15.0 16.0 17 23 \n",
"23 6.0 1.0 2.0 2 2 \n",
"24 4.0 3.0 3.0 3 4 \n",
"25 53.0 59.0 51.0 61 64 \n",
"26 1.0 1.0 2.0 1 1 \n",
"27 1.0 1.0 1.0 1 1 \n",
"28 1.0 2.0 2.0 2 2 \n",
"29 0.0 0.0 0.0 0 0 \n",
"... ... ... ... ... ... \n",
"21447 0.0 0.0 0.0 0 0 \n",
"21448 0.0 0.0 0.0 0 0 \n",
"21449 0.0 1.0 0.0 0 0 \n",
"21450 0.0 0.0 0.0 0 0 \n",
"21451 0.0 0.0 0.0 0 0 \n",
"21452 62.0 55.0 55.0 55 55 \n",
"21453 1980.0 2011.0 2094.0 2071 2016 \n",
"21454 258.0 258.0 269.0 272 276 \n",
"21455 0.0 0.0 0.0 0 0 \n",
"21456 287.0 314.0 336.0 396 416 \n",
"21457 78.0 68.0 56.0 52 55 \n",
"21458 3.0 4.0 2.0 4 3 \n",
"21459 19.0 24.0 17.0 27 30 \n",
"21460 44.0 41.0 40.0 38 38 \n",
"21461 135.0 137.0 147.0 159 160 \n",
"21462 179.0 215.0 217.0 227 227 \n",
"21463 184.0 211.0 230.0 246 217 \n",
"21464 11.0 23.0 11.0 10 10 \n",
"21465 16.0 14.0 11.0 12 12 \n",
"21466 437.0 448.0 476.0 525 516 \n",
"21467 265.0 262.0 277.0 280 258 \n",
"21468 21.0 21.0 21.0 22 22 \n",
"21469 31.0 30.0 25.0 26 20 \n",
"21470 27.0 27.0 24.0 24 25 \n",
"21471 23.0 25.0 25.0 30 31 \n",
"21472 385.0 418.0 457.0 426 451 \n",
"21473 5.0 15.0 15.0 15 15 \n",
"21474 18.0 29.0 40.0 40 40 \n",
"21475 0.0 0.0 0.0 0 0 \n",
"21476 0.0 0.0 0.0 0 0 \n",
"\n",
"[21477 rows x 63 columns]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"_cell_guid": "347e620f-b0e4-448e-81c7-e164f560c5a3",
"_uuid": "0acdd759950f5df3298224b0804562973663a11d",
"scrolled": false
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABYAAAAQcCAYAAAAsgj+iAAA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cx0vLy+mKsKsbURsW3379q0pLi5uGYA8e/asobu7O4vD4bADAgIcpVIppromqnuWx+OxMzMzSQDNEXzqM+Lqz5aqqir8kCFDnJycnLiTJk2ya28QXn371atXW6iudWhoKLXttu3l/927d/XWrl1rc+vWLSMWi8Wprq5+Y+AoPz9fZ+jQoYw1a9bkT548WdpRPqjXDdqu+eDBg524XC6bTqdzt2/f3mHkd1xcHEVHR0e5dOnSUtXfGAxGw6pVq0raRkkNGDCAHh8fT1Fd+8LCQoKqTE+YMMGeTqdze/fu7aw6Xz6fT+rTp48zl8tle3p6MlWrgY4fP26kio728/Nj/BMmJz5nmvKruLgYP3jwYCcGg8Fxc3NjpaSkaI38MDQ0VPB4vFqxWEzSVO8qFAqYPXu2jbOzM5fBYLREP8XHx1O8vLyYHd27e/fuNeHxeGwWi8WZNGmSvaoTq6qLKisrsf79+9OZTCbH2dmZ21F0FYZhsHbt2hIzM7PG2NhYIwDt9VFYWBjV3d2d5eLiwk5OTib7+/s729raumzdurW7tvMDaL+u8fb2ZoaFhVF79uzJ3Lhxo0V7eSEWi4lRUVHd9+/fb8FisThXrlwxUI+2zczMJPn5+TFUK6Q6enb36tWrJj8/v6X+ba+uEYvFRAcHB+6YMWNoDAaDM3z4cEfVihX1Z1ViYiLZ29ubqdpXeno6uVevXgx7e3uX9lamqLd7pFI
"text/plain": [
"<Figure size 1728x864 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"area_list = list(df['Area'].unique())\n",
"year_list = list(df.iloc[:,10:].columns)\n",
"\n",
"plt.figure(figsize=(24,12))\n",
"for ar in area_list:\n",
" yearly_produce = []\n",
" for yr in year_list:\n",
" yearly_produce.append(df[yr][df['Area'] == ar].sum())\n",
" plt.plot(yearly_produce, label=ar)\n",
"plt.xticks(np.arange(53), tuple(year_list), rotation=60)\n",
"plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, ncol=8, mode=\"expand\", borderaxespad=0.)\n",
"plt.savefig('p.png')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Figure size 1728x864 with 0 Axes>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"<Figure size 1728x864 with 0 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(24,12))"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "2ebe07e3-739b-4f39-8736-a512426c05bf",
"_uuid": "70900ec0ff5e248cd382ee53b5927cb671efa80e",
"collapsed": true
},
"source": [
"Clearly, China, India and US stand out here. So, these are the countries with most food and feed production.\n",
"\n",
"Now, let's have a close look at their food and feed data\n",
"\n",
"# Food and feed plot for the whole dataset"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"_cell_guid": "ec0c911d-e154-4f8a-a79f-ced4896d5115",
"_uuid": "683dc56125b3a4c66b1e140098ec91490cbbe96f",
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/anaconda3/lib/python3.7/site-packages/seaborn/categorical.py:3666: UserWarning: The `factorplot` function has been renamed to `catplot`. The original name will be removed in a future release. Please update your code. Note that the default `kind` in `factorplot` (`'point'`) has changed `'strip'` in `catplot`.\n",
" warnings.warn(msg)\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAFgCAYAAACbqJP/AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAFudJREFUeJzt3X+wZ3V93/Hny0UIRikQFossDsQutkjoKlsktTpGIqxOImDVwMSwKjOrDGTq2GbEplOsltZGrRMcgsW4AhkFiYS6zSCwMon0B0YuuOWHSrggwpUtXMQoCZbMknf/+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d1HqmrugudZDO5c2Rf4apskaUVbNLiB9wLvZxDSt/Cz4P4JcOGudl5Vpy+w6oR52hZw9gL72Qxsnqc+BRy9q35I0kqyaHBX1e8Dv5/kt6vq02PqkyRpEbs64wagqj6d5J8Chw9vU1WXjahfkqQFLCm4k/wR8DJgG/BkK8/96EWSNEZLCm5gPXBUG4eWJE3QUu/jvgP4+6PsiCRpaZZ6xn0Q8O0k3wSemCtW1VtG0itJ0oKWGtwfHmUnJElLt9S7Sr4+6o5IkpZmqXeVPMbPHuC0N/B84G+qar9RdUySNL+lnnG/aHg5ySkMXmogSRqzZ/V0wKr6r8AbdnNfJElLsNShkrcOLT6PwX3d3tMtSROw1LtKfn1ofgdwH4NXjUmSxmypY9zvHnVHJElLs9QXKaxJcnWSh5M8lOSqJGt2vaUkaXdb6sXJzzN4Q81LGLyQ97+1miRpzJYa3Kur6vNVtaNNlwC+vFGSJmCpwf1IkncmWdWmdwI/HGXHJEnzW2pwvwd4B/B/gO3A22jvhJQkjddSbwf8KLCxqn4EkORA4BMMAl2SNEZLPeM
"text/plain": [
"<Figure size 360x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.factorplot(\"Element\", data=df, kind=\"count\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "189c74af-e6e4-4ddd-a73c-3725f3aa8124",
"_uuid": "bfd404fb5dbb48c3e3bd1dcd45fb27a5fb475a00"
},
"source": [
"So, there is a huge difference in food and feed production. Now, we have obvious assumptions about the following plots after looking at this huge difference.\n",
"\n",
"# Food and feed plot for the largest producers(India, USA, China)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"_cell_guid": "0bf44e4e-d4c4-4f74-ae9f-82f52139d182",
"_uuid": "be1bc3d49c8cee62f48a09ada0db3170adcedc17"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/anaconda3/lib/python3.7/site-packages/seaborn/categorical.py:3666: UserWarning: The `factorplot` function has been renamed to `catplot`. The original name will be removed in a future release. Please update your code. Note that the default `kind` in `factorplot` (`'point'`) has changed `'strip'` in `catplot`.\n",
" warnings.warn(msg)\n",
"/anaconda3/lib/python3.7/site-packages/seaborn/categorical.py:3672: UserWarning: The `size` paramter has been renamed to `height`; please update your code.\n",
" warnings.warn(msg, UserWarning)\n"
]
},
{
"data": {
"text/plain": [
"<seaborn.axisgrid.FacetGrid at 0x1a218d2550>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhAAAAI4CAYAAAA7/9DSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAHzNJREFUeJzt3Xm4ZHdd5/HPlwRIICAEGoQETJwJS4TI0jBsg0GQCTqYoEFBkERxoj4qiAKi8CjgOIriILtGliSIECQsEX0gGIgge2chGzuBEMhAI2sUUOA3f9TpUOnc213fTt9btzuv1/PUc6tOnarzu/dWV7/vOafOqTFGAAA6rrPsAQAAex4BAQC0CQgAoE1AAABtAgIAaBMQAECbgAAA2gQEANAmIACAtn2XPYBr4qijjhpvfvOblz0MAK49atkD2Cj26DUQX/ziF5c9BAC4VtqjAwIAWA4BAQC0CQgAoE1AAABtAgIAaBMQAECbgAAA2gQEANAmIACANgEBALQJCACgTUAAAG0CAgBoExAAQJuAAADaBAQA0CYgAIA2AQEAtAkIAKBNQAAAbQICAGgTEABAm4AAANr2XfYAgPV36TPvvOwhrJnb/v4Fyx4CXCtYAwEAtAkIAKBNQAAAbfaB2MvYtg3AerAGAgBoExAAQJuAAADaBAQA0CYgAIA2AQEAtAkIAKBNQAAAbQ4kBcCKHJiOHbEGAgBoExAAQJuAAADaBAQA0CYgAIA2AQEAtAkIAKBNQAAAbQIC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kU0mO3u2
"text/plain": [
"<Figure size 521.175x576 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.factorplot(\"Area\", data=df[(df['Area'] == \"India\") | (df['Area'] == \"China, mainland\") | (df['Area'] == \"United States of America\")], kind=\"count\", hue=\"Element\", size=8, aspect=.8)"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "94c19dc8-b1e7-4b61-b81f-422c27184c4e",
"_uuid": "0d1cfc7acc74847dbc5813b9b3bd0eb9db450985"
},
"source": [
"Though, there is a huge difference between feed and food production, these countries' total production and their ranks depend on feed production."
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "9dba87b4-fa51-43ef-95ae-f31396c20146",
"_uuid": "43e0f00abf706ab1782ebb78cefc38aca17316e6"
},
"source": [
"Now, we create a dataframe with countries as index and their annual produce as columns from 1961 to 2013."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"_cell_guid": "c4a5f859-0384-4c8e-b894-3f747aec8cf9",
"_uuid": "84dd7a2b601479728dd172d3100951553c2daff5",
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<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>Afghanistan</th>\n",
" <th>Albania</th>\n",
" <th>Algeria</th>\n",
" <th>Angola</th>\n",
" <th>Antigua and Barbuda</th>\n",
" <th>Argentina</th>\n",
" <th>Armenia</th>\n",
" <th>Australia</th>\n",
" <th>Austria</th>\n",
" <th>Azerbaijan</th>\n",
" <th>...</th>\n",
" <th>United Republic of Tanzania</th>\n",
" <th>United States of America</th>\n",
" <th>Uruguay</th>\n",
" <th>Uzbekistan</th>\n",
" <th>Vanuatu</th>\n",
" <th>Venezuela (Bolivarian Republic of)</th>\n",
" <th>Viet Nam</th>\n",
" <th>Yemen</th>\n",
" <th>Zambia</th>\n",
" <th>Zimbabwe</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>9481.0</td>\n",
" <td>1706.0</td>\n",
" <td>7488.0</td>\n",
" <td>4834.0</td>\n",
" <td>92.0</td>\n",
" <td>43402.0</td>\n",
" <td>0.0</td>\n",
" <td>25795.0</td>\n",
" <td>22542.0</td>\n",
" <td>0.0</td>\n",
" <td>...</td>\n",
" <td>12367.0</td>\n",
" <td>559347.0</td>\n",
" <td>4631.0</td>\n",
" <td>0.0</td>\n",
" <td>97.0</td>\n",
" <td>9523.0</td>\n",
" <td>23856.0</td>\n",
" <td>2982.0</td>\n",
" <td>2976.0</td>\n",
" <td>3260.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>9414.0</td>\n",
" <td>1749.0</td>\n",
" <td>7235.0</td>\n",
" <td>4775.0</td>\n",
" <td>94.0</td>\n",
" <td>40784.0</td>\n",
" <td>0.0</td>\n",
" <td>27618.0</td>\n",
" <td>22627.0</td>\n",
" <td>0.0</td>\n",
" <td>...</td>\n",
" <td>12810.0</td>\n",
" <td>556319.0</td>\n",
" <td>4448.0</td>\n",
" <td>0.0</td>\n",
" <td>101.0</td>\n",
" <td>9369.0</td>\n",
" <td>25220.0</td>\n",
" <td>3038.0</td>\n",
" <td>3057.0</td>\n",
" <td>3503.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>9194.0</td>\n",
" <td>1767.0</td>\n",
" <td>6861.0</td>\n",
" <td>5240.0</td>\n",
" <td>105.0</td>\n",
" <td>40219.0</td>\n",
" <td>0.0</td>\n",
" <td>28902.0</td>\n",
" <td>23637.0</td>\n",
" <td>0.0</td>\n",
" <td>...</td>\n",
" <td>13109.0</td>\n",
" <td>552630.0</td>\n",
" <td>4682.0</td>\n",
" <td>0.0</td>\n",
" <td>103.0</td>\n",
" <td>9788.0</td>\n",
" <td>26053.0</td>\n",
" <td>3147.0</td>\n",
" <td>3069.0</td>\n",
" <td>3479.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10170.0</td>\n",
" <td>1889.0</td>\n",
" <td>7255.0</td>\n",
" <td>5286.0</td>\n",
" <td>95.0</td>\n",
" <td>41638.0</td>\n",
" <td>0.0</td>\n",
" <td>29107.0</td>\n",
" <td>24099.0</td>\n",
" <td>0.0</td>\n",
" <td>...</td>\n",
" <td>12965.0</td>\n",
" <td>555677.0</td>\n",
" <td>4723.0</td>\n",
" <td>0.0</td>\n",
" <td>102.0</td>\n",
" <td>10539.0</td>\n",
" <td>26377.0</td>\n",
" <td>3224.0</td>\n",
" <td>3121.0</td>\n",
" <td>3738.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10473.0</td>\n",
" <td>1884.0</td>\n",
" <td>7509.0</td>\n",
" <td>5527.0</td>\n",
" <td>84.0</td>\n",
" <td>44936.0</td>\n",
" <td>0.0</td>\n",
" <td>28961.0</td>\n",
" <td>22664.0</td>\n",
" <td>0.0</td>\n",
" <td>...</td>\n",
" <td>13742.0</td>\n",
" <td>589288.0</td>\n",
" <td>4581.0</td>\n",
" <td>0.0</td>\n",
" <td>107.0</td>\n",
" <td>10641.0</td>\n",
" <td>26961.0</td>\n",
" <td>3328.0</td>\n",
" <td>3236.0</td>\n",
" <td>3940.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 174 columns</p>\n",
"</div>"
],
"text/plain": [
" Afghanistan Albania Algeria Angola Antigua and Barbuda Argentina \\\n",
"0 9481.0 1706.0 7488.0 4834.0 92.0 43402.0 \n",
"1 9414.0 1749.0 7235.0 4775.0 94.0 40784.0 \n",
"2 9194.0 1767.0 6861.0 5240.0 105.0 40219.0 \n",
"3 10170.0 1889.0 7255.0 5286.0 95.0 41638.0 \n",
"4 10473.0 1884.0 7509.0 5527.0 84.0 44936.0 \n",
"\n",
" Armenia Australia Austria Azerbaijan ... \\\n",
"0 0.0 25795.0 22542.0 0.0 ... \n",
"1 0.0 27618.0 22627.0 0.0 ... \n",
"2 0.0 28902.0 23637.0 0.0 ... \n",
"3 0.0 29107.0 24099.0 0.0 ... \n",
"4 0.0 28961.0 22664.0 0.0 ... \n",
"\n",
" United Republic of Tanzania United States of America Uruguay Uzbekistan \\\n",
"0 12367.0 559347.0 4631.0 0.0 \n",
"1 12810.0 556319.0 4448.0 0.0 \n",
"2 13109.0 552630.0 4682.0 0.0 \n",
"3 12965.0 555677.0 4723.0 0.0 \n",
"4 13742.0 589288.0 4581.0 0.0 \n",
"\n",
" Vanuatu Venezuela (Bolivarian Republic of) Viet Nam Yemen Zambia \\\n",
"0 97.0 9523.0 23856.0 2982.0 2976.0 \n",
"1 101.0 9369.0 25220.0 3038.0 3057.0 \n",
"2 103.0 9788.0 26053.0 3147.0 3069.0 \n",
"3 102.0 10539.0 26377.0 3224.0 3121.0 \n",
"4 107.0 10641.0 26961.0 3328.0 3236.0 \n",
"\n",
" Zimbabwe \n",
"0 3260.0 \n",
"1 3503.0 \n",
"2 3479.0 \n",
"3 3738.0 \n",
"4 3940.0 \n",
"\n",
"[5 rows x 174 columns]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"new_df_dict = {}\n",
"for ar in area_list:\n",
" yearly_produce = []\n",
" for yr in year_list:\n",
" yearly_produce.append(df[yr][df['Area']==ar].sum())\n",
" new_df_dict[ar] = yearly_produce\n",
"new_df = pd.DataFrame(new_df_dict)\n",
"\n",
"new_df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "15fbe29c-5cea-4ac3-9b95-f92acd89b336",
"_uuid": "ea48f75e9824a0c4c1a5f19cbd63e59a6cb44fe1"
},
"source": [
"Now, this is not perfect so we transpose this dataframe and add column names."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"_cell_guid": "145f751e-4f5b-4811-a68c-9d20b3c36e10",
"_uuid": "28e765d82bb4ebec3be49200a30fc4e0eabb24d7"
},
"outputs": [
{
"data": {
"text/html": [
"<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>Y1961</th>\n",
" <th>Y1962</th>\n",
" <th>Y1963</th>\n",
" <th>Y1964</th>\n",
" <th>Y1965</th>\n",
" <th>Y1966</th>\n",
" <th>Y1967</th>\n",
" <th>Y1968</th>\n",
" <th>Y1969</th>\n",
" <th>Y1970</th>\n",
" <th>...</th>\n",
" <th>Y2004</th>\n",
" <th>Y2005</th>\n",
" <th>Y2006</th>\n",
" <th>Y2007</th>\n",
" <th>Y2008</th>\n",
" <th>Y2009</th>\n",
" <th>Y2010</th>\n",
" <th>Y2011</th>\n",
" <th>Y2012</th>\n",
" <th>Y2013</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Afghanistan</th>\n",
" <td>9481.0</td>\n",
" <td>9414.0</td>\n",
" <td>9194.0</td>\n",
" <td>10170.0</td>\n",
" <td>10473.0</td>\n",
" <td>10169.0</td>\n",
" <td>11289.0</td>\n",
" <td>11508.0</td>\n",
" <td>11815.0</td>\n",
" <td>10454.0</td>\n",
" <td>...</td>\n",
" <td>16542.0</td>\n",
" <td>17658.0</td>\n",
" <td>18317.0</td>\n",
" <td>19248.0</td>\n",
" <td>19381.0</td>\n",
" <td>20661.0</td>\n",
" <td>21030.0</td>\n",
" <td>21100.0</td>\n",
" <td>22706.0</td>\n",
" <td>23007.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Albania</th>\n",
" <td>1706.0</td>\n",
" <td>1749.0</td>\n",
" <td>1767.0</td>\n",
" <td>1889.0</td>\n",
" <td>1884.0</td>\n",
" <td>1995.0</td>\n",
" <td>2046.0</td>\n",
" <td>2169.0</td>\n",
" <td>2230.0</td>\n",
" <td>2395.0</td>\n",
" <td>...</td>\n",
" <td>6637.0</td>\n",
" <td>6719.0</td>\n",
" <td>6911.0</td>\n",
" <td>6744.0</td>\n",
" <td>7168.0</td>\n",
" <td>7316.0</td>\n",
" <td>7907.0</td>\n",
" <td>8114.0</td>\n",
" <td>8221.0</td>\n",
" <td>8271.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Algeria</th>\n",
" <td>7488.0</td>\n",
" <td>7235.0</td>\n",
" <td>6861.0</td>\n",
" <td>7255.0</td>\n",
" <td>7509.0</td>\n",
" <td>7536.0</td>\n",
" <td>7986.0</td>\n",
" <td>8839.0</td>\n",
" <td>9003.0</td>\n",
" <td>9355.0</td>\n",
" <td>...</td>\n",
" <td>48619.0</td>\n",
" <td>49562.0</td>\n",
" <td>51067.0</td>\n",
" <td>49933.0</td>\n",
" <td>50916.0</td>\n",
" <td>57505.0</td>\n",
" <td>60071.0</td>\n",
" <td>65852.0</td>\n",
" <td>69365.0</td>\n",
" <td>72161.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Angola</th>\n",
" <td>4834.0</td>\n",
" <td>4775.0</td>\n",
" <td>5240.0</td>\n",
" <td>5286.0</td>\n",
" <td>5527.0</td>\n",
" <td>5677.0</td>\n",
" <td>5833.0</td>\n",
" <td>5685.0</td>\n",
" <td>6219.0</td>\n",
" <td>6460.0</td>\n",
" <td>...</td>\n",
" <td>25541.0</td>\n",
" <td>26696.0</td>\n",
" <td>28247.0</td>\n",
" <td>29877.0</td>\n",
" <td>32053.0</td>\n",
" <td>36985.0</td>\n",
" <td>38400.0</td>\n",
" <td>40573.0</td>\n",
" <td>38064.0</td>\n",
" <td>48639.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Antigua and Barbuda</th>\n",
" <td>92.0</td>\n",
" <td>94.0</td>\n",
" <td>105.0</td>\n",
" <td>95.0</td>\n",
" <td>84.0</td>\n",
" <td>73.0</td>\n",
" <td>64.0</td>\n",
" <td>59.0</td>\n",
" <td>68.0</td>\n",
" <td>77.0</td>\n",
" <td>...</td>\n",
" <td>92.0</td>\n",
" <td>115.0</td>\n",
" <td>110.0</td>\n",
" <td>122.0</td>\n",
" <td>115.0</td>\n",
" <td>114.0</td>\n",
" <td>115.0</td>\n",
" <td>118.0</td>\n",
" <td>113.0</td>\n",
" <td>119.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 53 columns</p>\n",
"</div>"
],
"text/plain": [
" Y1961 Y1962 Y1963 Y1964 Y1965 Y1966 \\\n",
"Afghanistan 9481.0 9414.0 9194.0 10170.0 10473.0 10169.0 \n",
"Albania 1706.0 1749.0 1767.0 1889.0 1884.0 1995.0 \n",
"Algeria 7488.0 7235.0 6861.0 7255.0 7509.0 7536.0 \n",
"Angola 4834.0 4775.0 5240.0 5286.0 5527.0 5677.0 \n",
"Antigua and Barbuda 92.0 94.0 105.0 95.0 84.0 73.0 \n",
"\n",
" Y1967 Y1968 Y1969 Y1970 ... Y2004 \\\n",
"Afghanistan 11289.0 11508.0 11815.0 10454.0 ... 16542.0 \n",
"Albania 2046.0 2169.0 2230.0 2395.0 ... 6637.0 \n",
"Algeria 7986.0 8839.0 9003.0 9355.0 ... 48619.0 \n",
"Angola 5833.0 5685.0 6219.0 6460.0 ... 25541.0 \n",
"Antigua and Barbuda 64.0 59.0 68.0 77.0 ... 92.0 \n",
"\n",
" Y2005 Y2006 Y2007 Y2008 Y2009 Y2010 \\\n",
"Afghanistan 17658.0 18317.0 19248.0 19381.0 20661.0 21030.0 \n",
"Albania 6719.0 6911.0 6744.0 7168.0 7316.0 7907.0 \n",
"Algeria 49562.0 51067.0 49933.0 50916.0 57505.0 60071.0 \n",
"Angola 26696.0 28247.0 29877.0 32053.0 36985.0 38400.0 \n",
"Antigua and Barbuda 115.0 110.0 122.0 115.0 114.0 115.0 \n",
"\n",
" Y2011 Y2012 Y2013 \n",
"Afghanistan 21100.0 22706.0 23007.0 \n",
"Albania 8114.0 8221.0 8271.0 \n",
"Algeria 65852.0 69365.0 72161.0 \n",
"Angola 40573.0 38064.0 48639.0 \n",
"Antigua and Barbuda 118.0 113.0 119.0 \n",
"\n",
"[5 rows x 53 columns]"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"new_df = pd.DataFrame.transpose(new_df)\n",
"new_df.columns = year_list\n",
"\n",
"new_df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "57929d23-e3d7-4955-92d1-6fa388eb774d",
"_uuid": "605f908af9ff88120fce2a2b59160816fcdcfa67"
},
"source": [
"Perfect! Now, we will do some feature engineering.\n",
"\n",
"# First, a new column which indicates mean produce of each state over the given years. Second, a ranking column which ranks countries on the basis of mean produce."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"_cell_guid": "ab91a322-0cb9-4edf-b5a2-cde82a237824",
"_uuid": "979f875019abef3ed85af75e000fe59d1de5a381"
},
"outputs": [
{
"data": {
"text/html": [
"<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>Y1961</th>\n",
" <th>Y1962</th>\n",
" <th>Y1963</th>\n",
" <th>Y1964</th>\n",
" <th>Y1965</th>\n",
" <th>Y1966</th>\n",
" <th>Y1967</th>\n",
" <th>Y1968</th>\n",
" <th>Y1969</th>\n",
" <th>Y1970</th>\n",
" <th>...</th>\n",
" <th>Y2006</th>\n",
" <th>Y2007</th>\n",
" <th>Y2008</th>\n",
" <th>Y2009</th>\n",
" <th>Y2010</th>\n",
" <th>Y2011</th>\n",
" <th>Y2012</th>\n",
" <th>Y2013</th>\n",
" <th>Mean_Produce</th>\n",
" <th>Rank</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Afghanistan</th>\n",
" <td>9481.0</td>\n",
" <td>9414.0</td>\n",
" <td>9194.0</td>\n",
" <td>10170.0</td>\n",
" <td>10473.0</td>\n",
" <td>10169.0</td>\n",
" <td>11289.0</td>\n",
" <td>11508.0</td>\n",
" <td>11815.0</td>\n",
" <td>10454.0</td>\n",
" <td>...</td>\n",
" <td>18317.0</td>\n",
" <td>19248.0</td>\n",
" <td>19381.0</td>\n",
" <td>20661.0</td>\n",
" <td>21030.0</td>\n",
" <td>21100.0</td>\n",
" <td>22706.0</td>\n",
" <td>23007.0</td>\n",
" <td>13003.056604</td>\n",
" <td>69.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Albania</th>\n",
" <td>1706.0</td>\n",
" <td>1749.0</td>\n",
" <td>1767.0</td>\n",
" <td>1889.0</td>\n",
" <td>1884.0</td>\n",
" <td>1995.0</td>\n",
" <td>2046.0</td>\n",
" <td>2169.0</td>\n",
" <td>2230.0</td>\n",
" <td>2395.0</td>\n",
" <td>...</td>\n",
" <td>6911.0</td>\n",
" <td>6744.0</td>\n",
" <td>7168.0</td>\n",
" <td>7316.0</td>\n",
" <td>7907.0</td>\n",
" <td>8114.0</td>\n",
" <td>8221.0</td>\n",
" <td>8271.0</td>\n",
" <td>4475.509434</td>\n",
" <td>104.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Algeria</th>\n",
" <td>7488.0</td>\n",
" <td>7235.0</td>\n",
" <td>6861.0</td>\n",
" <td>7255.0</td>\n",
" <td>7509.0</td>\n",
" <td>7536.0</td>\n",
" <td>7986.0</td>\n",
" <td>8839.0</td>\n",
" <td>9003.0</td>\n",
" <td>9355.0</td>\n",
" <td>...</td>\n",
" <td>51067.0</td>\n",
" <td>49933.0</td>\n",
" <td>50916.0</td>\n",
" <td>57505.0</td>\n",
" <td>60071.0</td>\n",
" <td>65852.0</td>\n",
" <td>69365.0</td>\n",
" <td>72161.0</td>\n",
" <td>28879.490566</td>\n",
" <td>38.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Angola</th>\n",
" <td>4834.0</td>\n",
" <td>4775.0</td>\n",
" <td>5240.0</td>\n",
" <td>5286.0</td>\n",
" <td>5527.0</td>\n",
" <td>5677.0</td>\n",
" <td>5833.0</td>\n",
" <td>5685.0</td>\n",
" <td>6219.0</td>\n",
" <td>6460.0</td>\n",
" <td>...</td>\n",
" <td>28247.0</td>\n",
" <td>29877.0</td>\n",
" <td>32053.0</td>\n",
" <td>36985.0</td>\n",
" <td>38400.0</td>\n",
" <td>40573.0</td>\n",
" <td>38064.0</td>\n",
" <td>48639.0</td>\n",
" <td>13321.056604</td>\n",
" <td>68.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Antigua and Barbuda</th>\n",
" <td>92.0</td>\n",
" <td>94.0</td>\n",
" <td>105.0</td>\n",
" <td>95.0</td>\n",
" <td>84.0</td>\n",
" <td>73.0</td>\n",
" <td>64.0</td>\n",
" <td>59.0</td>\n",
" <td>68.0</td>\n",
" <td>77.0</td>\n",
" <td>...</td>\n",
" <td>110.0</td>\n",
" <td>122.0</td>\n",
" <td>115.0</td>\n",
" <td>114.0</td>\n",
" <td>115.0</td>\n",
" <td>118.0</td>\n",
" <td>113.0</td>\n",
" <td>119.0</td>\n",
" <td>83.886792</td>\n",
" <td>172.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 55 columns</p>\n",
"</div>"
],
"text/plain": [
" Y1961 Y1962 Y1963 Y1964 Y1965 Y1966 \\\n",
"Afghanistan 9481.0 9414.0 9194.0 10170.0 10473.0 10169.0 \n",
"Albania 1706.0 1749.0 1767.0 1889.0 1884.0 1995.0 \n",
"Algeria 7488.0 7235.0 6861.0 7255.0 7509.0 7536.0 \n",
"Angola 4834.0 4775.0 5240.0 5286.0 5527.0 5677.0 \n",
"Antigua and Barbuda 92.0 94.0 105.0 95.0 84.0 73.0 \n",
"\n",
" Y1967 Y1968 Y1969 Y1970 ... Y2006 \\\n",
"Afghanistan 11289.0 11508.0 11815.0 10454.0 ... 18317.0 \n",
"Albania 2046.0 2169.0 2230.0 2395.0 ... 6911.0 \n",
"Algeria 7986.0 8839.0 9003.0 9355.0 ... 51067.0 \n",
"Angola 5833.0 5685.0 6219.0 6460.0 ... 28247.0 \n",
"Antigua and Barbuda 64.0 59.0 68.0 77.0 ... 110.0 \n",
"\n",
" Y2007 Y2008 Y2009 Y2010 Y2011 Y2012 \\\n",
"Afghanistan 19248.0 19381.0 20661.0 21030.0 21100.0 22706.0 \n",
"Albania 6744.0 7168.0 7316.0 7907.0 8114.0 8221.0 \n",
"Algeria 49933.0 50916.0 57505.0 60071.0 65852.0 69365.0 \n",
"Angola 29877.0 32053.0 36985.0 38400.0 40573.0 38064.0 \n",
"Antigua and Barbuda 122.0 115.0 114.0 115.0 118.0 113.0 \n",
"\n",
" Y2013 Mean_Produce Rank \n",
"Afghanistan 23007.0 13003.056604 69.0 \n",
"Albania 8271.0 4475.509434 104.0 \n",
"Algeria 72161.0 28879.490566 38.0 \n",
"Angola 48639.0 13321.056604 68.0 \n",
"Antigua and Barbuda 119.0 83.886792 172.0 \n",
"\n",
"[5 rows x 55 columns]"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mean_produce = []\n",
"for i in range(174):\n",
" mean_produce.append(new_df.iloc[i,:].values.mean())\n",
"new_df['Mean_Produce'] = mean_produce\n",
"\n",
"new_df['Rank'] = new_df['Mean_Produce'].rank(ascending=False)\n",
"\n",
"new_df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "6f7c4fb7-1475-439f-9929-4cf4b29d8de7",
"_uuid": "da6c9c98eaff45edba1179103ae539bbfbe9753b"
},
"source": [
"Now, we create another dataframe with items and their total production each year from 1961 to 2013"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"_cell_guid": "bfd692bc-dce4-4870-9ab9-9775cf69a87f",
"_uuid": "9e11017d381f175eee714643bc5fa763600aaa0b"
},
"outputs": [],
"source": [
"item_list = list(df['Item'].unique())\n",
"\n",
"item_df = pd.DataFrame()\n",
"item_df['Item_Name'] = item_list\n",
"\n",
"for yr in year_list:\n",
" item_produce = []\n",
" for it in item_list:\n",
" item_produce.append(df[yr][df['Item']==it].sum())\n",
" item_df[yr] = item_produce\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"_cell_guid": "3b7ed0c2-6140-4285-861c-d0cd2324a1f5",
"_uuid": "cb4641df5ce90f516f88c536e8a6c6870c5b4f65"
},
"outputs": [
{
"data": {
"text/html": [
"<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>Item_Name</th>\n",
" <th>Y1961</th>\n",
" <th>Y1962</th>\n",
" <th>Y1963</th>\n",
" <th>Y1964</th>\n",
" <th>Y1965</th>\n",
" <th>Y1966</th>\n",
" <th>Y1967</th>\n",
" <th>Y1968</th>\n",
" <th>Y1969</th>\n",
" <th>...</th>\n",
" <th>Y2004</th>\n",
" <th>Y2005</th>\n",
" <th>Y2006</th>\n",
" <th>Y2007</th>\n",
" <th>Y2008</th>\n",
" <th>Y2009</th>\n",
" <th>Y2010</th>\n",
" <th>Y2011</th>\n",
" <th>Y2012</th>\n",
" <th>Y2013</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Wheat and products</td>\n",
" <td>138829.0</td>\n",
" <td>144643.0</td>\n",
" <td>147325.0</td>\n",
" <td>156273.0</td>\n",
" <td>168822.0</td>\n",
" <td>169832.0</td>\n",
" <td>171469.0</td>\n",
" <td>179530.0</td>\n",
" <td>189658.0</td>\n",
" <td>...</td>\n",
" <td>527394.0</td>\n",
" <td>532263.0</td>\n",
" <td>537279.0</td>\n",
" <td>529271.0</td>\n",
" <td>562239.0</td>\n",
" <td>557245.0</td>\n",
" <td>549926.0</td>\n",
" <td>578179.0</td>\n",
" <td>576597</td>\n",
" <td>587492</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Rice (Milled Equivalent)</td>\n",
" <td>122700.0</td>\n",
" <td>131842.0</td>\n",
" <td>139507.0</td>\n",
" <td>148304.0</td>\n",
" <td>150056.0</td>\n",
" <td>155583.0</td>\n",
" <td>158587.0</td>\n",
" <td>164614.0</td>\n",
" <td>167922.0</td>\n",
" <td>...</td>\n",
" <td>361107.0</td>\n",
" <td>366025.0</td>\n",
" <td>372629.0</td>\n",
" <td>378698.0</td>\n",
" <td>389708.0</td>\n",
" <td>394221.0</td>\n",
" <td>398559.0</td>\n",
" <td>404152.0</td>\n",
" <td>406787</td>\n",
" <td>410880</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Barley and products</td>\n",
" <td>46180.0</td>\n",
" <td>48915.0</td>\n",
" <td>51642.0</td>\n",
" <td>54184.0</td>\n",
" <td>54945.0</td>\n",
" <td>55463.0</td>\n",
" <td>56424.0</td>\n",
" <td>60455.0</td>\n",
" <td>65501.0</td>\n",
" <td>...</td>\n",
" <td>102055.0</td>\n",
" <td>97185.0</td>\n",
" <td>100981.0</td>\n",
" <td>93310.0</td>\n",
" <td>98209.0</td>\n",
" <td>99135.0</td>\n",
" <td>92563.0</td>\n",
" <td>92570.0</td>\n",
" <td>88766</td>\n",
" <td>99452</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Maize and products</td>\n",
" <td>168039.0</td>\n",
" <td>168305.0</td>\n",
" <td>172905.0</td>\n",
" <td>175468.0</td>\n",
" <td>190304.0</td>\n",
" <td>200860.0</td>\n",
" <td>213050.0</td>\n",
" <td>215613.0</td>\n",
" <td>221953.0</td>\n",
" <td>...</td>\n",
" <td>545024.0</td>\n",
" <td>549036.0</td>\n",
" <td>543280.0</td>\n",
" <td>573892.0</td>\n",
" <td>592231.0</td>\n",
" <td>557940.0</td>\n",
" <td>584337.0</td>\n",
" <td>603297.0</td>\n",
" <td>608730</td>\n",
" <td>671300</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Millet and products</td>\n",
" <td>19075.0</td>\n",
" <td>19019.0</td>\n",
" <td>19740.0</td>\n",
" <td>20353.0</td>\n",
" <td>18377.0</td>\n",
" <td>20860.0</td>\n",
" <td>22997.0</td>\n",
" <td>21785.0</td>\n",
" <td>23966.0</td>\n",
" <td>...</td>\n",
" <td>25789.0</td>\n",
" <td>25496.0</td>\n",
" <td>25997.0</td>\n",
" <td>26750.0</td>\n",
" <td>26373.0</td>\n",
" <td>24575.0</td>\n",
" <td>27039.0</td>\n",
" <td>25740.0</td>\n",
" <td>26105</td>\n",
" <td>26346</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 54 columns</p>\n",
"</div>"
],
"text/plain": [
" Item_Name Y1961 Y1962 Y1963 Y1964 Y1965 \\\n",
"0 Wheat and products 138829.0 144643.0 147325.0 156273.0 168822.0 \n",
"1 Rice (Milled Equivalent) 122700.0 131842.0 139507.0 148304.0 150056.0 \n",
"2 Barley and products 46180.0 48915.0 51642.0 54184.0 54945.0 \n",
"3 Maize and products 168039.0 168305.0 172905.0 175468.0 190304.0 \n",
"4 Millet and products 19075.0 19019.0 19740.0 20353.0 18377.0 \n",
"\n",
" Y1966 Y1967 Y1968 Y1969 ... Y2004 Y2005 \\\n",
"0 169832.0 171469.0 179530.0 189658.0 ... 527394.0 532263.0 \n",
"1 155583.0 158587.0 164614.0 167922.0 ... 361107.0 366025.0 \n",
"2 55463.0 56424.0 60455.0 65501.0 ... 102055.0 97185.0 \n",
"3 200860.0 213050.0 215613.0 221953.0 ... 545024.0 549036.0 \n",
"4 20860.0 22997.0 21785.0 23966.0 ... 25789.0 25496.0 \n",
"\n",
" Y2006 Y2007 Y2008 Y2009 Y2010 Y2011 Y2012 Y2013 \n",
"0 537279.0 529271.0 562239.0 557245.0 549926.0 578179.0 576597 587492 \n",
"1 372629.0 378698.0 389708.0 394221.0 398559.0 404152.0 406787 410880 \n",
"2 100981.0 93310.0 98209.0 99135.0 92563.0 92570.0 88766 99452 \n",
"3 543280.0 573892.0 592231.0 557940.0 584337.0 603297.0 608730 671300 \n",
"4 25997.0 26750.0 26373.0 24575.0 27039.0 25740.0 26105 26346 \n",
"\n",
"[5 rows x 54 columns]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"item_df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "3fa01e1f-bedd-431b-90c3-8d7d70545f34",
"_uuid": "56a647293f1c1aba7c184f249021e008a4d5a8f2"
},
"source": [
"# Some more feature engineering\n",
"\n",
"This time, we will use the new features to get some good conclusions.\n",
"\n",
"# 1. Total amount of item produced from 1961 to 2013\n",
"# 2. Providing a rank to the items to know the most produced item"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"_cell_guid": "3a6bb102-6749-4818-860d-59aaad6de07f",
"_uuid": "9e816786e7a161227ae72d164b25c0029e01e5b4",
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<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>Item_Name</th>\n",
" <th>Y1961</th>\n",
" <th>Y1962</th>\n",
" <th>Y1963</th>\n",
" <th>Y1964</th>\n",
" <th>Y1965</th>\n",
" <th>Y1966</th>\n",
" <th>Y1967</th>\n",
" <th>Y1968</th>\n",
" <th>Y1969</th>\n",
" <th>...</th>\n",
" <th>Y2006</th>\n",
" <th>Y2007</th>\n",
" <th>Y2008</th>\n",
" <th>Y2009</th>\n",
" <th>Y2010</th>\n",
" <th>Y2011</th>\n",
" <th>Y2012</th>\n",
" <th>Y2013</th>\n",
" <th>Sum</th>\n",
" <th>Production_Rank</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Wheat and products</td>\n",
" <td>138829.0</td>\n",
" <td>144643.0</td>\n",
" <td>147325.0</td>\n",
" <td>156273.0</td>\n",
" <td>168822.0</td>\n",
" <td>169832.0</td>\n",
" <td>171469.0</td>\n",
" <td>179530.0</td>\n",
" <td>189658.0</td>\n",
" <td>...</td>\n",
" <td>537279.0</td>\n",
" <td>529271.0</td>\n",
" <td>562239.0</td>\n",
" <td>557245.0</td>\n",
" <td>549926.0</td>\n",
" <td>578179.0</td>\n",
" <td>576597</td>\n",
" <td>587492</td>\n",
" <td>19194671.0</td>\n",
" <td>6.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Rice (Milled Equivalent)</td>\n",
" <td>122700.0</td>\n",
" <td>131842.0</td>\n",
" <td>139507.0</td>\n",
" <td>148304.0</td>\n",
" <td>150056.0</td>\n",
" <td>155583.0</td>\n",
" <td>158587.0</td>\n",
" <td>164614.0</td>\n",
" <td>167922.0</td>\n",
" <td>...</td>\n",
" <td>372629.0</td>\n",
" <td>378698.0</td>\n",
" <td>389708.0</td>\n",
" <td>394221.0</td>\n",
" <td>398559.0</td>\n",
" <td>404152.0</td>\n",
" <td>406787</td>\n",
" <td>410880</td>\n",
" <td>14475448.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Barley and products</td>\n",
" <td>46180.0</td>\n",
" <td>48915.0</td>\n",
" <td>51642.0</td>\n",
" <td>54184.0</td>\n",
" <td>54945.0</td>\n",
" <td>55463.0</td>\n",
" <td>56424.0</td>\n",
" <td>60455.0</td>\n",
" <td>65501.0</td>\n",
" <td>...</td>\n",
" <td>100981.0</td>\n",
" <td>93310.0</td>\n",
" <td>98209.0</td>\n",
" <td>99135.0</td>\n",
" <td>92563.0</td>\n",
" <td>92570.0</td>\n",
" <td>88766</td>\n",
" <td>99452</td>\n",
" <td>4442742.0</td>\n",
" <td>20.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Maize and products</td>\n",
" <td>168039.0</td>\n",
" <td>168305.0</td>\n",
" <td>172905.0</td>\n",
" <td>175468.0</td>\n",
" <td>190304.0</td>\n",
" <td>200860.0</td>\n",
" <td>213050.0</td>\n",
" <td>215613.0</td>\n",
" <td>221953.0</td>\n",
" <td>...</td>\n",
" <td>543280.0</td>\n",
" <td>573892.0</td>\n",
" <td>592231.0</td>\n",
" <td>557940.0</td>\n",
" <td>584337.0</td>\n",
" <td>603297.0</td>\n",
" <td>608730</td>\n",
" <td>671300</td>\n",
" <td>19960640.0</td>\n",
" <td>5.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Millet and products</td>\n",
" <td>19075.0</td>\n",
" <td>19019.0</td>\n",
" <td>19740.0</td>\n",
" <td>20353.0</td>\n",
" <td>18377.0</td>\n",
" <td>20860.0</td>\n",
" <td>22997.0</td>\n",
" <td>21785.0</td>\n",
" <td>23966.0</td>\n",
" <td>...</td>\n",
" <td>25997.0</td>\n",
" <td>26750.0</td>\n",
" <td>26373.0</td>\n",
" <td>24575.0</td>\n",
" <td>27039.0</td>\n",
" <td>25740.0</td>\n",
" <td>26105</td>\n",
" <td>26346</td>\n",
" <td>1225400.0</td>\n",
" <td>38.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 56 columns</p>\n",
"</div>"
],
"text/plain": [
" Item_Name Y1961 Y1962 Y1963 Y1964 Y1965 \\\n",
"0 Wheat and products 138829.0 144643.0 147325.0 156273.0 168822.0 \n",
"1 Rice (Milled Equivalent) 122700.0 131842.0 139507.0 148304.0 150056.0 \n",
"2 Barley and products 46180.0 48915.0 51642.0 54184.0 54945.0 \n",
"3 Maize and products 168039.0 168305.0 172905.0 175468.0 190304.0 \n",
"4 Millet and products 19075.0 19019.0 19740.0 20353.0 18377.0 \n",
"\n",
" Y1966 Y1967 Y1968 Y1969 ... Y2006 \\\n",
"0 169832.0 171469.0 179530.0 189658.0 ... 537279.0 \n",
"1 155583.0 158587.0 164614.0 167922.0 ... 372629.0 \n",
"2 55463.0 56424.0 60455.0 65501.0 ... 100981.0 \n",
"3 200860.0 213050.0 215613.0 221953.0 ... 543280.0 \n",
"4 20860.0 22997.0 21785.0 23966.0 ... 25997.0 \n",
"\n",
" Y2007 Y2008 Y2009 Y2010 Y2011 Y2012 Y2013 \\\n",
"0 529271.0 562239.0 557245.0 549926.0 578179.0 576597 587492 \n",
"1 378698.0 389708.0 394221.0 398559.0 404152.0 406787 410880 \n",
"2 93310.0 98209.0 99135.0 92563.0 92570.0 88766 99452 \n",
"3 573892.0 592231.0 557940.0 584337.0 603297.0 608730 671300 \n",
"4 26750.0 26373.0 24575.0 27039.0 25740.0 26105 26346 \n",
"\n",
" Sum Production_Rank \n",
"0 19194671.0 6.0 \n",
"1 14475448.0 8.0 \n",
"2 4442742.0 20.0 \n",
"3 19960640.0 5.0 \n",
"4 1225400.0 38.0 \n",
"\n",
"[5 rows x 56 columns]"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sum_col = []\n",
"for i in range(115):\n",
" sum_col.append(item_df.iloc[i,1:].values.sum())\n",
"item_df['Sum'] = sum_col\n",
"item_df['Production_Rank'] = item_df['Sum'].rank(ascending=False)\n",
"\n",
"item_df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "7e20740c-565b-4969-a52e-d986e462b750",
"_uuid": "f483c9add5f6af9af9162b5425f6d65eb1c5f4aa"
},
"source": [
"# Now, we find the most produced food items in the last half-century"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"_cell_guid": "3130fe83-404c-4b3c-addc-560b2e2f32bf",
"_uuid": "0403e9ab2e13587588e3a30d64b8b6638571d3d5"
},
"outputs": [
{
"data": {
"text/plain": [
"56 Cereals - Excluding Beer\n",
"65 Fruits - Excluding Wine\n",
"3 Maize and products\n",
"53 Milk - Excluding Butter\n",
"6 Potatoes and products\n",
"1 Rice (Milled Equivalent)\n",
"57 Starchy Roots\n",
"64 Vegetables\n",
"27 Vegetables, Other\n",
"0 Wheat and products\n",
"Name: Item_Name, dtype: object"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"item_df['Item_Name'][item_df['Production_Rank'] < 11.0].sort_values()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "b6212fed-588b-426e-9271-6d857cd6aacb",
"_uuid": "e2c83f4c851b755ea6cf19f1bca168e705bd4edd"
},
"source": [
"So, cereals, fruits and maize are the most produced items in the last 50 years\n",
"\n",
"# Food and feed plot for most produced items "
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"_cell_guid": "493f9940-1762-4718-acb4-fba5c4c73f4b",
"_uuid": "f8454c5200bdeb3995b9a0ada3deb5ca1c31f181"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/anaconda3/lib/python3.7/site-packages/seaborn/categorical.py:3666: UserWarning: The `factorplot` function has been renamed to `catplot`. The original name will be removed in a future release. Please update your code. Note that the default `kind` in `factorplot` (`'point'`) has changed `'strip'` in `catplot`.\n",
" warnings.warn(msg)\n",
"/anaconda3/lib/python3.7/site-packages/seaborn/categorical.py:3672: UserWarning: The `size` paramter has been renamed to `height`; please update your code.\n",
" warnings.warn(msg, UserWarning)\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMcAAAWYCAYAAACyPKHBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzs3X/M7ndd3/HXmxahBrbCOGzQltTMEkFlBY6sDmMyJIgkS1Fxw4j8kARd2CKZaYbGGHBjP4JKhDkchgElZMhAY2cYwhC2MfmxAxxbSnXWwaCjgcPkRwnQpPWzP+5v4+3htL17eq5zevp6PJIr93V9vt/vdb3vf5/5/pi1VgAAAACg0X3O9AAAAAAAcKaIYwAAAADUEscAAAAAqCWOAQAAAFBLHAMAAACgljgGAAAAQC1xDAAAAIBa4hgAAAAAtcQxAAAAAGqde6YHuDue+tSnrne84x1negwAAACAe5o50wOcLc7qM8c+//nPn+kRAAAAADiLndVxDAAAAADuDnEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAA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AAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUEscAwAAAKCWOAYAAABALXEMAAAAgFriGAAAAAC1xDEAAAAAaoljAAAAANQSxwAAAACoJY4BAAAAUGtncWxm7j8zH5qZP5yZa2fmpdv6t8zMB2fmT2bmN2fmm7b1+22fr9+2X7yr2QAAAAAg2e2ZYzcnedJa628luTTJU2fmsiT/Oskr1lqXJPlCkudv+z8/yRfWWt+a5BXbfgAAAACwMzuLY2vPV7aP991eK8mTkrx1W39Dkqdv7y/fPmfb/n0zM7uaDwAAAAB2es+xmTlnZo4m+VySdyX50yRfXGvdsu1yQ5ILtvcXJPl0kmzbv5Tkr+1yPgAAAAC67TSOrbVuXWtdmuTCJE9I8qgT7bb9PdFZYuv4hZl5wcwcmZkjx44dO3XDAgAAAFDntDytcq31xSTvTXJZkvNn5txt04VJPrO9vyHJRUmybf+rSf7sBN/1mrXW4bXW4UOHDu16dAAAAADuxXb5tMpDM3P+9v68JE9Ocl2S9yR5xrbbc5L8zvb+qu1ztu2/v9b6hjPHAAAAAOBUOffOdzlpD0vyhpk5J3sR7i1rrd+dmY8nefPM/PMkH03y2m3/1yZ548xcn70zxp65w9kAAAAAYHdxbK11dZLHnmD9f2fv/mPHr389yY/sah4AAAAAON5puecYAAAAANwTiWMAAAAA1BLHAAAAAKgljgEAAABQSxwDAAAAoJY4BgAAAEAtcQwAAACAWuIYAAAAALXEMQAAAABqiWMAAAAA1BLHAAAAAKgljgEAAABQSxwDAAAAoJY4BgAAAEAtcQwAAACAWuIYAAAAALXEMQAAAABqiWM
"text/plain": [
"<Figure size 1212.38x1440 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.factorplot(\"Item\", data=df[(df['Item']=='Wheat and products') | (df['Item']=='Rice (Milled Equivalent)') | (df['Item']=='Maize and products') | (df['Item']=='Potatoes and products') | (df['Item']=='Vegetables, Other') | (df['Item']=='Milk - Excluding Butter') | (df['Item']=='Cereals - Excluding Beer') | (df['Item']=='Starchy Roots') | (df['Item']=='Vegetables') | (df['Item']=='Fruits - Excluding Wine')], kind=\"count\", hue=\"Element\", size=20, aspect=.8)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "45dda825-49a0-41ab-9ebd-eaa609aac986",
"_uuid": "ce5b2d38ff24ea08da632c4e2773dbd0bd026b9d",
"collapsed": true
},
"source": [
"# Now, we plot a heatmap of correlation of produce in difference years"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"_cell_guid": "b1bab0ec-6615-452c-8d06-a81d4f2ae252",
"_uuid": "a2ed2aae2364810ce640648cf50880adcf2cdcc4"
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x1a23b4b128>"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2QAAAJYCAYAAAANJyWqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzs3X+QXOV95/v3p+eHhMaSk9goldjcJa615LKNpGDWcCsOZkOFQNjF67gQTCjuboktXXnlW3XvJgRSgQ0kUTZFvCorlZQpRRYs4BVyvCaghUireA0yjlKLUIQYsCxbFInHSiyDsQ36wcx0f+8f5wg37Z7pPl8PTc/o86rqmp7znO95nnP6nNPzzDnn+ygiMDMzMzMzs96rvdkNMDMzMzMzO1O5Q2ZmZmZmZvYmcYfMzMzMzMzsTeIOmZmZmZmZ2ZvEHTIzMzMzM7M3iTtkZmZmZmZmbxJ3yMzMzMzMzN4k7pCZmZmZmZm9SdwhMzMzMzMze5O4Q2ZmZmZmZvYmGXyzG5A1+cJzUTmoPlk5JCYnKscAxInvV47R4HCurqlcG1PUmz58vPxCT+opKmvk4iZfrV7Vi/+Yq2swcahOTe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JYy0xKyXtlfS0pB2SljSVrSjLninLF7bEPtS6PDMzMzMzm+cajd69+syMHbIorv+uAzZKWihpBNgArAfuBi5vE7YFuDkizgMeAG6E1zIo3gesi4j3AZcAr92/IenXgFd+zPUxMzMzMzObMzrepB8RY5J2ADdRZES8JyKOAEckndsmZDmwp3y/myLd/a0UY5MdjIinyuW+eDpA0luA/wisBT6XXRkzMzMzM5uDzuBnyLp9avp2YD8wAVzQYd4x4CrgQeBq4Jxy+jIgJO0Czgb
"text/plain": [
"<Figure size 1152x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"year_df = df.iloc[:,10:]\n",
"fig, ax = plt.subplots(figsize=(16,10))\n",
"sns.heatmap(year_df.corr(), ax=ax)"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "43e1af94-ba07-4b95-8da3-1d774db940cd",
"_uuid": "70d2b0a7db9b8a5535b3c5b3c2eb927b904bf6d3"
},
"source": [
"So, we gather that a given year's production is more similar to its immediate previous and immediate following years."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"_cell_guid": "58cde27d-5ddc-4ebe-a8e1-80a8257f44c1",
"_uuid": "6f48b52c09ea6a207644044cace5a88c983bf316"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/anaconda3/lib/python3.7/site-packages/scipy/stats/stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.\n",
" return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAogAAAJQCAYAAAANJJX4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8v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VjU4rcdCeP/HMvVU1+JuemceWiEk6fXZCisx886X2FEAmjtabOF6K9n3AYMzT3vbqLZ8qqATjt2HxuPm8OrkHWJVVKMULmfgshRpjetuR6f28TN6/ZQjBikJvm5K4lpRw7PgO7zSydN3VcOl+cNyFFZ3z0JCAKIRJCa01tawh/uO9wGIkZ3PH8dtbtNOsqf3FuIT86a/B1lTs65JGyOlAIMXL0tiXX+l313P7cNiIxTVGWh7uXlDIp14vTbqMwyzPoL7jDkQREIcSQG0g4DIRj3LK2vLOu8lc+MZkrP1sy6LrKw71clRBi5DrYFqK1Wzh8YXM1v3x5J4aGY/LTuGtxKeMz3SOiOspgSEAUQgwprTU1rUEC4Vifx7RYdZW3WXWVv/3paVy2sHjQVwC9LjuFmcO/IoEQYuTpbdeFJzdUcv8bFQDMKsrk5xfPJ9vrHDHVUQYjYTFXKfWwUqpOKbUlri1PKfWyUmqX9TvXaldKqfuUUruVUmVKqZPiHnO5dfwupdTlce2fUEptth5zn7I+Wfp6DSFE4hmGprql/3BY7wvx/cc3sq3ahwKu+cIMvnrKlEGHw0yPc9R1yEKI1NNaU9ca7BIOtdY89OZHneHwhOIcfvmVUrK9TtLdDiZkj76+KJHXQR8Bzu7Wtgx4VWs9A3j
"text/plain": [
"<Figure size 720x720 with 4 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row', figsize=(10,10))\n",
"ax1.set(xlabel='Y1968', ylabel='Y1961')\n",
"ax2.set(xlabel='Y1968', ylabel='Y1963')\n",
"ax3.set(xlabel='Y1968', ylabel='Y1986')\n",
"ax4.set(xlabel='Y1968', ylabel='Y2013')\n",
"sns.jointplot(x=\"Y1968\", y=\"Y1961\", data=df, kind=\"reg\", ax=ax1)\n",
"sns.jointplot(x=\"Y1968\", y=\"Y1963\", data=df, kind=\"reg\", ax=ax2)\n",
"sns.jointplot(x=\"Y1968\", y=\"Y1986\", data=df, kind=\"reg\", ax=ax3)\n",
"sns.jointplot(x=\"Y1968\", y=\"Y2013\", data=df, kind=\"reg\", ax=ax4)\n",
"plt.close(2)\n",
"plt.close(3)\n",
"plt.close(4)\n",
"plt.close(5)"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "8a297a06-977f-4ff7-a9ad-c7e8804930a8",
"_uuid": "6b738ce8b15a764fab90fac96f9534f94c14342e"
},
"source": [
"# Heatmap of production of food items over years\n",
"\n",
"This will detect the items whose production has drastically increased over the years"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"_cell_guid": "588cebd9-e97c-460d-8ed5-e663ac293711",
"_uuid": "16ce47d43a3038874a74d8bbb9a2e26f6ee54437"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2UAAAVRCAYAAAAATSHSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzs3XmcXEW99/HPdyYrQYKAImIgElkuCWQgAWUxEkS8oheIgGFxyQXNgwsoz0XkuiDLVdZHBXkAcxUhiIAs8UbgQnggCWGTJGSZBFkEoiJuXHbIQmZ+zx+nmjRDd+ZM0p3evu/Xa15zuk6dqjp1zvR0ddWpUkRgZmZmZmZmtdFW6wKYmZmZmZm1MjfKzMzMzMzMasiNMjMzMzMzsxpyo8zMzMzMzKyG3CgzMzMzMzOrITfKzMzMzMzMasiNMjMzMzMzsxpyo8zMzMzMzKyG3CgzMzMzMzOrITfKzMzMzMzMaqhfrQtgtr7es9mo6C1OG6ponu3K/32G+hA3V3o5z6VN+eI1S3rVkLeM7Tm/38p736jCdZM337x/J/37cE/nrZu855y3jJW+byr9DWY/teeKt0XbwArnXLu/qbx12F7xa5f377jy9fI63bni9c9ZO3nrMO81Dnr99w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X6rHiRUuhxeSNjMzM7Om1pLDF9PMg58Ado+IlelD/4BeDlvfPNsjoquaeVRYB9l097f23CGpX0TMI1vwGbIFo/unKfrNzMzMzKwPWrWnbCvg2YhYCRARz0bEM/DmnpnUGzQrbb9D0h2SHpL0E0l/KIr3a0nzU8/b5EImkl6RdKak3wJ7FRdA0ixJ50p6UNJjkj6YwgdJ+rmkTkk
"text/plain": [
"<Figure size 864x1728 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"new_item_df = item_df.drop([\"Item_Name\",\"Sum\",\"Production_Rank\"], axis = 1)\n",
"fig, ax = plt.subplots(figsize=(12,24))\n",
"sns.heatmap(new_item_df,ax=ax)\n",
"ax.set_yticklabels(item_df.Item_Name.values[::-1])\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "825620f9-7ab5-4fe2-9529-c4f1a300138e",
"_uuid": "5c42595537332ea71089d8c3dc041d3bf7d41b55"
},
"source": [
"There is considerable growth in production of Palmkernel oil, Meat/Aquatic animals, ricebran oil, cottonseed, seafood, offals, roots, poultry meat, mutton, bear, cocoa, coffee and soyabean oil.\n",
"There has been exceptional growth in production of onions, cream, sugar crops, treenuts, butter/ghee and to some extent starchy roots."
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "80428f51-2fd4-468d-9530-9279215b4218",
"_uuid": "4c9bb27cd76099c5348243a99448c509ef0c5ded"
},
"source": [
"Now, we look at clustering."
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "a3f1db3a-1b82-4e42-8e7d-f1a26915693b",
"_uuid": "da167de5a5b92e164fc6993b32ebbfab4ef9a6e3",
"collapsed": true
},
"source": [
"# What is clustering?\n",
"Cluster analysis or clustering is the task of grouping a set of objects in such a way that objects in the same group (called a cluster) are more similar (in some sense) to each other than to those in other groups (clusters). It is a main task of exploratory data mining, and a common technique for statistical data analysis, used in many fields, including machine learning, pattern recognition, image analysis, information retrieval, bioinformatics, data compression, and computer graphics."
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "136315a0-b37d-4d89-bd0d-037727062c34",
"_uuid": "04ab802ec92eaf6a27706f2008933dcf3865855a"
},
"source": [
"# Today, we will form clusters to classify countries based on productivity scale"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "27ba0b5d-c57e-485d-9588-017e16fe1904",
"_uuid": "659afdada04e8854765b5e7208394915b30f859a"
},
"source": [
"For this, we will use k-means clustering algorithm.\n",
"# K-means clustering\n",
"(Source [Wikipedia](https://en.wikipedia.org/wiki/K-means_clustering#Standard_algorithm) )\n",
"![http://gdurl.com/5BbP](http://gdurl.com/5BbP)"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "7aeb3175-33bd-4f49-903a-57d43380e90e",
"_uuid": "6b0b4881e623ed3c133b68b98e6fb6755e18fd78"
},
"source": [
"This is the data we will use."
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"_cell_guid": "a5b99ea8-975f-4467-9895-bffe1db876eb",
"_uuid": "57aba4000bfc422e848b14ad24b02a570d6c0554"
},
"outputs": [
{
"data": {
"text/html": [
"<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>Y1961</th>\n",
" <th>Y1962</th>\n",
" <th>Y1963</th>\n",
" <th>Y1964</th>\n",
" <th>Y1965</th>\n",
" <th>Y1966</th>\n",
" <th>Y1967</th>\n",
" <th>Y1968</th>\n",
" <th>Y1969</th>\n",
" <th>Y1970</th>\n",
" <th>...</th>\n",
" <th>Y2006</th>\n",
" <th>Y2007</th>\n",
" <th>Y2008</th>\n",
" <th>Y2009</th>\n",
" <th>Y2010</th>\n",
" <th>Y2011</th>\n",
" <th>Y2012</th>\n",
" <th>Y2013</th>\n",
" <th>Mean_Produce</th>\n",
" <th>Rank</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Afghanistan</th>\n",
" <td>9481.0</td>\n",
" <td>9414.0</td>\n",
" <td>9194.0</td>\n",
" <td>10170.0</td>\n",
" <td>10473.0</td>\n",
" <td>10169.0</td>\n",
" <td>11289.0</td>\n",
" <td>11508.0</td>\n",
" <td>11815.0</td>\n",
" <td>10454.0</td>\n",
" <td>...</td>\n",
" <td>18317.0</td>\n",
" <td>19248.0</td>\n",
" <td>19381.0</td>\n",
" <td>20661.0</td>\n",
" <td>21030.0</td>\n",
" <td>21100.0</td>\n",
" <td>22706.0</td>\n",
" <td>23007.0</td>\n",
" <td>13003.056604</td>\n",
" <td>69.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Albania</th>\n",
" <td>1706.0</td>\n",
" <td>1749.0</td>\n",
" <td>1767.0</td>\n",
" <td>1889.0</td>\n",
" <td>1884.0</td>\n",
" <td>1995.0</td>\n",
" <td>2046.0</td>\n",
" <td>2169.0</td>\n",
" <td>2230.0</td>\n",
" <td>2395.0</td>\n",
" <td>...</td>\n",
" <td>6911.0</td>\n",
" <td>6744.0</td>\n",
" <td>7168.0</td>\n",
" <td>7316.0</td>\n",
" <td>7907.0</td>\n",
" <td>8114.0</td>\n",
" <td>8221.0</td>\n",
" <td>8271.0</td>\n",
" <td>4475.509434</td>\n",
" <td>104.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Algeria</th>\n",
" <td>7488.0</td>\n",
" <td>7235.0</td>\n",
" <td>6861.0</td>\n",
" <td>7255.0</td>\n",
" <td>7509.0</td>\n",
" <td>7536.0</td>\n",
" <td>7986.0</td>\n",
" <td>8839.0</td>\n",
" <td>9003.0</td>\n",
" <td>9355.0</td>\n",
" <td>...</td>\n",
" <td>51067.0</td>\n",
" <td>49933.0</td>\n",
" <td>50916.0</td>\n",
" <td>57505.0</td>\n",
" <td>60071.0</td>\n",
" <td>65852.0</td>\n",
" <td>69365.0</td>\n",
" <td>72161.0</td>\n",
" <td>28879.490566</td>\n",
" <td>38.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Angola</th>\n",
" <td>4834.0</td>\n",
" <td>4775.0</td>\n",
" <td>5240.0</td>\n",
" <td>5286.0</td>\n",
" <td>5527.0</td>\n",
" <td>5677.0</td>\n",
" <td>5833.0</td>\n",
" <td>5685.0</td>\n",
" <td>6219.0</td>\n",
" <td>6460.0</td>\n",
" <td>...</td>\n",
" <td>28247.0</td>\n",
" <td>29877.0</td>\n",
" <td>32053.0</td>\n",
" <td>36985.0</td>\n",
" <td>38400.0</td>\n",
" <td>40573.0</td>\n",
" <td>38064.0</td>\n",
" <td>48639.0</td>\n",
" <td>13321.056604</td>\n",
" <td>68.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Antigua and Barbuda</th>\n",
" <td>92.0</td>\n",
" <td>94.0</td>\n",
" <td>105.0</td>\n",
" <td>95.0</td>\n",
" <td>84.0</td>\n",
" <td>73.0</td>\n",
" <td>64.0</td>\n",
" <td>59.0</td>\n",
" <td>68.0</td>\n",
" <td>77.0</td>\n",
" <td>...</td>\n",
" <td>110.0</td>\n",
" <td>122.0</td>\n",
" <td>115.0</td>\n",
" <td>114.0</td>\n",
" <td>115.0</td>\n",
" <td>118.0</td>\n",
" <td>113.0</td>\n",
" <td>119.0</td>\n",
" <td>83.886792</td>\n",
" <td>172.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 55 columns</p>\n",
"</div>"
],
"text/plain": [
" Y1961 Y1962 Y1963 Y1964 Y1965 Y1966 \\\n",
"Afghanistan 9481.0 9414.0 9194.0 10170.0 10473.0 10169.0 \n",
"Albania 1706.0 1749.0 1767.0 1889.0 1884.0 1995.0 \n",
"Algeria 7488.0 7235.0 6861.0 7255.0 7509.0 7536.0 \n",
"Angola 4834.0 4775.0 5240.0 5286.0 5527.0 5677.0 \n",
"Antigua and Barbuda 92.0 94.0 105.0 95.0 84.0 73.0 \n",
"\n",
" Y1967 Y1968 Y1969 Y1970 ... Y2006 \\\n",
"Afghanistan 11289.0 11508.0 11815.0 10454.0 ... 18317.0 \n",
"Albania 2046.0 2169.0 2230.0 2395.0 ... 6911.0 \n",
"Algeria 7986.0 8839.0 9003.0 9355.0 ... 51067.0 \n",
"Angola 5833.0 5685.0 6219.0 6460.0 ... 28247.0 \n",
"Antigua and Barbuda 64.0 59.0 68.0 77.0 ... 110.0 \n",
"\n",
" Y2007 Y2008 Y2009 Y2010 Y2011 Y2012 \\\n",
"Afghanistan 19248.0 19381.0 20661.0 21030.0 21100.0 22706.0 \n",
"Albania 6744.0 7168.0 7316.0 7907.0 8114.0 8221.0 \n",
"Algeria 49933.0 50916.0 57505.0 60071.0 65852.0 69365.0 \n",
"Angola 29877.0 32053.0 36985.0 38400.0 40573.0 38064.0 \n",
"Antigua and Barbuda 122.0 115.0 114.0 115.0 118.0 113.0 \n",
"\n",
" Y2013 Mean_Produce Rank \n",
"Afghanistan 23007.0 13003.056604 69.0 \n",
"Albania 8271.0 4475.509434 104.0 \n",
"Algeria 72161.0 28879.490566 38.0 \n",
"Angola 48639.0 13321.056604 68.0 \n",
"Antigua and Barbuda 119.0 83.886792 172.0 \n",
"\n",
"[5 rows x 55 columns]"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"new_df.head()"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"_cell_guid": "66964df2-892d-4e55-a4b1-f94d10e4c7dd",
"_uuid": "19bdd89a3ad9df962959ad6b996946f6f3916d58"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:4: FutureWarning: convert_objects is deprecated. To re-infer data dtypes for object columns, use DataFrame.infer_objects()\n",
"For all other conversions use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric.\n",
" after removing the cwd from sys.path.\n"
]
}
],
"source": [
"X = new_df.iloc[:,:-2].values\n",
"\n",
"X = pd.DataFrame(X)\n",
"X = X.convert_objects(convert_numeric=True)\n",
"X.columns = year_list"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "461e5bcc-0101-4ea1-ae13-20600f883929",
"_uuid": "0d3e50235c9505ebc255053d4a5aae547fc17d8d"
},
"source": [
"# Elbow method to select number of clusters\n",
"This method looks at the percentage of variance explained as a function of the number of clusters: One should choose a number of clusters so that adding another cluster doesn't give much better modeling of the data. More precisely, if one plots the percentage of variance explained by the clusters against the number of clusters, the first clusters will add much information (explain a lot of variance), but at some point the marginal gain will drop, giving an angle in the graph. The number of clusters is chosen at this point, hence the \"elbow criterion\". This \"elbow\" cannot always be unambiguously identified. Percentage of variance explained is the ratio of the between-group variance to the total variance, also known as an F-test. A slight variation of this method plots the curvature of the within group variance.\n",
"# Basically, number of clusters = the x-axis value of the point that is the corner of the \"elbow\"(the plot looks often looks like an elbow)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"_cell_guid": "06271223-bd32-48ac-a373-6c1e6bbf7c7b",
"_uuid": "c57d7277510a8c11fdc3d311e4d8a22539617ed9"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEWCAYAAACJ0YulAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3XmcXHWd7vHPU72ks3fHNDEk3R02WWRLpWEQVNzuDLiAe0AZ98EFRL06zoz3jnq9M1edcZxxxA1REeWCERgBxX1BREU6CyGIQAxLdwhkIXsnvdV3/jinO5Wm090JXV3b83696tXnnDp1zvcUoZ4651e/31FEYGZmBpApdgFmZl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jUBjBwqapzJ0xxSOmmlnVcSiMYLATmxubzazaOBQOINvWxMNbutmyq6fYpZiZTRqHwgEMdmJzu4KZVROHwgGcvHA2tRn5EpKZVRWHwgE01NXw7MNnscKNzWZWRRwKo1jc2sTqru3uxGZmVaNgoSDp65I2SlpzgOdfIGm7pFXp46OFquVQZdua2NM3wJ8edyc2M6sOhTxTuAo4Z4x1bo+IU9PHJwpYyyHJtjYCuF3BzKpGwUIhIn4NPFmo7U+GBY1TOWzmFN+e08yqRrHbFJ4j6W5JP5T07CLX8hRJJ7YmnymYWdUoZiisANoi4hTg88D3DrSipIsldUjq2LRp06QVCMk4SJ1P7mHTTndiM7PKV7RQiIgdEbErnb4VqJM09wDrXhER7RHR3tzcPKl1ZtvcrmBm1aNooSDpmZKUTp+e1rKlWPUcyLMPn01djTuxmVl1qC3UhiVdC7wAmCupC/gYUAcQEV8GXgu8W1I/sAe4ICKiUPUcqqQT22x
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"from sklearn.cluster import KMeans\n",
"wcss = []\n",
"for i in range(1,11):\n",
" kmeans = KMeans(n_clusters=i,init='k-means++',max_iter=300,n_init=10,random_state=0)\n",
" kmeans.fit(X)\n",
" wcss.append(kmeans.inertia_)\n",
"plt.plot(range(1,11),wcss)\n",
"plt.title('The Elbow Method')\n",
"plt.xlabel('Number of clusters')\n",
"plt.ylabel('WCSS')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "ad4bc40a-9540-497d-95e3-3fee6088ea95",
"_uuid": "6450dd1c3d7a8114931dc358d2f09a0424b52fd7"
},
"source": [
"As the elbow corner coincides with x=2, we will have to form **2 clusters**. Personally, I would have liked to select 3 to 4 clusters. But trust me, only selecting 2 clusters can lead to best results.\n",
"Now, we apply k-means algorithm."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"_cell_guid": "eed3f672-e089-4dbb-aad8-b9618967abf3",
"_uuid": "d92d758ee7213ddcd84e9b8b2f61c9e260ed6ba2"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:4: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.\n",
" after removing the cwd from sys.path.\n"
]
}
],
"source": [
"kmeans = KMeans(n_clusters=2,init='k-means++',max_iter=300,n_init=10,random_state=0) \n",
"y_kmeans = kmeans.fit_predict(X)\n",
"\n",
"X = X.as_matrix(columns=None)"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "ef07bd6d-679d-4375-b7b3-abeca3421e37",
"_uuid": "6f93a4bd3f17427f4b2dbe08af8e015a1e4a2f89"
},
"source": [
"Now, let's visualize the results."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"_cell_guid": "5a7fe139-13df-453b-8c16-891929bc595e",
"_uuid": "a57e0a38f4c0f0385be75fd9f71d4a2d8213aea3"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEICAYAAACj2qi6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xl8VdW9///XhxANiDgg+kOxZZBeCRIBg+B1whnUXhzoo1gHqAMV9Npa+7V49Spa52rha/U64YCgglLnn1ylzrVWCDUGQZREsUQQUARBoAb6+f6x14knycnJTjjJyfB+Ph7ncfZZe+211t45OZ+99rTM3REREYmjXbYbICIiLYeChoiIxKagISIisSloiIhIbAoaIiISm4KGiIjEpqDRipnZJDObke12ZIpFHjKzr81sXrbbUx9mdo+Z/XeGy3zYzK7PZJmNwczGmtlfGqHcH5jZRjPLiZE349u/rVLQaOHM7GdmVhT+eVaa2RwzOyyD5fcwMzez9pkqczscBhwH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hEbs87366qvk5eXx85//HICcnBwmT57M1KlTufzyy5k1axYDBgxg1qxZACxevJhhw4bRq1cv7rjjjspyZsyYwcEHH8yAAQP4xS9+URkgOnXqxNVXX82QIUN45513mDhxIvn5+RQUFPCb39Q2wJmItEQbN2Y2X30paCQ0Yp9v0aJFHHTQQVXSOnfuTI8ePbjqqqv46U9/SnFxMT/96U8BWLJkCS+99BLz5s3j2muvpaKigg8//JBZs2bx9ttvU1xcTE5ODo8+Go1K+u2333LAAQfw7rvvkp+fz9NPP82iRYs
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.scatter(X[y_kmeans == 0, 0], X[y_kmeans == 0,1],s=100,c='red',label='Others')\n",
"plt.scatter(X[y_kmeans == 1, 0], X[y_kmeans == 1,1],s=100,c='blue',label='China(mainland),USA,India')\n",
"plt.scatter(kmeans.cluster_centers_[:,0],kmeans.cluster_centers_[:,1],s=300,c='yellow',label='Centroids')\n",
"plt.title('Clusters of countries by Productivity')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "923d4536-2bce-4b99-b98a-33b801a56a8b",
"_uuid": "fe531e8c41eec0eb5dc52a9890871841f5d27211"
},
"source": [
"So, the blue cluster represents China(Mainland), USA and India while the red cluster represents all the other countries.\n",
"This result was highly probable. Just take a look at the plot of cell 3 above. See how China, USA and India stand out. That has been observed here in clustering too.\n",
"\n",
"You should try this algorithm for 3 or 4 clusters. Looking at the distribution, you will realise why 2 clusters is the best choice for the given data"
]
},
{
"cell_type": "markdown",
"metadata": {
"_cell_guid": "6dee7acb-0f08-4ae1-85b4-f4704026694a",
"_uuid": "179a1ede21ae330664a0b7c63e36574acdc0428c"
},
"source": [
"This is not the end! More is yet to come."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Now, lets try to predict the production using regression for 2020. We will predict the production for USA,India and Pakistan.**\n"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAEWCAYAAACufwpNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xl81NW9//HXJwsQUAy4QgABZRFFReJWrcUVoW7VWrWtxeWW9l77025WaG+r1SpUrbbW1tZb9WoXl6rXoqiICFp3QVRkE2RNQEHDToAsn98f3+/AkMwkM8msyfv5eOSRmTPf+c45JvLJOZ+zmLsjIiKSCgXZroCIiLQdCioiIpIyCioiIpIyCioiIpIyCioiIpIyCioiIpIyCioiOcLMbjCzv4WP+5jZZjMrzHa9RJKhoCKSYma2zMxOa8093H2Fu+/h7nWpqpdIJiioiIhIyiioiKSJmV1mZq+a2e1mts7MlprZqKjX+5nZy2a2ycymAvtEvdbXzNzMisLnl5vZ/PDaJWb2nSw0SaRZCioi6XUssJAgYNwK3GdmFr72D2BW+NpNwJgm7rMGOAvoClwO3GlmR6Wr0iItpaAikl7L3f1/wtzIg0APYH8z6wMcDfzc3be7+yvA0/Fu4u6T3f1jD7wMvAB8MRMNEEmGgopIen0SeeDuW8OHewA9gXXuviXq2uXxbmJmo8zsTTOrMrP1wGiihstEcoWCikh2rAa6mVmXqLI+sS40s47AE8DtwP7uXgo8C1is60WySUFFJAvcfTkwE/ilmXUwsxOBs+Nc3gHoCKwFasNk/xmZqalIcoqyXQGRduzrBHmWKuAN4CGgtOFF7r7JzK4GHiMILk8DkzJYT5GEmQ7pEhGRVNHwl4iIpIyCioiIpIyCioiIpIyCioiIpEy7m/21zz77eN++fbNdDRGRvDFr1qzP3H3fRK5td0Glb9++zJw5M9vVEBHJG2YWd7eHhjT8JSIiKaOgIiIiKaOgIiIiKaOgIiIiKaOgIiIiKdPuZn+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kFjbZjceCZD1Znp0I5Qj0VEZEkRPImn2zcFvP1ZI8NbmsUVEREEuDuvDh/DTdPnseyz7fSsaiA7bX1ja5r6mz59kBBRUSkGQs+CdabvLb4cw7atwsPXH40G7bWNLkdS3uloCIiEsfn4XqTh99ewZ6dirn+7CF887gDKY5ab9Kaw7jaIgUVEZEGdtTW89Aby/jdtEVs3VHHt47vy/dPG0Bp5w67XZfM8cDthYKKiEjI3Zk2fw03PzufpZ9t4UsD9+XnZx3Cwfvtme2q5Q0FFRERYOEnm/jV5Hn8e9Fn9A/zJicP2i/b1co7Cioi0q5VbdnBHVMX8o+34udNJHEKKiLSLjXMm1x63IF8/7SBdOvSodn3SnwKKiLSrjTMm5w0cF9+/uVDGLB//LxJZI8vzfJqnoKKiLQbjfImlx3NiEH7YmZx39Nwj6/K9dWMf3IOgAJLDAoqItLmVW3ZwZ1TP+Lvby1nj45F/OKsIVx6fGJ5k9umLGy0x1d1TR23TVmooBKDgoqItFmRvMld0xaxpYV5k3h7ebX3Pb7iUVARkZzUmjyGu/PSgjXcPHk+S+LkTRK9f8/SEipjBJD2vsdXPAoqIpJzWpLHiD4wK7LZY7y8Sbz7z1xexfQFa3cLNNeOHKQ9vpKgidgiknOaymPE8tTsSsY98cHOHsX22nqKC4yrRhzMyYP3a5SIj3f/v7+5gsr11Ti7B7IJ5w+lrLQEA8pKS5hw/lDlU+JQT0VEck4yeYyaunqunzSXbQ22oa+pd+6Y+hEXDO+V8P29wfNIIHtt3CkKIglSUBGRnNNUHiN6mGvvLh0oLDA2VNfEvE+84BHv/sncQ2LT8JeI5JxrRw6ipLh
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"ename": "ValueError",
"evalue": "Expected 2D array, got scalar array instead:\narray=2020.\nReshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-24-da7cfa1c86d1>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreset\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mpredictions\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 29\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2020\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 30\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mArea\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0;34m'India'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m&\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mElement\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0;34m'Food'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Y1961'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/anaconda3/lib/python3.7/site-packages/sklearn/linear_model/base.py\u001b[0m in \u001b[0;36mpredict\u001b[0;34m(self, X)\u001b[0m\n\u001b[1;32m 211\u001b[0m \u001b[0mReturns\u001b[0m \u001b[0mpredicted\u001b[0m \u001b[0mvalues\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 212\u001b[0m \"\"\"\n\u001b[0;32m--> 213\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_decision_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 214\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 215\u001b[0m \u001b[0m_preprocess_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstaticmethod\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_preprocess_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/anaconda3/lib/python3.7/site-packages/sklearn/linear_model/base.py\u001b[0m in \u001b[0;36m_decision_function\u001b[0;34m(self, X)\u001b[0m\n\u001b[1;32m 194\u001b[0m \u001b[0mcheck_is_fitted\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"coef_\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 195\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 196\u001b[0;31m \u001b[0mX\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcheck_array\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maccept_sparse\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'csr'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'csc'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'coo'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 197\u001b[0m return safe_sparse_dot(X, self.coef_.T,\n\u001b[1;32m 198\u001b[0m dense_output=True) + self.intercept_\n",
"\u001b[0;32m/anaconda3/lib/python3.7/site-packages/sklearn/utils/validation.py\u001b[0m in \u001b[0;36mcheck_array\u001b[0;34m(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)\u001b[0m\n\u001b[1;32m 543\u001b[0m \u001b[0;34m\"Reshape your data either using array.reshape(-1, 1) if \"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 544\u001b[0m \u001b[0;34m\"your data has a single feature or array.reshape(1, -1) \"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 545\u001b[0;31m \"if it contains a single sample.\".format(array))\n\u001b[0m\u001b[1;32m 546\u001b[0m \u001b[0;31m# If input is 1D raise error\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 547\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0marray\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndim\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mValueError\u001b[0m: Expected 2D array, got scalar array instead:\narray=2020.\nReshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample."
]
}
],
"source": [
"india_list=[]\n",
"year_list = list(df.iloc[:,10:].columns)\n",
"for i in year_list:\n",
" x=df[(df.Area=='India') & (df.Element=='Food')][i].mean()\n",
" india_list.append(x) \n",
"\n",
"reset=[]\n",
"for i in year_list:\n",
" reset.append(int(i[1:]))\n",
"\n",
"\n",
"reset=np.array(reset)\n",
"reset=reset.reshape(-1,1)\n",
"\n",
"\n",
"india_list=np.array(india_list)\n",
"india_list=india_list.reshape(-1,1)\n",
"\n",
"\n",
"reg = LinearRegression()\n",
"reg.fit(reset,india_list)\n",
"predictions = reg.predict(reset)\n",
"plt.title(\"India\")\n",
"plt.xlabel(\"Year\")\n",
"plt.ylabel(\"Production\")\n",
"plt.scatter(reset,india_list)\n",
"plt.plot(reset,predictions)\n",
"plt.show()\n",
"print(reg.predict(2020))\n",
"\n",
"df[(df.Area=='India') & (df.Element=='Food')]['Y1961'].mean()\n",
"\n",
"df[(df.Area=='Pakistan') & (df.Element=='Food')]\n",
"\n",
"Pak_list=[]\n",
"year_list = list(df.iloc[:,10:].columns)\n",
"for i in year_list:\n",
" yx=df[(df.Area=='Pakistan') & (df.Element=='Food')][i].mean()\n",
" Pak_list.append(yx) \n",
"\n",
"Pak_list=np.array(Pak_list)\n",
"Pak_list=Pak_list.reshape(-1,1)\n",
"Pak_list\n",
"reg = LinearRegression()\n",
"reg.fit(reset,Pak_list)\n",
"predictions = reg.predict(reset)\n",
"plt.title(\"Pakistan\")\n",
"plt.xlabel(\"Year\")\n",
"plt.ylabel(\"Production\")\n",
"plt.scatter(reset,Pak_list)\n",
"plt.plot(reset,predictions)\n",
"plt.show()\n",
"print(reg.predict(2020))\n",
"\n",
"\n",
"\n",
"usa_list=[]\n",
"year_list = list(df.iloc[:,10:].columns)\n",
"for i in year_list:\n",
" xu=df[(df.Area=='United States of America') & (df.Element=='Food')][i].mean()\n",
" usa_list.append(xu)\n",
"\n",
"usa_list=np.array(usa_list)\n",
"usa_list=india_list.reshape(-1,1)\n",
"\n",
"\n",
"reg = LinearRegression()\n",
"reg.fit(reset,usa_list)\n",
"predictions = reg.predict(reset)\n",
"plt.title(\"USA\")\n",
"plt.xlabel(\"Year\")\n",
"plt.ylabel(\"Production\")\n",
"plt.scatter(reset,usa_list)\n",
"plt.plot(reset,predictions)\n",
"plt.show()\n",
"print(reg.predict(2020))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
}
},
"nbformat": 4,
"nbformat_minor": 1
}