【发布时间】:2020-09-03 10:02:01
【问题描述】:
我有一个字符串数据类型的 pysapark 列。但它有正数和负数。如何将它们转换为数字。
总金额 = 交易量 * price_perunit 目前 Volume = String, price_perunit = double 预期输出:
Volume price_perunit total amount
-0.75 100 -75
8 100 800
-0.01 8 -0.08
现在,当我乘法时,我得到以下错误的结果,因为负号不再可用。
Volume price_perunit total amount
-0.75 100 75
8 100 800
-0.01 8 0.08
【问题讨论】: