def get_city_data():
 data = pd.read_csv(pm.get_data_file('pymc3.examples', 'data/srrs2.dat'))
 cty_data = pd.read_csv(pm.get_data_file('pymc3.examples', 'data/cty.dat'))
 data = data[(data.state == 'MN')]
 data['fips'] = ((data.stfips * 1000) + data.cntyfips)
 cty_data['fips'] = ((cty_data.stfips * 1000) + cty_data.ctfips)
 data['lradon'] = np.log(np.where((data.activity == 0), 0.1, data.activity))
 data = data.merge(cty_data, 'inner', on='fips')
 unique = data[['fips']].drop_duplicates()
 unique['group'] = np.arange(len(unique))
 unique.set_index('fips')
 return data.merge(unique, 'inner', on='fips')

def get_city_data ( ) : data = pd . read_csv ( pm . get_data_file ( 'pymc3.examples' , 'data/srrs2.dat' ) ) cty_data = pd . read_csv ( pm . get_data_file ( 'pymc3.examples' , 'data/cty.dat' ) ) data = data [ ( data . state == 'MN' ) ] data [ 'fips' ] = ( ( data . stfips * 1000 ) + data . cntyfips ) cty_data [ 'fips' ] = ( ( cty_data . stfips * 1000 ) + cty_data . ctfips ) data [ 'lradon' ] = np . log ( np . where ( ( data . activity == 0 ) , 0.1 , data . activity ) ) data = data . merge ( cty_data , 'inner' , on = 'fips' ) unique = data [ [ 'fips' ] ] . drop_duplicates ( ) unique [ 'group' ] = np . arange ( len ( unique ) ) unique . set_index ( 'fips' ) return data . merge ( unique , 'inner' , on = 'fips' )
helper to get city data .