你好,
我將使用approxQuantile()函數和填充列表,我做了,但不知怎麼的,每當我試圖運行代碼的列表是空的,沒有任何價值。
編寫代碼如下:
@dlt。表(name = " customer_order_silver_v2) def capping_unitPrice_Qt (): df = dlt.read (“customer_order_silver”) boundary_unit = (0,0) boundary_qty = (0,0) boundary_unit = df.select(坳(“UnitPrice”)) .approxQuantile (“UnitPrice”, [0.05, 0.95], 0.25) boundary_qty = df.select(坳(“數量”)).approxQuantile(“數量”,[0.05,0.95],0.25)df = df。withColumn (UnitPrice, F.when(坳(UnitPrice) > boundary_unit [1], boundary_unit[1])當(坳(UnitPrice) < boundary_unit [0], boundary_unit [0]) .otherwise(坳(UnitPrice))) df = df。withColumn(‘量’,F.when(坳(數量)> boundary_qty [1], boundary_qty[1])當(坳(數量)< boundary_qty [0], boundary_qty [0]) .otherwise (col(“數量”)))返回df
我得到運行時的輸出如下:
我少了什麼地方?歡迎任何建議或想法。