{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Plotting Exercises, Part 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Wealth and Democracy\n", "\n", "Let's now pivot from working with example data to real data. Load the World Development Indicator data you worked with over the summer. This is country-level data that includes information on both countries' GDP per capita (a measure of wealth) and the Polity IV scores (a measure of how democratic a country is -- countries with higher scores are liberal democracies, countries with low scores are autocratic.). Use the code below to download the data. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "\n", "pd.set_option(\"mode.copy_on_write\", True)\n", "\n", "wdi = pd.read_csv(\n", " \"https://raw.githubusercontent.com/nickeubank/\"\n", " \"practicaldatascience/master/Example_Data/world-small.csv\"\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Your data should look like this: " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | country | \n", "region | \n", "gdppcap08 | \n", "polityIV | \n", "
---|---|---|---|---|
0 | \n", "Albania | \n", "C&E Europe | \n", "7715 | \n", "17.8 | \n", "
1 | \n", "Algeria | \n", "Africa | \n", "8033 | \n", "10.0 | \n", "
2 | \n", "Angola | \n", "Africa | \n", "5899 | \n", "8.0 | \n", "
3 | \n", "Argentina | \n", "S. America | \n", "14333 | \n", "18.0 | \n", "
4 | \n", "Armenia | \n", "C&E Europe | \n", "6070 | \n", "15.0 | \n", "