This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read a PDF and convert it to an XLS | |
# Tested on Bijlage B - Wob-deelbesluit 'Vaccinaties en medicatie oktober 2020' | |
# Not tested 100% | |
# inspired by https://x.com/Transparangst/status/1906717209423974689 | |
def read_directly_from_pdf(): | |
# read a file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import math | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def binary_search_steps(target, max_num): | |
"""Simulate binary search and return number of steps needed""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import streamlit as st | |
import plotly.graph_objects as go | |
import matplotlib.pyplot as plt | |
# stacked range bar chart | |
# as proposed by https://www.youtube.com/watch?v=5zBg9pH_6bE | |
# by Rene Smit (@rcsmit), with help from Github Co Pilot (GPT 4o) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We berekenen de sterfte in 2020-2024 aan de hand van de sterftekansen per leeftijdsgroep (5jr, Eurostats) in 2019 en | |
# de bevolkingsgrootte in 2020-2024(CBS) | |
# Naar aanleiding van https://twitter.com/PeeNee2/status/1855384448478609656 | |
import pandas as pd | |
# Load the data from CSV files | |
sterfte_df = pd.read_csv("https://raw.githubusercontent.com/rcsmit/COVIDcases/refs/heads/main/input/sterfte_eurostats_NL.csv") | |
bevolking_df = pd.read_csv("https://raw.githubusercontent.com/rcsmit/COVIDcases/refs/heads/main/input/bevolking_leeftijd_NL.csv", delimiter=";") | |
sterfte_df['jaar'] = sterfte_df['TIME_PERIOD'].str[:4].astype(int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.integrate import odeint | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
from mpl_toolkits.mplot3d import Axes3D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import streamlit as st | |
from PIL import Image, ExifTags | |
from io import BytesIO | |
import pytesseract | |
import re | |
import os | |
# based on https://www.youtube.com/watch?v=RPN-HxvAQnQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_data_eurostat(): | |
"""Get from Eurostat : Deaths by week, sex and 5-year age group | |
Data from https://ec.europa.eu/eurostat/databrowser/product/view/demo_r_mwk_05?lang=en | |
https://ec.europa.eu/eurostat/databrowser/bookmark/fbd80cd8-7b96-4ad9-98be-1358dd80f191?lang=en | |
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/dataflow/ESTAT/DEMO_R_MWK_05/1.0?references=descendants&detail=referencepartial&format=sdmx_2.1_generic&compressed=true | |
Returns: | |
df: dataframe with weekly mortality in 5 year tranches | |
DATAFLOW LAST UPDATE freq age sex ... OBS_VALUE OBS_FLAG age_sex jaar weeknr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import streamlit as st | |
import plotly.graph_objects as go | |
import numpy as np | |
import statsmodels.api as sm | |
// output: https://twitter.com/rcsmit/status/1800539585841344854 | |
def test(): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# recreating https://twitter.com/NateB_Panic/status/1636811443612860417/photo/1 | |
import numpy as np | |
import plotly | |
import plotly.graph_objects as go | |
import numpy as np | |
p_values = [0.01, 0.05,0.1,0.2, 0.3, 0.5] # set the values of p | |
x = np.arange(0, 30, 1) # generate an array of x values from 0 to 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" A script to calculate the loss or gain after x months working in a year with a montly salary of y | |
This calculation is a simplification | |
Goal is to learn to work with OOP and make the script pythonic as much as possible. | |
TODO : calculate the total capital after z years, with taking inflation in account | |
Returns: | |
A dataframe like this: |
NewerOlder