You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by jane thorpe <ja...@aol.com.INVALID> on 2020/04/05 03:33:42 UTC

(float(9)/5)*x + 32) when x = 12.8

PLATFORM
zeppelin 0.9  
SPARK_HOME = spark-3.0.0-preview2-bin-hadoop2.7

%spark.ipyspark

# work around
sc.setJobGroup("a","b")
tempc = sc.parallelize([12.8])
tempf = tempc.map(lambda x: (float(9)/5)*x + 32)
tempf.collect()

OUTPUT 
[55.040000000000006] 
 
%spark.ipyspark

# work around
sc.setJobGroup("a","b")
tempc = sc.parallelize([38.4,19.2,13.8,9.6])
tempf = tempc.map(lambda x: (float(9)/5)*x + 32)
tempf.collect()
OUTPUT :
[101.12, 66.56, 56.84, 49.28]
calculator  result =  55.04 

Is the answer correct  when x =  12.8  ?

 
jane thorpe
janethorpe1@aol.com