{ "cells": [ { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "# Le pouvoir d'achat des ouvriers anglais du XVIe au XIXe siècle / Purchasing power of English workers from the 16th to the 19th century\n", "\n", "Le but de ce travail est de reproduire le [graphique](https://fr.wikipedia.org/wiki/William_Playfair#/media/File:Chart_Showing_at_One_View_the_Price_of_the_Quarter_of_Wheat,_and_Wages_of_Labour_by_the_Week,_from_1565_to_1821.png) de William Playfair qui montre l'évolution du prix du blé et du salaire moyen entre 1565 et 1821. Ce graphique est publié dans son [livre](https://books.google.fr/books?id=aQZGAQAAMAAJ&printsec=frontcover&hl=fr&source=gbs_ge_summary_r&cad=0#v=onepage&q&f=false) : \"A Letter on Our Agricultural Distresses, Their Causes and Remedies\".\n", "\n", "Les données numériques brutes que William Playfair a utilisées ne sont malheureusement pas disponibles. Des valeurs obtenues par numérisation du graphe sont toutefois disponibles [ici](https://vincentarelbundock.github.io/Rdatasets/doc/HistData/Wheat.html). Pour la suite de cette analyse, la [version en format CSV](https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Wheat.csv) sera utilisée.\n", "\n", "---\n", "\n", "The purpose of this work is to reproduce the [graphic](https://fr.wikipedia.org/wiki/William_Playfair#/media/File:Chart_Showing_at_One_View_the_Price_of_the_Quarter_of_Wheat,_and_Wages_of_Labour_by_the_Week.png_of_Labour_by_the_Week.png_from_18_by_the_Week.png_from_18) which shows the evolution of the wheat prize and average salaries from 1565 to 1821. This graph is published in his [book](https://books.google.fr/books?id=aQZGAQAAMAAJ&printsec=frontcover&hl=fr&source=gbs_ge_summary_r&cad=0#v=onepage&q&f=false ): \"A Letter on Our Agricultural Distresses, Their Causes and Remedies\".\n", " \n", "The raw data that William Playfair used is unfortunately not published. However, values obtained by digitizing the graph are available [here](https://vincentarelbundock.github.io/Rdatasets/doc/HistData/Wheat.html). For the remainder of this analysis, the [CSV format version](https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Wheat.csv) will be used. \n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "hideCode": true, "hidePrompt": true }, "outputs": [], "source": [ "# ensemble des bibliothèques à importer / set of libraries to import \n", "%matplotlib inline\n", "import os\n", "import urllib.request\n", "import datetime \n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from matplotlib.ticker import MultipleLocator\n", "from matplotlib.dates import YearLocator\n", "import matplotlib.cm as cm\n", "import pandas as pd" ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "## Téléchargement des données / Download data\n", "\n", "Afin de garder une trace des données qui ont été traitées, une copie locale du fichier a été réalisée. Le but de la manoeuvre était de permettre d'accéder aux données ultérieurement même si le lien initial de téléchargement des données est modifié ou supprimé. Cela permet également d'étudier le même set de donnée même si, par exemple, une nouvelle numérisation du graphique était réalisée.\n", "\n", "Dans un premier temps, la présence de cette copie locale du fichier est vérifiée. Si aucun fichier n'est présent, une copie des données téléchargeable à l'adresse URL renseignée ci-dessous (`data_url`) est réalisée dans un fichier local (`fileName`) qui servira dans la suite des analyses. Ce fichier local est normalement transmis avec ce document computationnel (*data_william.csv*).\n", "\n", "---\n", "\n", "In order to keep track of the data that has been processed, a local copy of the file has been made. The purpose of the maneuver was to allow access to the data later even if the initial data download link is modified or deleted. This also makes it possible to study the same data set even if, for example, a new digitization of the graph was carried out.\n", "\n", "First, the presence of this local copy of the file is checked. If no file is present, a copy of the downloadable data at the URL address given below (`data_url`) is made in a local file (` fileName`) which will be used in the rest of the analyses. This local file is normally transmitted with this computational document (*data_william.csv*). \n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "hideCode": true, "hidePrompt": true }, "outputs": [], "source": [ "data_url='https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Wheat.csv'" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "hideCode": true, "hidePrompt": true }, "outputs": [], "source": [ "fileName = 'data_william.csv'\n", "if not os.path.exists(fileName):\n", " print('FR: Aucun fichier local avec les données étudiées n\\'est disponible. Un nouveau fichier est fabriqué à partir du lien donné')\n", " print('EN: No local file with the studied data is available. A new file is made from the given link')\n", " urllib.request.urlretrieve(data_url, fileName) " ] }, { "cell_type": "markdown", "metadata": { "hideCode": true, "hidePrompt": true }, "source": [ "Le fichier local peut à présent être ouvert. Celui-ci sera utilisé tout au long de cette étude.\n", "\n", "La première colonne du fichier csv téléchargé correspond à l'ID. Cette colonne est dès lors passée comme index lors de son exportation (`pd.read_csv()`) grâce à l'ajout du paramètre suivant : `index_col=0`.\n", "\n", "---\n", "\n", "The local file can now be opened. This will be used throughout this study.\n", "\n", "The first column of the downloaded csv file is the ID. This column is therefore passed as an index during its export (`pd.read_csv ()`) thanks to the addition of the following parameter: `index_col = 0`." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "hideCode": true, "hidePrompt": true }, "outputs": [ { "data": { "text/html": [ "
\n", " | Year | \n", "Wheat | \n", "Wages | \n", "
---|---|---|---|
1 | \n", "1565 | \n", "41.0 | \n", "5.00 | \n", "
2 | \n", "1570 | \n", "45.0 | \n", "5.05 | \n", "
3 | \n", "1575 | \n", "42.0 | \n", "5.08 | \n", "
4 | \n", "1580 | \n", "49.0 | \n", "5.12 | \n", "
5 | \n", "1585 | \n", "41.5 | \n", "5.15 | \n", "
6 | \n", "1590 | \n", "47.0 | \n", "5.25 | \n", "
7 | \n", "1595 | \n", "64.0 | \n", "5.54 | \n", "
8 | \n", "1600 | \n", "27.0 | \n", "5.61 | \n", "
9 | \n", "1605 | \n", "33.0 | \n", "5.69 | \n", "
10 | \n", "1610 | \n", "32.0 | \n", "5.78 | \n", "
11 | \n", "1615 | \n", "33.0 | \n", "5.94 | \n", "
12 | \n", "1620 | \n", "35.0 | \n", "6.01 | \n", "
13 | \n", "1625 | \n", "33.0 | \n", "6.12 | \n", "
14 | \n", "1630 | \n", "45.0 | \n", "6.22 | \n", "
15 | \n", "1635 | \n", "33.0 | \n", "6.30 | \n", "
16 | \n", "1640 | \n", "39.0 | \n", "6.37 | \n", "
17 | \n", "1645 | \n", "53.0 | \n", "6.45 | \n", "
18 | \n", "1650 | \n", "42.0 | \n", "6.50 | \n", "
19 | \n", "1655 | \n", "40.5 | \n", "6.60 | \n", "
20 | \n", "1660 | \n", "46.5 | \n", "6.75 | \n", "
21 | \n", "1665 | \n", "32.0 | \n", "6.80 | \n", "
22 | \n", "1670 | \n", "37.0 | \n", "6.90 | \n", "
23 | \n", "1675 | \n", "43.0 | \n", "7.00 | \n", "
24 | \n", "1680 | \n", "35.0 | \n", "7.30 | \n", "
25 | \n", "1685 | \n", "27.0 | \n", "7.60 | \n", "
26 | \n", "1690 | \n", "40.0 | \n", "8.00 | \n", "
27 | \n", "1695 | \n", "50.0 | \n", "8.50 | \n", "
28 | \n", "1700 | \n", "30.0 | \n", "9.00 | \n", "
29 | \n", "1705 | \n", "32.0 | \n", "10.00 | \n", "
30 | \n", "1710 | \n", "44.0 | \n", "11.00 | \n", "
31 | \n", "1715 | \n", "33.0 | \n", "11.75 | \n", "
32 | \n", "1720 | \n", "29.0 | \n", "12.50 | \n", "
33 | \n", "1725 | \n", "39.0 | \n", "13.00 | \n", "
34 | \n", "1730 | \n", "26.0 | \n", "13.30 | \n", "
35 | \n", "1735 | \n", "32.0 | \n", "13.60 | \n", "
36 | \n", "1740 | \n", "27.0 | \n", "14.00 | \n", "
37 | \n", "1745 | \n", "27.5 | \n", "14.50 | \n", "
38 | \n", "1750 | \n", "31.0 | \n", "15.00 | \n", "
39 | \n", "1755 | \n", "35.5 | \n", "15.70 | \n", "
40 | \n", "1760 | \n", "31.0 | \n", "16.50 | \n", "
41 | \n", "1765 | \n", "43.0 | \n", "17.60 | \n", "
42 | \n", "1770 | \n", "47.0 | \n", "18.50 | \n", "
43 | \n", "1775 | \n", "44.0 | \n", "19.50 | \n", "
44 | \n", "1780 | \n", "46.0 | \n", "21.00 | \n", "
45 | \n", "1785 | \n", "42.0 | \n", "23.00 | \n", "
46 | \n", "1790 | \n", "47.5 | \n", "25.50 | \n", "
47 | \n", "1795 | \n", "76.0 | \n", "27.50 | \n", "
48 | \n", "1800 | \n", "79.0 | \n", "28.50 | \n", "
49 | \n", "1805 | \n", "81.0 | \n", "29.50 | \n", "
50 | \n", "1810 | \n", "99.0 | \n", "30.00 | \n", "
51 | \n", "1815 | \n", "78.0 | \n", "NaN | \n", "
52 | \n", "1820 | \n", "54.0 | \n", "NaN | \n", "
53 | \n", "1821 | \n", "54.0 | \n", "NaN | \n", "