0

How to calculate a house prices python for data scientist

import numpy as np data = np.array([150000, 125000, 320000, 540000, 200000, 120000, 160000, 230000, 280000, 290000, 300000, 500000, 420000, 100000, 150000, 280000]) m = np.mean(data) s = np.std(data) low = m-s high = m+s print( len(data[(low < data) & (data < high)]) / len(data) *100 )

3rd Jul 2022, 3:36 PM
Élie RUGAGI ISMAEL
Élie RUGAGI ISMAEL - avatar
2 odpowiedzi
0
I haven't even properly started this course yet. So have you found out your solution? I am not sure but from what I understand, you are wanting to display the ratio of the number of houses with prices in the mean range to num of all the houses? you could instead do a count maybe? c = 0 for val in data: if low < val < high: c += 1 print(c/len(data)) If this has absolutely nothing with what you're asking, I am sorry. I just want to know the answer to this as well. (No one's answered, and he's shared his code?) https://code.sololearn.com/c0ncuROZN6Z7/?ref=app The result turned out to be same as yours.
6th Jul 2022, 2:39 AM
Korkunç el Gato
Korkunç el Gato - avatar
0
I think your code do work?
22nd Jul 2022, 10:13 AM
G.C.