In [1]:
import pathlib
import sys

import numpy as np
import pandas as pd

In [2]:
current_directory = pathlib.Path().cwd()
project_directory = current_directory.parents[0]
sys.path.append(str(project_directory.resolve()))

In [3]:
import surgeo
surgeo.VERSION


Out[3]:
'2010.1.1'

In [4]:
g = surgeo.GeocodeModel()
s = surgeo.SurnameModel()
sg = surgeo.SurgeoModel()

In [5]:
surnames = pd.Series([
    'DIAZ',
    'JOHNSON',
    'WASHINGTON',
])

In [6]:
zips = pd.Series([
    '65201',
    '63144',
    '63110',
])

In [7]:
s.get_probabilities(surnames)


Out[7]:
name white black api native multiple hispanic
0 DIAZ 0.0519 0.0065 0.0119 0.0016 0.0025 0.9256
1 JOHNSON 0.5897 0.3463 0.0054 0.0094 0.0256 0.0236
2 WASHINGTON 0.0517 0.8753 0.0030 0.0068 0.0378 0.0254

In [8]:
g.get_probabilities(zips)


Out[8]:
zcta5 white black api native multiple hispanic
0 65201 0.815527 0.074888 0.053001 0.002288 0.023209 0.031089
1 63144 0.861114 0.028935 0.062862 0.001248 0.016907 0.028935
2 63110 0.518377 0.401548 0.031772 0.001817 0.024269 0.022217

In [9]:
sg.get_probabilities(surnames, zips)


Out[9]:
zcta5 name white black api native multiple hispanic
0 65201 DIAZ 0.264680 0.015885 0.051868 0.002006 0.011957 0.653604
1 63144 JOHNSON 0.872022 0.089793 0.007666 0.001766 0.024494 0.004259
2 63110 WASHINGTON 0.014138 0.967599 0.000661 0.000571 0.015949 0.001081