forked from tdwojak/Python2017
commited tasks
This commit is contained in:
parent
9c719633e7
commit
693f24077e
@ -1,7 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
reload(sys)
|
||||
sys.setdefaultencoding("utf-8")
|
||||
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def wczytaj_dane():
|
||||
rooms_data = pd.read_csv('mieszkania.csv', # ścieżka do pliku
|
||||
@ -44,10 +51,37 @@ def find_borough(desc):
|
||||
|
||||
|
||||
def add_borough(dane):
|
||||
pass
|
||||
boroughArr = []
|
||||
for current_location in dane:
|
||||
findborough = find_borough(current_location)
|
||||
#print current_location , findborough
|
||||
boroughArr.append(findborough)
|
||||
return pd.Series(boroughArr)
|
||||
|
||||
def write_plot(dane, filename):
|
||||
pass
|
||||
add_borough(dane)
|
||||
|
||||
hist_data = dane['Borough'].value_counts()
|
||||
|
||||
# plt.figure()
|
||||
|
||||
|
||||
|
||||
wyplot = hist_data.plot(kind='bar', alpha=0.5, title="Liczba ogloszen mieszkan z podzialem na dzielnice",
|
||||
fontsize=5, figsize=(7, 5))
|
||||
|
||||
wyplot.set_xlabel("Dzielnice")
|
||||
|
||||
wyplot.set_ylabel("Liczba ogloszen")
|
||||
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
fig = wyplot.get_figure()
|
||||
|
||||
fig.savefig(filename)
|
||||
|
||||
|
||||
def mean_price(dane, room_number):
|
||||
AVGdane = dane[dane.Rooms == room_number]
|
||||
@ -78,7 +112,11 @@ def main():
|
||||
roomCheapest = cheapest_flats(dane, 5)
|
||||
#print roomCheapest
|
||||
|
||||
district = add_borough(dane['Location'])
|
||||
dane['Borough'] = district.values
|
||||
#print(dane[:5])
|
||||
|
||||
write_plot(dane, 'plot.png')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user