我有一個數據框,其中包含有關鄰里,房產類型,談判類型和價格的房地產信息??雌饋硐襁@樣:**neighborhood type_property type_negotiation price**Smallville house rent 2000Oakville apartment for sale 100000King Bay house for sale 250000 . .我想做的是通過一個函數,該函數按我進入的鄰域對數據框進行排序,如果是房屋,如果要出售,則要滿足這些要求的屬性數量,并給出第90個百分位數和第10個百分位數百分位。到目前為止,我擁有的功能和代碼如下,但我不斷遇到多種語法和其他錯誤:def function(string): a = df[(df.type_negotiation == 'for sale')&(df.type_property == 'house')&(df.neighborhood == string) b = pd.new_df([a.price.quantile(.10),a.price.quantile(.90),a.shape], columns=('tenthpercentile','ninetiethpercentile','Quantity')) return b謝謝您事先的幫助。
添加回答
舉報
0/150
提交
取消