Skip to content

Instantly share code, notes, and snippets.

View dhirschfeld's full-sized avatar

Dave Hirschfeld dhirschfeld

View GitHub Profile
@dhirschfeld
dhirschfeld / tweak_twitter.py
Created January 24, 2022 07:11
Clearly structuring pandas transformations
def tweak_twitter(df: pd.DataFrame) -> pd.DataFrame:
df = df.copy(deep=False)
normalised_columns = {col: col.replace(' ', '_') for col in df.columns}
df = df.rename(columns=normalised_columns)
# filter uninteresting columns
excluded_columns = [
'permalink_clicks', 'app_opens', 'app_installs', 'email_tweet', 'dial_phone',
]
excluded_columns += [col for col in df.columns if 'promoted' in col]
df = df.drop(columns=excluded_columns)
@dhirschfeld
dhirschfeld / Optional Dependencies.md
Last active May 30, 2020 04:19
Next gen conda recipe spec

Optional Dependencies

https://hackmd.io/axI1tQdwQB2pTJKt5XdY5w#Next-gen-conda-recipe-spec

It would be great if there was a better story for optional dependencies.

The special-casing of test requirements is inconsistent with the requirements for host/build/run.

The fact that you can't independently install the test dependencies is a huge usability wart and suggests there should be a better way of supporting them.

@dhirschfeld
dhirschfeld / Slow Structured Array Indexing.ipynb
Created May 15, 2014 11:53
Demonstration of slow indexing with structured arrays
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dhirschfeld
dhirschfeld / test_interpolate.cpp
Created February 18, 2013 11:36
Demonstration of bug in MKL version 11.2
#include <iostream>
#include <vector>
#include <mkl.h>
#include <mkl_df.h>
using namespace std;
int main () {
const int nx = 11; // #rows in x
const int ny = 1; // #cols in y