22RDataFrame = ROOT.RDF.Experimental.Distributed.Spark.RDataFrame
50sparkconf = pyspark.SparkConf().setAll(
51 {
"spark.app.name":
"distrdf001_spark_connection",
52 "spark.master":
"local[2]",
53 "spark.driver.memory":
"4g"}.items())
55sparkcontext = pyspark.SparkContext(conf=sparkconf)
58df = RDataFrame(1000, sparkcontext=sparkcontext)
61ROOT.gRandom.SetSeed(1)
62df_1 = df.Define(
"gaus",
"gRandom->Gaus(10, 1)").Define(
"exponential",
"gRandom->Exp(10)")
65h_gaus = df_1.Histo1D((
"gaus",
"Normal distribution", 50, 0, 30),
"gaus")
66h_exp = df_1.Histo1D((
"exponential",
"Exponential distribution", 50, 0, 30),
"exponential")
69c = ROOT.TCanvas(
"distrdf001",
"distrdf001", 800, 400)
77c.SaveAs(
"distrdf001_spark_connection.png")
78print(
"Saved figure to distrdf001_spark_connection.png")