forked from tdwojak/Python2017
commit
This commit is contained in:
parent
9a66adcef5
commit
8ba0a6d612
@ -10,10 +10,12 @@ def wczytaj_dane():
|
|||||||
return pd.DataFrame(mieszkania)
|
return pd.DataFrame(mieszkania)
|
||||||
|
|
||||||
def most_common_room_number (dane):
|
def most_common_room_number (dane):
|
||||||
return dane['Rooms'].value_counts().head()
|
most_common = dane['Rooms'].value_counts().head()
|
||||||
|
return most_common
|
||||||
|
|
||||||
def cheapest_flats(dane, n):
|
def cheapest_flats(dane, n):
|
||||||
return dane.sort_values('Expected').head(n)
|
cheapest = dane.sort_values('Expected').head(n)
|
||||||
|
return cheapest
|
||||||
|
|
||||||
def find_borough(desc):
|
def find_borough(desc):
|
||||||
dzielnice = ['Stare Miasto',
|
dzielnice = ['Stare Miasto',
|
||||||
@ -41,24 +43,33 @@ def write_plot(dane, filename):
|
|||||||
figure_data.savefig ( filename )
|
figure_data.savefig ( filename )
|
||||||
|
|
||||||
def mean_price(dane, room_number):
|
def mean_price(dane, room_number):
|
||||||
pass
|
rooms = dane[ dane['Rooms']==room_number]['Expected'].mean()
|
||||||
|
return rooms
|
||||||
|
|
||||||
def find_13(dane):
|
def find_13(dane):
|
||||||
pass
|
floor_13 = dane[dane['Floor'] == 13]['Borough'].values
|
||||||
|
return floor_13
|
||||||
|
|
||||||
def find_best_flats(dane):
|
def find_best_flats(dane):
|
||||||
pass
|
best_flats = dane[(dane['Borough'] == 'Winogrady') & (dane['Rooms'] == 3) & (dane['Floor'] == 1)]
|
||||||
|
return best_flats
|
||||||
|
|
||||||
def main():
|
def main ( ):
|
||||||
dane = wczytaj_dane()
|
dane = wczytaj_dane ( )
|
||||||
print(dane[:5])
|
print(dane[ :5 ])
|
||||||
|
|
||||||
print("Najpopularniejsza liczba pokoi w mieszkaniu to: {}".format ( most_common_room_number ( dane ) ))
|
print("Najpopularniejsza liczba pokoi w mieszkaniu to: {}".format ( most_common_room_number ( dane ) ))
|
||||||
|
|
||||||
print("Najtańsze mieszkania, to: {}".format(cheapest_flats(dane, 5)))
|
print("{} to najłądniejsza dzielnica w Poznaniu.".format ( find_borough ( "Grunwald i Jeżyce" ) ))
|
||||||
|
|
||||||
print("{} to najłądniejsza dzielnica w Poznaniu.".format(find_borough("Grunwald i Jeżyce")))
|
print("Średnia cena mieszkania 3-pokojowego, to: {:.2f}".format ( mean_price ( dane , 3 ) ))
|
||||||
|
|
||||||
|
dane = add_borough(dane)
|
||||||
|
|
||||||
|
print("Dzielnice z ofertami na 13 pietrze: {}".format ( find_13 ( dane ) ))
|
||||||
|
|
||||||
|
print("Najlepsze oferty: {}".format ( find_best_flats ( dane ) ))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main ( )
|
Loading…
Reference in New Issue
Block a user