mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-27 04:44:08 +03:00
Merge pull request #3300 from timothyubbens/update-hre
[en-us/pythonstatcomp] HRE data available in repo
This commit is contained in:
commit
5ebc12c8d9
1
hre.csv
Normal file
1
hre.csv
Normal file
@ -0,0 +1 @@
|
||||
Ix,Dynasty,Name,Birth,Death,Coronation 1,Coronation 2,Ceased to be Emperor
N/A,Carolingian,Charles I,2 April 742,28 January 814,25 December 800,N/A,28 January 814
N/A,Carolingian,Louis I,778,20 June 840,11 September 813,5 October 816,20 June 840
N/A,Carolingian,Lothair I,795,29 September 855,5 April 823,N/A,29 September 855
N/A,Carolingian,Louis II,825,12 August 875,15 June 844,18 May 872,12 August 875
N/A,Carolingian,Charles II,13 June 823,6 October 877,29 December 875,N/A,6 October 877
N/A,Carolingian,Charles III,13 June 839,13 January 888,12 February 881,N/A,11 November 887
N/A,Widonid,Guy III,835,12 December 894,21 February 891,N/A,12 December 894
N/A,Widonid,Lambert I,880,15 October 898,30 April 892,N/A,15 October 898
N/A,Carolingian,Arnulph,850,8 December 899,22 February 896,N/A,8 December 899
N/A,Bosonid,Louis III,880,5 June 928,22 February 901,N/A,21 July 905
N/A,Unruoching,Berengar I,845,7 April 924,December 915,N/A,7 April 924
1,Ottonian,Otto I,23 November 912,7 May 973,2 February 962,N/A,7 May 973
2,Ottonian,Otto II,955,7 December 983,25 December 967,N/A,7 December 983
3,Ottonian,Otto III,980,23 January 1002,21 May 996,N/A,23 January 1002
4,Ottonian,Henry II,6 May 973,13 July 1024,14 February 1014,N/A,13 July 1024
5,Salian,Conrad II,990,4 June 1039,26 March 1027,N/A,4 June 1039
6,Salian,Henry III,29 October 1017,5 October 1056,25 December 1046,N/A,5 October 1056
7,Salian,Henry IV,11 November 1050,7 August 1106,31 March 1084,N/A,December 1105
8,Salian,Henry V,8 November 1086,23 May 1125,13 April 1111,N/A,23 May 1125
9,Supplinburg,Lothair III,9 June 1075,4 December 1137,4 June 1133,N/A,4 December 1137
10,Staufen,Frederick I,1122,10 June 1190,18 June 1155,N/A,10 June 1190
11,Staufen,Henry VI,November 1165,28 September 1197,14 April 1191,N/A,28 September 1197
12,Welf,Otto IV,1175,19 May 1218,4 October 1209,N/A,1215
13,Staufen,Frederick II,26 December 1194,13 December 1250,22 November 1220,N/A,13 December 1250
14,Luxembourg,Henry VII,1275,24 August 1313,29 June 1312,N/A,24 August 1313
15,Wittelsbach,Louis IV,1 April 1282,11 October 1347,17 January 1328,N/A,11 October 1347
16,Luxembourg,Charles IV,14 May 1316,29 November 1378,5 April 1355,N/A,29 November 1378
17,Luxembourg,Sigismund,14 February 1368,9 December 1437,31 May 1433,N/A,9 December 1437
18,Habsburg,Frederick III,21 September 1415,19 August 1493,19 March 1452,N/A,19 August 1493
19,Habsburg,Maximilian I,22 March 1459,12 January 1519,N/A,N/A,12 January 1519
20,Habsburg,Charles V,24 February 1500,21 September 1558,February 1530,N/A,16 January 1556
21,Habsburg,Ferdinand I,10 March 1503,25 July 1564,N/A,N/A,25 July 1564
22,Habsburg,Maximilian II,31 July 1527,12 October 1576,N/A,N/A,12 October 1576
23,Habsburg,Rudolph II,18 July 1552,20 January 1612,30 June 1575,N/A,20 January 1612
24,Habsburg,Matthias,24 February 1557,20 March 1619,23 January 1612,N/A,20 March 1619
25,Habsburg,Ferdinand II,9 July 1578,15 February 1637,10 March 1619,N/A,15 February 1637
26,Habsburg,Ferdinand III,13 July 1608,2 April 1657,18 November 1637,N/A,2 April 1657
27,Habsburg,Leopold I,9 June 1640,5 May 1705,6 March 1657,N/A,5 May 1705
28,Habsburg,Joseph I,26 July 1678,17 April 1711,1 May 1705,N/A,17 April 1711
29,Habsburg,Charles VI,1 October 1685,20 October 1740,22 December 1711,N/A,20 October 1740
30,Wittelsbach,Charles VII,6 August 1697,20 January 1745,12 February 1742,N/A,20 January 1745
31,Lorraine,Francis I,8 December 1708,18 August 1765,N/A,N/A,18 August 1765
32,Habsburg-Lorraine,Joseph II,13 March 1741,20 February 1790,19 August 1765,N/A,20 February 1790
33,Habsburg-Lorraine,Leopold II,5 May 1747,1 March 1792,N/A,N/A,1 March 1792
34,Habsburg-Lorraine,Francis II,12 February 1768,2 March 1835,4 March 1792,N/A,6 August 1806
|
|
@ -146,7 +146,7 @@ ggplot(aes(x="age",y="weight"), data=pets) + geom_point() + labs(title="pets")
|
||||
"""
|
||||
|
||||
# load some data on Holy Roman Emperors
|
||||
url = "https://raw.githubusercontent.com/e99n09/R-notes/master/data/hre.csv"
|
||||
url = "https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/master/hre.csv"
|
||||
r = requests.get(url)
|
||||
fp = "hre.csv"
|
||||
with open(fp, "wb") as f:
|
||||
@ -156,26 +156,19 @@ hre = pd.read_csv(fp)
|
||||
|
||||
hre.head()
|
||||
"""
|
||||
Ix Dynasty Name Birth Death Election 1
|
||||
0 NaN Carolingian Charles I 2 April 742 28 January 814 NaN
|
||||
1 NaN Carolingian Louis I 778 20 June 840 NaN
|
||||
2 NaN Carolingian Lothair I 795 29 September 855 NaN
|
||||
3 NaN Carolingian Louis II 825 12 August 875 NaN
|
||||
4 NaN Carolingian Charles II 13 June 823 6 October 877 NaN
|
||||
Ix Dynasty Name Birth Death
|
||||
0 NaN Carolingian Charles I 2 April 742 28 January 814
|
||||
1 NaN Carolingian Louis I 778 20 June 840
|
||||
2 NaN Carolingian Lothair I 795 29 September 855
|
||||
3 NaN Carolingian Louis II 825 12 August 875
|
||||
4 NaN Carolingian Charles II 13 June 823 6 October 877
|
||||
|
||||
Election 2 Coronation 1 Coronation 2 Ceased to be Emperor
|
||||
0 NaN 25 December 800 NaN 28 January 814
|
||||
1 NaN 11 September 813 5 October 816 20 June 840
|
||||
2 NaN 5 April 823 NaN 29 September 855
|
||||
3 NaN Easter 850 18 May 872 12 August 875
|
||||
4 NaN 29 December 875 NaN 6 October 877
|
||||
|
||||
Descent from whom 1 Descent how 1 Descent from whom 2 Descent how 2
|
||||
0 NaN NaN NaN NaN
|
||||
1 Charles I son NaN NaN
|
||||
2 Louis I son NaN NaN
|
||||
3 Lothair I son NaN NaN
|
||||
4 Louis I son NaN NaN
|
||||
Coronation 1 Coronation 2 Ceased to be Emperor
|
||||
0 25 December 800 NaN 28 January 814
|
||||
1 11 September 813 5 October 816 20 June 840
|
||||
2 5 April 823 NaN 29 September 855
|
||||
3 Easter 850 18 May 872 12 August 875
|
||||
4 29 December 875 NaN 6 October 877
|
||||
"""
|
||||
|
||||
# clean the Birth and Death columns
|
||||
@ -193,6 +186,8 @@ rx = re.compile(r'\d+$') # match trailing digits
|
||||
- http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.html
|
||||
"""
|
||||
|
||||
from functools import reduce
|
||||
|
||||
def extractYear(v):
|
||||
return(pd.Series(reduce(lambda x, y: x + y, map(rx.findall, v), [])).astype(int))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user