In [17]:
import pandas as pd
import os
# this is where I unzipped the MTC data
SRCDIR = "/Users/ffoti/data/activitysim"
# and where it's going to
TGTFILE = "../example/data/mtc_asim.h5"
In [18]:
store = pd.HDFStore(TGTFILE, "w")
In [19]:
col_map = {
"HHID": "household_id",
"AGE": "age",
"TOTHH": "total_households",
"TOTEMP": "total_employment",
"TOTACRE": "total_acres",
"COUNTY": "county_id",
"hworkers": "workers",
"HINC": "income"
}
In [20]:
df = pd.read_csv(os.path.join(SRCDIR, "landuse", "tazData.csv"), index_col="ZONE")
df.columns = [col_map.get(s, s) for s in df.columns]
store["land_use/taz_data"] = df
In [21]:
df = pd.read_csv(os.path.join(SRCDIR, "skims", "accessibility.csv"), index_col="taz")
df.columns = [col_map.get(s, s) for s in df.columns]
store["skims/accessibility"] = df
In [22]:
df = pd.read_csv(os.path.join(SRCDIR, "popsyn", "hhFile.p2011s3a1.2010.csv"), index_col="HHID")
df.columns = [col_map.get(s, s) for s in df.columns]
store["households"] = df
In [23]:
df = pd.read_csv(os.path.join(SRCDIR, "popsyn", "personFile.p2011s3a1.2010.csv"), index_col="PERID")
df.columns = [col_map.get(s, s) for s in df.columns]
store["persons"] = df
In [24]:
store.close()
In [24]: