Skip to content

Instantly share code, notes, and snippets.

View IyarLin's full-sized avatar
💭
Thinking about it

Iyar Lin IyarLin

💭
Thinking about it
View GitHub Profile
@IyarLin
IyarLin / dtplyr_speed_benchmarking.R
Created April 12, 2021 10:23
dtplyr speed benchmarking
require(data.table)
require(dtplyr)
require(dplyr)
N <- 1e8
K <- 100
set.seed(1)
DT <- data.table(
id1 = sample(sprintf("id%03d", 1:K), N, TRUE), # large groups (char)
id2 = sample(sprintf("id%03d", 1:K), N, TRUE), # large groups (char)
@IyarLin
IyarLin / pandas_filter_method.py
Last active June 24, 2020 08:42
python snippets
import pandas as pd
def filter_(df, f):
return df[f(df)]
pd.DataFrame.filter_ = filter_