forked from tdwojak/Python2017
commited tasks
This commit is contained in:
parent
1ea9b5fc16
commit
9c719633e7
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
def wczytaj_dane():
|
||||
rooms_data = pd.read_csv('mieszkania.csv', # ścieżka do pliku
|
||||
@ -12,12 +13,21 @@ def wczytaj_dane():
|
||||
def most_common_room_number(dane):
|
||||
d=dane['Rooms']
|
||||
d= d.value_counts()
|
||||
print d[]
|
||||
pass
|
||||
j=0
|
||||
"""
|
||||
for i in d:
|
||||
print d.index[j] , i
|
||||
j +=1
|
||||
"""
|
||||
d = d.index[0]
|
||||
return d
|
||||
|
||||
|
||||
def cheapest_flats(dane, n):
|
||||
pass
|
||||
SortDane = dane.sort_values('Expected',ascending=True)
|
||||
PriceCheapest = SortDane['Expected']
|
||||
PriceCheapest = PriceCheapest.head(n)
|
||||
return PriceCheapest
|
||||
|
||||
def find_borough(desc):
|
||||
dzielnice = ['Stare Miasto',
|
||||
@ -28,7 +38,9 @@ def find_borough(desc):
|
||||
'Winogrady',
|
||||
'Miłostowo',
|
||||
'Dębiec']
|
||||
pass
|
||||
for district in dzielnice:
|
||||
if district in desc: return district
|
||||
return 'Inne'
|
||||
|
||||
|
||||
def add_borough(dane):
|
||||
@ -38,7 +50,10 @@ def write_plot(dane, filename):
|
||||
pass
|
||||
|
||||
def mean_price(dane, room_number):
|
||||
pass
|
||||
AVGdane = dane[dane.Rooms == room_number]
|
||||
AVGdane = round(AVGdane.Expected.mean(),2)
|
||||
return AVGdane
|
||||
|
||||
|
||||
def find_13(dane):
|
||||
pass
|
||||
@ -60,5 +75,10 @@ def main():
|
||||
print("Średnia cena mieszkania 3-pokojowego, to: {}"
|
||||
.format(mean_price(dane, 3)))
|
||||
|
||||
roomCheapest = cheapest_flats(dane, 5)
|
||||
#print roomCheapest
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user