Pushkin Duels CSV

There are more than 25 known Pushkin’s duels.
Let’s make CSV containing these duels details.
Here its full content:

import requests

DUELS_CSV_URL = 'https://raw.githubusercontent.com/boorstat/boorstat-files/master/lit/pushkin/duels.csv'

1816,Paul Hannibal,uncle,during a ball Paul lugged away Pushkin’s girlfriend miss Loshakova,0,0
1817,Pyotr Kaverin,friend,Kaverin’s facetious poem,0,0
1819,Kondratiy Ryleev,poet,Ryleev told a joke about Pushkin at a high society gathering,0,0
1819,Wilhelm Kiichelbecker,friend,funny verses about Küchelbecker,0,1
1819,Modest Korf,Ministry of justice worker,Pushkin’s drunk manservant pestered Korf’s servant who finally beat Pushkin’s servant up,0,0
1819,Denisevich,Major,Pushkin behaved provocatively in theater: he yelled at actors,0,0
1820,Orlov Fedor and Alexey Alexeev,,Orlov and Alexeev reprimanded Pushkin for being drunk and trying to play pool,0,0
1821,Deguilly,French military officer,a quarrel under unclear circumstances,0,0
1822,Semyon Starov,lieutenant colonel,a conflict occurred because of a restaurant orchestra at a casino where both indulged in gambling,1,1
1822,Ivan Lanov,65-year-old state councilor,a quarrel during a holiday dinner,0,0
1822,Todor Balsh,Moldavian nobleman,Balsh’s wife Maria responded to Pushkin’s question in an impolite manner,1,1
1822,Skartla Pruncul,Bessarabian landowner,they were seconds at someone else’s duel and could not agree upon the rules of the duel,0,0
1822,Seweryn Potocki,Active Privy Councillor,discussion about serfdom at the dinner table,0,0
1822,Rutkowski,captain,Pushkin did not believe that a hailstone can weigh up to 3 pounds (which is possible) and made fun of the retired captain,0,0
1822,Inglezi,Chisinau tycoon,Pushkin coveted his wife (a gypsy woman Ludmila Shekora),0,0
1832,Alexander Zubov,General Staff warrant officer,Pushkin had caught Zubov on cheating during a game of cards,0,1
1823,Ivan Rousseau,young writer,Pushkin’s personal dislike for this person,0,0
1826,Nikolay Turgenev,one of the leaders of the Union of Welfare and a member of the Northern Society,Tugrenev did not approve of Pushkin’s poem,0,0
1827,Vladimir Solomirskiy,artillery officer,the officer’s female friend Sofia to whom Pushkin was personally attracted,0,0
1828,Alexander Golitsyn,Minister of Education,Pushkin wrote a bold epigram so the Minister arranged a rough interrogation,0,0
1828,Lagrenée,French Embassy Secretary in St.Petersburg,an unknown girl at a ball,0,0
1829,Mr. Hvostov,Foreign Office worker,Hvostov was dissatisfied by Pushkin’s epigrams,0,0
1836,Nikolay Repin,,Repin was dissatisfied with Pushkin’s poems about him,0,0
1836,Semyon Hlustin,Foreign Office worker,Hlustin did not approve of Pushkin’s poetry,0,0
1836,Vladimir Sollogub,minor Russian writer,Sologub’s unflattering remarks about the poet’s wife Natalia,0,0
1836,George d’Anthès,French officer,an anonymous letter which stated that Pushkin’s wife had been cheating on her husband with d’Anthès,0,0
1837,George d’Anthès,French officer,an anonymous letter which stated that Pushkin’s wife had been cheating on her husband with d’Anthès,1,1

Pushkin’s duels csv

Source for this data:

And now let’s try to use it and plot some visual representation of Pushkin’s duels into real shots conversion.
Starting with imports:

from io import StringIO

import pandas as pd
import plotly.plotly as py
import plotly.graph_objs as go

Getting csv as pandas dataframe:

df = pd.DataFrame.from_csv(StringIO(requests.get(DUELS_CSV_URL).text), index_col=None)
year opponent_name opponent_descr cause pushkin_shot opponent_shot
0 1816 Paul Hannibal uncle during a ball Paul lugged away Pushkin’s girlf... 0 0
1 1817 Pyotr Kaverin friend Kaverin’s facetious poem 0 0
2 1819 Kondratiy Ryleev poet Ryleev told a joke about Pushkin at a high soc... 0 0
3 1819 Wilhelm Kiichelbecker friend funny verses about Küchelbecker 0 1
4 1819 Modest Korf Ministry of justice worker Pushkin’s drunk manservant pestered Korf’s ser... 0 0

Looks very exciting as for me:)
Time to plot Pushkin’s Duels Histogram.

life_years = {'start': 1799, 'end': 1837, 'size': 1}

nobody_shot_data = go.Histogram(
    x=df[(df['pushkin_shot'] == 0) & (df['opponent_shot'] == 0)]['year'],

only_opponent_shot_data = go.Histogram(
    x=df[(df['pushkin_shot'] == 0) & (df['opponent_shot'] == 1)]['year'],
    name='Only opponent'

both_shot_data = go.Histogram(
    x=df[(df['pushkin_shot'] == 1) & (df['opponent_shot'] == 1)]['year'],
    name='Both shot'

data = [only_opponent_shot_data, nobody_shot_data, both_shot_data]
layout = go.Layout(barmode='stack', title="Pushkin's Duels Histogram")
fig = go.Figure(data=data, layout=layout)

py.iplot(fig, filename='pushkin-duels')