Skip to content

Instantly share code, notes, and snippets.

View payoto's full-sized avatar

Alexandre Payot payoto

View GitHub Profile
import numpy as np
from multiprocessing import Pool
from itertools import repeat
import time
import pandas as pd
# Little test of https://stackoverflow.com/questions/49367278/any-way-to-speed-up-numpy-cumsum
# DOES NOT WORK
def parallel_cumsum(arr_in, arr_out, axis=0):
"""Benchmarking of numpy array creation through loops, indexing, list
comprehension and generator expressions.
Requires:
- pip install numpy pytest pytest-benchmark
Run with:
pytest benchmark_array_creation.py
@payoto
payoto / merge_data_gouv_opencovid_fr.py
Created March 6, 2021 00:55
A small python module to merge the OpenCovid19-FR and data.gouv.fr datasets
"""Module to merge the OpenCovid19-FR and data.gouv.fr datasets.
The function provided by this script (`download_france_data`) pulls the latest
data from:
* https://raw.githubusercontent.com/opencovid19-fr/data/master/dist/chiffres-cles.csv
* https://www.data.gouv.fr/fr/datasets/r/f335f9ea-86e3-4ffa-9684-93c009d5e617
renames the columns of the data.gouv dataset to match the opencovid19 dataset and
merges the two datasets. The data is returned as a pandas dataframe.