Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import argparse
from dataclasses import dataclass
from datetime import date, datetime
import pandas as pd
import requests
@bmerry
bmerry / output.txt
Created July 26, 2017 07:56
Benchmarks of different implementations of dask.array.where
No broadcasting or scalars
where_orig : 0.000482s ± 0.000005 (construct), 0.165047s ± 0.001631s (compute)
where_where: 0.000273s ± 0.000002 (construct), 0.070438s ± 0.000439s (compute)
where_new : 0.000289s ± 0.000004 (construct), 0.069269s ± 0.000712s (compute)
Scalar condition
where_orig : 0.000013s ± 0.000000 (construct), 0.024283s ± 0.000316s (compute)
where_where: 0.000012s ± 0.000000 (construct), 0.024131s ± 0.000329s (compute)
where_new : 0.000017s ± 0.000000 (construct), 0.023551s ± 0.000195s (compute)
Broadcasting
where_orig : 0.000810s ± 0.000008 (construct), 0.168275s ± 0.001371s (compute)
@bmerry
bmerry / ctype_to_dtype.py
Created July 30, 2015 08:49
Convert cffi type to numpy dtype
import numpy as np
import six
_FLOAT_TYPES = set(['float', 'double', 'long double'])
def _sub_overrides(overrides, prefix):
out = {}
for (key, value) in six.iteritems(overrides):
if key.startswith(prefix):
out[key[len(prefix):]] = value