Skip to content

Instantly share code, notes, and snippets.

---
title: "object passing example"
format:
html:
code-fold: true
---
```{python}
import numpy as np
year_week date year week start_date end_date cases_pupils cases_pupils % cases_teachers cases_teachers % quarantine_pupils_wo_cases quarantine_pupils_wo_cases % quarantine_teachers quarantine_teachers % schools_distance_learning schools_distance_learning % schools_limited_attendance schools_limited_attendance % schools_no_attendance schools_no_attendance % pupils_distance_learning pupils_distance_learning % pupils_limited_attendance pupils_limited_attendance % pupils_no_attendance pupils_no_attendance % pupils_total schools_total teachers_total pupils_cases+quarantine pupils_cases+quarantine % teachers_cases+quarantine teachers_cases+quarantine %
2020-46 2020-11-13 2020 46 2020-11-09 2020-11-15 19364.0 0.19241311624687504 3219.0 0.35822629574646614 190937.0 1.8972724218565162 12120.0 1.3487737509932183 3320.0 11.480738640293243 0.0 0.0 106.0 0.36655370357562767 1260762.5824217787 12.527745162736629 0.0 0.0 35667.86826577557 0.3544188020502428 10063763.0 28918.0 898594.0 210301.0 2.0896855381033914 15339.0 1.7
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 24 columns, instead of 17 in line 3.
date,year,week,year_week,region,start_date,end_date,cases_pupils,cases_pupils %,cases_teachers,cases_teachers %,pupils_total,quarantine_pupils_wo_cases,quarantine_pupils_wo_cases %,quarantine_teachers,quarantine_teachers %,schools_distance_learning,schools_distance_learning %,schools_limited_attendance,schools_limited_attendance %,schools_no_attendance,schools_no_attendance %,schools_total,teachers_total
2020-11-13,2020,46,2020-46,BB,2020-11-09,2020-11-15,332.0,0.11344260726647737,113.0,0.46773459166356224,292659.0,8998.0,3.0745680126016968,647.0,2.6780909805869446,107.0,11.693989071038251,,,5.0,0.546448087431694,915.0,24159.0
2020-11-19,2020,47,2020-47,BB,2020-11-16,2020-11-22,407.0,0.13906970228149484,126.0,0.521544765925742,292659.0,8802.0,3.0075958709624513,574.0,2.3759261558839357,108.0,11.80327868852459,,,3.0,0.32786885245901637,915.0,24159.0
2020-11-26,2020,48,2020-48,BB,2020-11-23,2020-11-29,463.0,0.1582045998927079,136.0,0.5629372076658802,292659.0,9841.0,3.362616560570493,596.0,2.4669895277122396,14
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 24 columns, instead of 4 in line 4.
date,year,week,year_week,region,start_date,end_date,cases_pupils,cases_pupils %,cases_teachers,cases_teachers %,pupils_total,quarantine_pupils_wo_cases,quarantine_pupils_wo_cases %,quarantine_teachers,quarantine_teachers %,schools_distance_learning,schools_distance_learning %,schools_limited_attendance,schools_limited_attendance %,schools_no_attendance,schools_no_attendance %,schools_total,teachers_total
2020-11-13 00:00:00,2020,46,2020-46,BB,2020-11-09,2020-11-15,332,0.11344260726647737,113,0.46773459166356224,292659,8998,3.0745680126016968,647,2.6780909805869446,107,11.693989071038251,,,5,0.546448087431694,915,24159
2020-11-13 00:00:00,2020,46,2020-46,BE,2020-11-09,2020-11-15,1373,0.34315305926075884,406,0.8371134020618557,400113,17513,4.377013493688033,x,x,294,36.386138613861384,,,0,0,808,48500
2020-11-13 00:00:00,2020,46,2020-46,BW,2020-11-09,2020-11-15,3506,0.23751923153789298,513,0.3750767700991431,1476091,x,x,x,x,295,6.641152633948672,,,5,0.11256190904997748,4442,136772
2020-11-13 00:00:00,2020,46,2020
@FrankGrimm
FrankGrimm / hospitalization_de.csv
Created December 24, 2021 11:03
RKI Trends dashboard hospitalization export (date: 2021-12-23)
Meldedatum difference frozen trend value Lower Prediction Upper
2020-03-06 0.0397 0.1094
2020-03-07 0.0433 0.1599
2020-03-08 0.0673 0.1792
2020-03-09 0.0782 0.1924
2020-03-10 0.0625 0.0866 0.05 0.2201
2020-03-11 0.0902 0.1203 0.072 0.2658
2020-03-12 0.1371 0.1684 0.1095 0.3163
2020-03-13 0.1515 0.1912 0.121 0.3872
2020-03-14 0.1551 0.1984 0.1239 0.4738
#!/bin/bash
set -xe
# requires wget and pdftotext (from xpdf/poppler)
mkdir -p pdfs
mkdir -p texts
wget -O "pdfs/meldungen.zip" "https://www.bbk.bund.de/SharedDocs/Downloads/DE/Warnung-Vorsorge/MoWaS_Meldungen_HW-Lage_Jul_2021.zip?__blob=publicationFile&v=1"
cd "./pdfs"
def positions(self):
yield self.Position(self.root(), self)
for child in self._children:
for position in child.positions():
yield position
from collections import defaultdict
import numpy as np
choices = defaultdict(int)
# sentence = [["[SOS]", "lorem"], ["lorem", "ipsum"], ["ipsum", "dolor"], ...]
# [SOS] "lorem" [EOS]
#
# 0 1 2 3 4 5 6
# "[SOS]", "lorem", "ipsum", "dolor", "silir", "amet", "[EOS]"
package rxtest;
import io.reactivex.Observable;
public class Main {
private void test1() {
Observable.range(1, 10).filter(i -> i % 2 == 0).subscribe(System.out::println, Throwable::printStackTrace);
}
version: '3.4'
# example for 2 deployments of
# https://hub.docker.com/r/octoprint/octoprint
services:
octoprint1:
image: octoprint/octoprint
restart: unless-stopped
ports:
- "8001:80"