<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> import csv <EOL> import xml . etree . cElementTree as et <EOL> from os . path import join <EOL> from . import _data_dir <EOL> data_dir = _data_dir ( ) <EOL> nan = float ( '<STR_LIT>' ) <EOL> data = { } <EOL> with open ( join ( data_dir , '<STR_LIT>' ) ) as f : <EOL> next ( f ) <EOL> reader = csv . reader ( f , delimiter = '<STR_LIT:U+002C>' , quotechar = '<STR_LIT:">' ) <EOL> for row in reader : <EOL> name , dummy , state , dummy , geometry , dummy , dummy , dummy , dummy , state_id , county_id , dummy , dummy = row <EOL> xml = et . fromstring ( geometry ) <EOL> lats = [ ] <EOL> lons = [ ] <EOL> for i , poly in enumerate ( xml . findall ( '<STR_LIT>' ) ) : <EOL> if i > <NUM_LIT:0> : <EOL> lats . append ( nan ) <EOL> lons . append ( nan ) <EOL> coords = ( c . split ( '<STR_LIT:U+002C>' ) [ : <NUM_LIT:2> ] for c in poly . text . split ( ) ) <EOL> lat , lon = list ( zip ( * [ ( float ( lat ) , float ( lon ) ) for lon , lat in <EOL> coords ] ) ) <EOL> lats . extend ( lat ) <EOL> lons . extend ( lon ) <EOL> data [ ( int ( state_id ) , int ( county_id ) ) ] = { <EOL> '<STR_LIT:name>' : name , <EOL> '<STR_LIT:state>' : state , <EOL> '<STR_LIT>' : lats , <EOL> '<STR_LIT>' : lons , <EOL> } </s>
