Open hupili opened 10 years ago
Note the snippet here for future use.
import pandas
from pandas.stats.api import ols
df = pandas.io.parsers.read_csv('census.csv')
degree = df[(df.table==3) & (df.column=='d43_and') & (df.row=='a53_degree')][['area', 'value']]
incoming = df[(df.table==18) & (df.column=='l118_active') & (df.row=='h131_80000')][['area', 'value']]
both=degree.merge(incoming, on='area')
scatter(both['value_x'], both['value_y'])
res = ols(y=both['value_y'], x=both['value_x'])
hold(True)
plot(res.x['x'], res.y_predict)
xlabel('Degree course')
ylabel('80,000 - 99,999')
print res
like the plot I posted on Facebook.
With the assist of backend, it could be much easier.