%pylab inline
import requests
import pandas as pd
import json
Populating the interactive namespace from numpy and matplotlib
r = requests.get('http://localhost:5000/api/v1/receita/series?code=1.1.1.2.02.02')
iptu_data = pd.read_json(r.content, orient='split')
iptu_data
date | predicted | outcome | |
---|---|---|---|
1.1.1.2.02.02 | 2008-01-31 | 11130250.00 | 3167489.73 |
1.1.1.2.02.02 | 2008-02-29 | 11130250.00 | 41884378.39 |
1.1.1.2.02.02 | 2008-03-31 | 11130250.00 | 19903620.92 |
1.1.1.2.02.02 | 2008-04-30 | 11130250.00 | 64613.71 |
1.1.1.2.02.02 | 2008-05-31 | 11130250.00 | 14464750.89 |
1.1.1.2.02.02 | 2008-06-30 | 11130250.00 | 8737740.83 |
1.1.1.2.02.02 | 2008-07-31 | 11130250.00 | 8492051.76 |
1.1.1.2.02.02 | 2008-08-31 | 11130250.00 | 7530991.91 |
1.1.1.2.02.02 | 2008-09-30 | 11130250.00 | 8511892.31 |
1.1.1.2.02.02 | 2008-10-31 | 11130250.00 | 8034572.04 |
1.1.1.2.02.02 | 2008-11-30 | 11130250.00 | 7352505.98 |
1.1.1.2.02.02 | 2008-12-31 | 11130250.00 | 2385657.25 |
1.1.1.2.02.02 | 2009-01-31 | 9658333.33 | 2593514.14 |
1.1.1.2.02.02 | 2009-02-28 | 9658333.33 | 40073958.82 |
1.1.1.2.02.02 | 2009-03-31 | 9658333.33 | 24757364.15 |
1.1.1.2.02.02 | 2009-04-30 | 9658333.33 | 9130559.95 |
1.1.1.2.02.02 | 2009-05-31 | 9658333.33 | 8704293.56 |
1.1.1.2.02.02 | 2009-06-30 | 9658333.33 | 8616544.57 |
1.1.1.2.02.02 | 2009-07-31 | 9658333.33 | 8205692.90 |
1.1.1.2.02.02 | 2009-08-31 | 9658333.33 | 8241502.81 |
1.1.1.2.02.02 | 2009-09-30 | 9658333.33 | 8914428.63 |
1.1.1.2.02.02 | 2009-10-31 | 9658333.33 | 7459573.92 |
1.1.1.2.02.02 | 2009-11-30 | 9658333.33 | 7944754.76 |
1.1.1.2.02.02 | 2009-12-31 | 9658333.33 | 2599253.10 |
1.1.1.2.02.02 | 2010-01-31 | 13566560.83 | 2753238.97 |
1.1.1.2.02.02 | 2010-02-28 | 13566560.83 | 47258818.00 |
1.1.1.2.02.02 | 2010-03-31 | 13566560.83 | 29053461.29 |
1.1.1.2.02.02 | 2010-04-30 | 13566560.83 | 11760049.21 |
1.1.1.2.02.02 | 2010-05-31 | 13566560.83 | 11284328.61 |
1.1.1.2.02.02 | 2010-06-30 | 13566560.83 | 11343547.25 |
... | ... | ... | ... |
1.1.1.2.02.02 | 2012-07-31 | 17812900.00 | 13242414.40 |
1.1.1.2.02.02 | 2012-08-31 | 0.00 | 0.00 |
1.1.1.2.02.02 | 2012-09-30 | 17812900.00 | 12946746.04 |
1.1.1.2.02.02 | 2012-10-31 | 0.00 | 0.00 |
1.1.1.2.02.02 | 2012-11-30 | 17812900.00 | 3301884.68 |
1.1.1.2.02.02 | 2012-12-31 | 0.00 | 0.00 |
1.1.1.2.02.02 | 2013-01-31 | 20151379.08 | 6745689.99 |
1.1.1.2.02.02 | 2013-02-28 | 20151379.08 | 66634953.69 |
1.1.1.2.02.02 | 2013-03-31 | 20151379.08 | 31290497.04 |
1.1.1.2.02.02 | 2013-04-30 | 20151379.08 | 25986455.04 |
1.1.1.2.02.02 | 2013-05-31 | 20151379.08 | 15906872.74 |
1.1.1.2.02.02 | 2013-06-30 | 20151379.08 | 15158176.60 |
1.1.1.2.02.02 | 2013-07-31 | 20151379.08 | 15079791.91 |
1.1.1.2.02.02 | 2013-08-31 | 20151379.08 | 15309971.76 |
1.1.1.2.02.02 | 2013-09-30 | 20151379.08 | 14477768.05 |
1.1.1.2.02.02 | 2013-10-31 | 20151379.08 | 13300353.58 |
1.1.1.2.02.02 | 2013-11-30 | 20151379.08 | 12041239.04 |
1.1.1.2.02.02 | 2013-12-31 | 20151379.08 | 4866685.85 |
1.1.1.2.02.02 | 2014-01-31 | 21182784.83 | 6135690.03 |
1.1.1.2.02.02 | 2014-02-28 | 21182784.83 | 73935150.06 |
1.1.1.2.02.02 | 2014-03-31 | 21182784.83 | 33736279.60 |
1.1.1.2.02.02 | 2014-04-30 | 21182784.83 | 20122174.97 |
1.1.1.2.02.02 | 2014-05-31 | 21182784.83 | 17609334.69 |
1.1.1.2.02.02 | 2014-06-30 | 21182784.83 | 17352023.64 |
1.1.1.2.02.02 | 2014-07-31 | 21182784.83 | 17700197.04 |
1.1.1.2.02.02 | 2014-08-31 | 21182784.83 | 18426293.49 |
1.1.1.2.02.02 | 2014-09-30 | 21182784.83 | 18025453.89 |
1.1.1.2.02.02 | 2014-10-31 | 21182784.83 | 16974893.62 |
1.1.1.2.02.02 | 2014-11-30 | 21182784.83 | 15358597.20 |
1.1.1.2.02.02 | 2014-12-31 | 21182784.83 | 10474.98 |
108 rows × 3 columns
iptu_data.
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-65-cb49f11252b5> in <module>() ----> 1 iptu_data.type /home/walrus/.virtualenvs/py/local/lib/python2.7/site-packages/pandas/core/generic.pyc in __getattr__(self, name) 1945 return self[name] 1946 raise AttributeError("'%s' object has no attribute '%s'" % -> 1947 (type(self).__name__, name)) 1948 1949 def __setattr__(self, name, value): AttributeError: 'DataFrame' object has no attribute 'type'
years = {}
for i, year in enumerate(range(2008,2015)):
years[year] = map(float, d.ix['outcome'][0][i*12:(i + 1)*12])
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-38-6cdfb8e151e2> in <module>() 2 3 for i, year in enumerate(range(2008,2015)): ----> 4 years[year] = map(float, d.ix['outcome'][0][i*12:(i + 1)*12]) NameError: name 'd' is not defined
figsize(15,6)
for y in range(2008,2015):
plot(years[y])
legend(years.keys())
<matplotlib.legend.Legend at 0x55b7290>