Skip to content

Instantly share code, notes, and snippets.

View zufanka's full-sized avatar

Ada zufanka

View GitHub Profile
def scrape_contributions(soup, org_id):
'''
Scrapes the table next to the text "contributions in the closed financial year"
Returns a list of lists with contributions
'''
data = []
txt = ".*Contributions in the closed financial year.*"
# lower bound for the first quantile
previous_q = 0
# store the medians in a dictionary
row = {}
# column name to calculate the quantiles from
colname = "bedrag"
for q in range(1,11):
# .quantile() wants a decimal between 0 and 1
Country iso2 iso3 Numeric
Afghanistan AF AFG 4
Albania AL ALB 8
Algeria DZ DZA 12
American Samoa AS ASM 16
Andorra AD AND 20
Angola AO AGO 24
Anguilla AI AIA 660
Antarctica AQ ATA 10
Antigua and Barbuda AG ATG 28
English Dutch
Afghanistan Afghanistan
Albania Albanië
Algeria Algerije
Andorra Andorra
Angola Angola
Antigua and Barbuda Antigua en Barbuda
Argentina Argentinië
Armenia Armenië
Australia Australië
code Label
BIOE Bioenergy
C0000 Coal and manufactured gases
C0000X0350-0370 Solid fossil fuels
C0100 Hard coal
C0110 Anthracite
C0120 Bituminous coal
C0121 Coking coal
C0129 Other bituminous coal
C0200 Brown coal
country population date membership source
Germany 83695430 31 Mar 2022 European Union National quarterly estimate[9]
France 67918000 1 Aug 2022 European Union National monthly estimate[10]
Italy 58887391 1 May 2022 European Union National monthly estimate[12]
Spain 47432805 1 Jan 2022 European Union National estimate[13]
Poland 38014000 30 Apr 2022 European Union National monthly estimate[15]
Romania 19038000 1 Jan 2022 European Union National annual estimate[17]
Netherlands 17710526 1 Jul 2022 European Union National monthly estimate[18]
Belgium 11584008 1 Jan 2022 European Union National estimate[19]
Greece 10678632 1 Jan 2021 European Union National estimate[20]
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
eu_country
Netherlands
Luxembourg
Lithuania
Bulgaria
Portugal
Slovakia
Slovenia
Austria
Belgium

Imports needed

import pandas as pd
import numpy as np

from IPython.display import Markdown, display

def printmd(string):
    display(Markdown(string))
@zufanka
zufanka / The_turbo_data_analysis_cheatsheet.md
Last active November 12, 2025 13:34
The turbo data analysis cheatsheet
@zufanka
zufanka / rd-to-wg.py
Created June 3, 2019 15:48
RD coördinaten omzetten naar WGS84 (thomasv)
class RDWGSConverter:
# https://thomasv.nl/2014/03/rd-naar-gps/
X0 = 155000
Y0 = 463000
phi0 = 52.15517440
lam0 = 5.38720621
def fromRdToWgs( self, coords ):