{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('table',\n", " 'facts',\n", " 'facts',\n", " 2,\n", " 'CREATE TABLE \"facts\" (\"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, \"code\" varchar(255) NOT NULL, \"name\" varchar(255) NOT NULL, \"area\" integer, \"area_land\" integer, \"area_water\" integer, \"population\" integer, \"population_growth\" float, \"birth_rate\" float, \"death_rate\" float, \"migration_rate\" float, \"created_at\" datetime, \"updated_at\" datetime)'),\n", " ('table',\n", " 'sqlite_sequence',\n", " 'sqlite_sequence',\n", " 3,\n", " 'CREATE TABLE sqlite_sequence(name,seq)')]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import sqlite3\n", "import pandas as pd\n", "\n", "conn = sqlite3.connect(\"factbook.db\")\n", "cursor = conn.cursor()\n", "cursor.execute(q1).fetchall()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
typenametbl_namerootpagesql
0tablefactsfacts2CREATE TABLE \"facts\" (\"id\" INTEGER PRIMARY KEY...
1tablesqlite_sequencesqlite_sequence3CREATE TABLE sqlite_sequence(name,seq)
\n", "
" ], "text/plain": [ " type name tbl_name rootpage \\\n", "0 table facts facts 2 \n", "1 table sqlite_sequence sqlite_sequence 3 \n", "\n", " sql \n", "0 CREATE TABLE \"facts\" (\"id\" INTEGER PRIMARY KEY... \n", "1 CREATE TABLE sqlite_sequence(name,seq) " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q1 = \"SELECT * FROM sqlite_master WHERE type='table';\"\n", "pd.read_sql_query(q1, conn)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idcodenameareaarea_landarea_waterpopulationpopulation_growthbirth_ratedeath_ratemigration_ratecreated_atupdated_at
01afAfghanistan6522306522300325643422.3238.5713.891.512015-11-01 13:19:49.4617342015-11-01 13:19:49.461734
12alAlbania2874827398135030292780.3012.926.583.302015-11-01 13:19:54.4310822015-11-01 13:19:54.431082
23agAlgeria238174123817410395421661.8423.674.310.922015-11-01 13:19:59.9612862015-11-01 13:19:59.961286
34anAndorra4684680855800.128.136.960.002015-11-01 13:20:03.6599452015-11-01 13:20:03.659945
45aoAngola124670012467000196253532.7838.7811.490.462015-11-01 13:20:08.6250722015-11-01 13:20:08.625072
\n", "
" ], "text/plain": [ " id code name area area_land area_water population \\\n", "0 1 af Afghanistan 652230 652230 0 32564342 \n", "1 2 al Albania 28748 27398 1350 3029278 \n", "2 3 ag Algeria 2381741 2381741 0 39542166 \n", "3 4 an Andorra 468 468 0 85580 \n", "4 5 ao Angola 1246700 1246700 0 19625353 \n", "\n", " population_growth birth_rate death_rate migration_rate \\\n", "0 2.32 38.57 13.89 1.51 \n", "1 0.30 12.92 6.58 3.30 \n", "2 1.84 23.67 4.31 0.92 \n", "3 0.12 8.13 6.96 0.00 \n", "4 2.78 38.78 11.49 0.46 \n", "\n", " created_at updated_at \n", "0 2015-11-01 13:19:49.461734 2015-11-01 13:19:49.461734 \n", "1 2015-11-01 13:19:54.431082 2015-11-01 13:19:54.431082 \n", "2 2015-11-01 13:19:59.961286 2015-11-01 13:19:59.961286 \n", "3 2015-11-01 13:20:03.659945 2015-11-01 13:20:03.659945 \n", "4 2015-11-01 13:20:08.625072 2015-11-01 13:20:08.625072 " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q2 = \"select * from facts limit 5\"\n", "pd.read_sql_query(q2, conn)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Summary Statistics" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
min_popmax_popmin_pop_grwthmax_pop_grwth
0072564900110.04.02
\n", "
" ], "text/plain": [ " min_pop max_pop min_pop_grwth max_pop_grwth\n", "0 0 7256490011 0.0 4.02" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q3 = '''\n", "select min(population) min_pop, max(population) max_pop, \n", "min(population_growth) min_pop_grwth, max(population_growth) max_pop_grwth \n", "from facts\n", "'''\n", "pd.read_sql_query(q3, conn)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Outliers" ] }, { "cell_type": "code", "execution_count": 35, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idcodenameareaarea_landarea_waterpopulationpopulation_growthbirth_ratedeath_ratemigration_ratecreated_atupdated_at
0261xxWorldNoneNoneNone72564900111.0818.67.8None2015-11-01 13:39:09.9107212015-11-01 13:39:09.910721
\n", "
" ], "text/plain": [ " id code name area area_land area_water population population_growth \\\n", "0 261 xx World None None None 7256490011 1.08 \n", "\n", " birth_rate death_rate migration_rate created_at \\\n", "0 18.6 7.8 None 2015-11-01 13:39:09.910721 \n", "\n", " updated_at \n", "0 2015-11-01 13:39:09.910721 " ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q4 = '''\n", "select *\n", "from facts\n", "where population == (select max(population) from facts);\n", "'''\n", "\n", "pd.read_sql_query(q4, conn)" ] }, { "cell_type": "code", "execution_count": 36, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idcodenameareaarea_landarea_waterpopulationpopulation_growthbirth_ratedeath_ratemigration_ratecreated_atupdated_at
0250ayAntarcticaNone280000None0NoneNoneNoneNone2015-11-01 13:38:44.8857462015-11-01 13:38:44.885746
\n", "
" ], "text/plain": [ " id code name area area_land area_water population \\\n", "0 250 ay Antarctica None 280000 None 0 \n", "\n", " population_growth birth_rate death_rate migration_rate \\\n", "0 None None None None \n", "\n", " created_at updated_at \n", "0 2015-11-01 13:38:44.885746 2015-11-01 13:38:44.885746 " ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q5 = '''\n", "select *\n", "from facts\n", "where population == (select min(population) from facts);\n", "'''\n", "\n", "pd.read_sql_query(q5, conn)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Histograms" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "scrolled": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/srinify/anaconda/envs/dq/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2847: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared\n", " exec(code_obj, self.user_global_ns, self.user_ns)\n" ] }, { "data": { "text/plain": [ "array([[,\n", " ],\n", " [,\n", " ]], dtype=object)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAlQAAAJYCAYAAACkWnhSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X+cXXV95/HXkEmI0TGN7aDr1up21U9dq+BGhcrGTGmw\nRqVx6Q9bKgpx/VGx4patIoZ210ILFmmLVNFAjPoou65IrNBSYuWHQa1Wha1Z44dC62O7a20jJhIM\noCGzf5yTMhlm5k7u9957zsx9PR8PHpx7zrnn+zk3Z77zvt9z5pyRyclJJEmS1L2jmi5AkiRpoTNQ\nSZIkFTJQSZIkFTJQSZIkFTJQSZIkFTJQSZIkFTJQDbmImIiInTPMf2dEvGqW9/xWRGyop7dGxH/p\nY30vjYh39mv7koZDRPxCRNxS8P7tEfEj9fQ3IuK5PSvukW39Sx+rhWO06QLUTpn5W3MsPgn42oBK\neR7wuAG1JUmzOXmAbQ2yj1WPjHhjz+EWERPAVuBLwFOBvcDrgPOAnZl5SUQ8CPwpcCxwNfCbwG7g\nN4ANwGOBJwCPB3YCp2Xm9+Zo8wzgNcCjge8CLwPeBzydKjztA04Dfqhudwnwgcx8R0S8Bngj1ejq\nPcCbMvPrPfkwJC0q9ej2r1L1FX8L/GvgRcDFwFqqvuV24M2ZeW9EvIyq71sGHAN8KDPPj4gPAmdQ\n9W8vAXYAnwKeU6/3kcx8R4datlL1b/8WuB64Cvhj4DHAE4E7gFdQ9Y0X83Af+2ez1Vv04ajnPOUn\ngCcBl2bmcVSB6SPTli8DrsvMyMz/Rh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ip5QutG2Baq5HuewC3haRDwuIpZRnWb5/IBrgOo0x3Lg5VNO\nuwyk/cy8LDNX1xd0XgRcnZlbB9U+8HfAYyLiqfXrNVSjRL02Vw3fpTrnfX9mPgT8M9Dza6jmMKjj\ncC79PgZnNaBjcFj5OJsFqL6Gcjvwtszc0nQ9vRQRp0fE2+uX+4GD9X8LWma+MDPX1v3YHcCrMvNb\npdtt23DyIx7nEBGnAY/JzA9ExG8AN1IFwS2Z+f8GWQPwJeA1wA7gpogA+KPM3DaI9jPzAz1sp6v2\nI+I1wNX1Beqfy8w/a6CG9wO3RcT3qa7L2NqHGg7TwHE4Y/sM5hictf0BHYPDysfZLEznUX2pOz8i\nDl1LtT4ze3axc4OuBT4YEZ8BlgJvWST71Rc+ekaSJKlQ2075SZIkLTgGKkmSpEIGKkmSpEIGKkmS\npEJt+ys/SQ2Zz3PWIuKPqB75cx/Vn4l/YUDlSVKrGagkHXrO2unA9+ZY52VUD0l9PvA4+ndjV0la\ncAxUkuDh56x9BCAingVcRnU/pHuo7iz874AbM/Mg8O2IeCgintCLG+JJ0kLnNVSSZnrO2mbgrPr0\n358Db6W6o/CLI2JpRPw48ExgMTyGQpKKOUIlaSbPAN5b34l9KfC3mbk9Ip4H3EL1yKEvU41eSdLQ\nc4RK0kyS6vlWE1SjU9dHxNOBf8jME4HfAQ5m5kAfDC1JbeUIlaSZ/BrVE9hHgUmq5wf+H+D3IuKN\nwAPAWQ3WJ0mt4rP8JEmSCnnKT5IkqZCBSpIkqZCBSpIkqZCBSpIkqZCBSpIkqZCBSpIkqZCBSpIk\nqZCBSpIkqdD/B+1oMbOjxhXkAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "%matplotlib inline\n", "\n", "fig = plt.figure(figsize=(10,10))\n", "ax = fig.add_subplot(111)\n", "\n", "q6 = '''\n", "select population, population_growth, birth_rate, death_rate\n", "from facts\n", "where population != (select max(population) from facts)\n", "and population != (select min(population) from facts);\n", "'''\n", "pd.read_sql_query(q6, conn).hist(ax=ax)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Which countries have the highest population density?" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
namedensity
0Macau21168.964286
1Monaco15267.500000
2Singapore8141.279770
3Hong Kong6445.041516
4Gaza Strip5191.819444
5Gibraltar4876.333333
6Bahrain1771.859211
7Maldives1319.640940
8Malta1310.015823
9Bermuda1299.925926
10Sint Maarten1167.323529
11Bangladesh1138.069143
12Guernsey847.179487
13Jersey838.741379
14Barbados675.823256
15Mauritius656.777941
16Taiwan650.781712
17Aruba623.122222
18Lebanon594.682788
19Saint Martin588.037037
\n", "
" ], "text/plain": [ " name density\n", "0 Macau 21168.964286\n", "1 Monaco 15267.500000\n", "2 Singapore 8141.279770\n", "3 Hong Kong 6445.041516\n", "4 Gaza Strip 5191.819444\n", "5 Gibraltar 4876.333333\n", "6 Bahrain 1771.859211\n", "7 Maldives 1319.640940\n", "8 Malta 1310.015823\n", "9 Bermuda 1299.925926\n", "10 Sint Maarten 1167.323529\n", "11 Bangladesh 1138.069143\n", "12 Guernsey 847.179487\n", "13 Jersey 838.741379\n", "14 Barbados 675.823256\n", "15 Mauritius 656.777941\n", "16 Taiwan 650.781712\n", "17 Aruba 623.122222\n", "18 Lebanon 594.682788\n", "19 Saint Martin 588.037037" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q7 = \"select name, cast(population as float)/cast(area as float) density from facts order by density desc limit 20\"\n", "pd.read_sql_query(q7, conn)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
populationpopulation_growthbirth_ratedeath_rate
0325643422.3238.5713.89
130292780.3012.926.58
2395421661.8423.674.31
3855800.128.136.96
4196253532.7838.7811.49
5924361.2415.855.69
6434318860.9316.647.33
730563820.1513.619.34
8227510141.0712.157.14
986655500.559.419.42
1097807800.9616.647.07
113245970.8515.507.05
1213466132.4113.662.69
131689577451.6021.145.61
142906040.3111.878.44
1595896890.2010.7013.36
16113239730.7611.419.63
173473691.8724.685.97
18104486472.7836.028.21
197419191.1117.786.69
20108008821.5622.766.52
2138670550.138.879.75
2221827191.2120.9613.39
232042598120.7714.466.58
244296461.6217.323.52
2571868930.588.9214.44
26189316863.0342.0311.72
27563202061.0118.397.96
28107422763.2842.019.27
29157087561.5823.837.68
...............
2101121621.3312.568.18
2111484060.4313.808.20
212396891.5113.004.51
21398382.9514.338.03
21411900.03NaNNaN
21513370.01NaNNaN
21618720.03NaNNaN
21715700NaNNaNNaN
218164182.0312.674.57
219701960.5011.338.23
220334542.3210.914.99
221560922.1012.115.53
22215700NaNNaNNaN
22333610.0110.904.90
224292580.2414.088.37
225660800.349.848.78
226972940.8011.917.68
227875450.7611.1010.06
22852410.5011.266.30
229480.00NaNNaN
23077950.249.887.44
231502802.3016.133.10
232543430.3022.894.75
2331617850.5416.825.12
234523442.1818.323.71
23535983570.6010.868.67
2361035740.5910.318.54
23718690552.8131.113.04
23827853661.9522.993.50
2395708662.8230.248.34
\n", "

240 rows × 4 columns

\n", "
" ], "text/plain": [ " population population_growth birth_rate death_rate\n", "0 32564342 2.32 38.57 13.89\n", "1 3029278 0.30 12.92 6.58\n", "2 39542166 1.84 23.67 4.31\n", "3 85580 0.12 8.13 6.96\n", "4 19625353 2.78 38.78 11.49\n", "5 92436 1.24 15.85 5.69\n", "6 43431886 0.93 16.64 7.33\n", "7 3056382 0.15 13.61 9.34\n", "8 22751014 1.07 12.15 7.14\n", "9 8665550 0.55 9.41 9.42\n", "10 9780780 0.96 16.64 7.07\n", "11 324597 0.85 15.50 7.05\n", "12 1346613 2.41 13.66 2.69\n", "13 168957745 1.60 21.14 5.61\n", "14 290604 0.31 11.87 8.44\n", "15 9589689 0.20 10.70 13.36\n", "16 11323973 0.76 11.41 9.63\n", "17 347369 1.87 24.68 5.97\n", "18 10448647 2.78 36.02 8.21\n", "19 741919 1.11 17.78 6.69\n", "20 10800882 1.56 22.76 6.52\n", "21 3867055 0.13 8.87 9.75\n", "22 2182719 1.21 20.96 13.39\n", "23 204259812 0.77 14.46 6.58\n", "24 429646 1.62 17.32 3.52\n", "25 7186893 0.58 8.92 14.44\n", "26 18931686 3.03 42.03 11.72\n", "27 56320206 1.01 18.39 7.96\n", "28 10742276 3.28 42.01 9.27\n", "29 15708756 1.58 23.83 7.68\n", ".. ... ... ... ...\n", "210 112162 1.33 12.56 8.18\n", "211 148406 0.43 13.80 8.20\n", "212 39689 1.51 13.00 4.51\n", "213 9838 2.95 14.33 8.03\n", "214 1190 0.03 NaN NaN\n", "215 1337 0.01 NaN NaN\n", "216 1872 0.03 NaN NaN\n", "217 15700 NaN NaN NaN\n", "218 16418 2.03 12.67 4.57\n", "219 70196 0.50 11.33 8.23\n", "220 33454 2.32 10.91 4.99\n", "221 56092 2.10 12.11 5.53\n", "222 15700 NaN NaN NaN\n", "223 3361 0.01 10.90 4.90\n", "224 29258 0.24 14.08 8.37\n", "225 66080 0.34 9.84 8.78\n", "226 97294 0.80 11.91 7.68\n", "227 87545 0.76 11.10 10.06\n", "228 5241 0.50 11.26 6.30\n", "229 48 0.00 NaN NaN\n", "230 7795 0.24 9.88 7.44\n", "231 50280 2.30 16.13 3.10\n", "232 54343 0.30 22.89 4.75\n", "233 161785 0.54 16.82 5.12\n", "234 52344 2.18 18.32 3.71\n", "235 3598357 0.60 10.86 8.67\n", "236 103574 0.59 10.31 8.54\n", "237 1869055 2.81 31.11 3.04\n", "238 2785366 1.95 22.99 3.50\n", "239 570866 2.82 30.24 8.34\n", "\n", "[240 rows x 4 columns]" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q7 = '''select population, population_growth, birth_rate, death_rate\n", "from facts\n", "where population != (select max(population) from facts)\n", "and population != (select min(population) from facts);\n", "'''\n", "pd.read_sql_query(q7, conn)" ] } ], "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.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }