pyspark添加列显示其他两列的最小值

时间:2019-09-24 14:11:48

标签: dataframe pyspark

我想创建一个名为“ min”的列,其最小值为“ Expense”和“ Salary”

有什么建议吗?谢谢!

sampleData = [("bob",124000,125000),("mark",100000,108000),("carl",200000,70000),("peter",5000,185000),("jon",124500,65000),("roman",2200,82000),("simon",900000,98000),("eric",140000,144000),("carlos",75000,75000),("henry",120000,110000)]

df = spark.createDataFrame(sampleData, schema=["Name","Expense","Salary"])
df.show()

0 个答案:

没有答案