NYCPlanning / db-acs

American Community Survey data processing for Population Fact Finder
4 stars 1 forks source link

Find total variables and make p 100 percent #10

Closed AmandaDoyle closed 4 years ago

baolingz commented 4 years ago
SELECT a.geotype, a.geoid, a.c, a.e, a.m, a.p, a.z, a.variable, b.c, b.e, b.m, b.p, b.z
FROM demographic a
RIGHT JOIN staging.demographic b
ON a.geotype = b.geotype
AND a.geogname = b.geogname
AND a.geoid = b.geoid
AND a.dataset = b.dataset
AND a.variable = b.variable
WHERE a.p = 100
AND b.p != 100;
SPTKL commented 4 years ago

Handled in 03_calculation.py

df.loc[df[f'{variables[0]}PE'] == df[total_e], f'{i}P'] = 100