Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
def histogram_intersection(p, q):
    v = np.minimum(p, q).sum().round(decimals=1)
    return v
df = pd.DataFrame([(.3, .5), (.0, .8), (.8, .0), (.2, .1)],
                  columns=['goats', 'cows'])
df.corr(method=histogram_intersection)
Out[2]:
goats cows
goats 1.0 0.4
cows 0.4 1.0