Skip to content

Instantly share code, notes, and snippets.

@royerk
royerk / infer_missing_days.py
Last active October 16, 2023 01:33
AB infer from log
import pandas as pd
df = pd.DataFrame(
[
["2023-01-01", "device_1", 800, True],
["2023-01-01", "device_2", 900, True],
["2023-01-02", "device_1", 800, True],
["2023-01-02", "device_3", 900, True],
["2023-01-03", "device_2", 900, True],
["2023-01-04", "device_1", 999, True],
@royerk
royerk / fill_missing_values.py
Created October 24, 2023 01:33
AB infer missing values on row
from typing import List
import pandas as pd
df = pd.DataFrame(
[
["device_1", None, 1.0, 2.0, None, None, 3.0],
["device_2", 1.0, None, 2.0, None, None, None],
],
columns=["device_id", "0", "1", "2", "3", "4", "5"],
)
@royerk
royerk / fill_set_points_2.py
Created November 21, 2023 02:59
AB infer missing values, pick first value from day before
import pandas as pd
import numpy as np
df = pd.DataFrame(
[
["id_0", "2023-11-01", np.nan, 1, 0.5],
["id_0", "2023-11-02", 0.5, 2, np.nan],
["id_0", "2023-11-03", np.nan, np.nan, np.nan], # device in baseline
["id_0", "2023-11-04", np.nan, np.nan, np.nan], # device in baseline
["id_0", "2023-11-05", np.nan, 1.0, np.nan],
@royerk
royerk / setup.sh
Created March 5, 2024 18:08
Macos setup
# karabiner elements for key mapping
# brew or get .pkg from https://github.com/Homebrew/brew/releases/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# https://gist.github.com/n1snt/454b879b8f0b7995740ae04c5fb5b7df