In [42]:
# http://stackoverflow.com/questions/19410042/how-to-make-ipython-notebook-inline-matplotlib-graphics
%matplotlib inline
from stojaki import rack_locations, waw_suburbs
import seaborn as sns

In [43]:
len(waw_suburbs.Suburbs)


Out[43]:
18

In [40]:
df = rack_locations.as_dataframe()
df.drop('suburb_id', 1).head(10)


Out[40]:
desc icon lat lng parking_places racks_count suburb_name
0 Kampus SGGW blueIcon 52.162385 21.046160 14 7 Ursynów
1 Sadyba BEST Mall greenIcon 52.187730 21.061298 16 8 Mokotów
2 Sadyba BEST Mall greenIcon 52.187443 21.061708 8 4 Mokotów
3 Sadyba BEST Mall greenIcon 52.187572 21.060330 8 4 Mokotów
4 Al. Ujazdowskie / ul. Piękna blueIcon 52.223690 21.024410 8 4 Śródmieście
5 Al. Ujazdowskie / Pl. na Rozdrożu blueIcon 52.220084 21.025490 10 5 Śródmieście
6 Al. Ujazdowskie / ul. Bagatela blueIcon 52.213789 21.026996 16 8 Śródmieście
7 ul. Grójecka 75 greenIcon 52.212732 20.978257 4 2 Ochota
8 ul. Krymska 6 blueIcon 52.184900 21.051914 4 2 Mokotów
9 PKP Ursus - ul. Wiosny Ludów blueIcon 52.196106 20.884874 10 5 Ursus

10 rows × 7 columns


In [37]:
df['racks_count'].sum()


Out[37]:
3615

In [47]:
grouped_by_suburb = df['racks_count'].groupby(df['suburb_name']).agg(sum)
grouped_by_suburb.sort()
grouped_by_suburb.plot(kind='barh', figsize=(10,10), fontsize=15)
plt.xlabel('Racks', fontsize=15)
plt.ylabel('')
plt.xticks(fontsize=15)


Out[47]:
(array([   0.,  100.,  200.,  300.,  400.,  500.,  600.,  700.,  800.]),
 <a list of 9 Text xticklabel objects>)

In [48]:
grouped_by_suburb


Out[48]:
suburb_name
Rembertów          10
Wesoła             13
Białołęka          64
Żoliborz           65
Targówek           85
Wola              100
Bemowo            100
Ochota            108
Wawer             109
Bielany           118
Wilanów           179
Włochy            183
Ursus             201
Praga Północ      205
Mokotów           402
Praga Południe    416
Ursynów           490
Śródmieście       764
dtype: int64

In [ ]: