- if len(fields) == 7 and fields[0] != "GEOID":
- zcta = fields[0]
- if zcta not in zctas: zctas[zcta] = {}
- zctas[zcta]["centroid"] = gecos(
- ",".join( ( fields[6], fields[5] ) )
+ f_geoid = fields[ columns.index("GEOID") ].strip()
+ f_intptlat = fields[ columns.index("INTPTLAT") ].strip()
+ f_intptlong = fields[ columns.index("INTPTLONG") ].strip()
+ if f_geoid and f_intptlat and f_intptlong:
+ if f_geoid not in zctas: zctas[f_geoid] = {}
+ zctas[f_geoid]["centroid"] = gecos(
+ "%s,%s" % (f_intptlat, f_intptlong)