1
0
forked from tdwojak/Python2017
Python2017/labs06/task02.py

71 lines
1.4 KiB
Python
Raw Normal View History

2017-12-15 14:24:17 +01:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
2017-12-16 13:01:49 +01:00
import pandas as pd
2017-12-15 14:24:17 +01:00
def wczytaj_dane():
2017-12-16 13:01:49 +01:00
flats_data = pd.read_csv('mieszkania.csv',
sep=',', # separator
index_col='Id') # ustawienie indeksu na kolumnę 'Id'
flats_as_frame = pd.DataFrame(flats_data)
return flats_as_frame
2017-12-15 14:24:17 +01:00
def most_common_room_number(dane):
2017-12-16 13:01:49 +01:00
rooms = dane['Rooms']
counter = rooms.value_counts()
# new_dict = {}
# for i in counter:
# new_dict.update([i])
# print (new_dict)
print (max(counter))
2017-12-15 14:24:17 +01:00
def cheapest_flats(dane, n):
pass
def find_borough(desc):
dzielnice = ['Stare Miasto',
'Wilda',
'Jeżyce',
'Rataje',
'Piątkowo',
'Winogrady',
'Miłostowo',
'Dębiec']
pass
def add_borough(dane):
pass
def write_plot(dane, filename):
pass
def mean_price(dane, room_number):
pass
def find_13(dane):
pass
def find_best_flats(dane):
pass
def main():
dane = wczytaj_dane()
2017-12-16 13:01:49 +01:00
# print(dane[:5])
2017-12-15 14:24:17 +01:00
print("Najpopularniejsza liczba pokoi w mieszkaniu to: {}"
.format(most_common_room_number(dane)))
print("{} to najłądniejsza dzielnica w Poznaniu."
2017-12-16 13:01:49 +01:00
.format(find_borough("Grunwald i Jeżyce")))
2017-12-15 14:24:17 +01:00
print("Średnia cena mieszkania 3-pokojowego, to: {}"
.format(mean_price(dane, 3)))
if __name__ == "__main__":
main()