问题:在 docer 图像 jupyter lab 上运行相同的代码,但如果我在本地启动 jupyter lab 并尝试运行相同的代码:
寻求帮助:如何在本地jupyter实验室执行代码并得到结果。
enter code here
from pyspark.sql.types import StructType, StructField, FloatType,
BooleanType
from pyspark.sql.types import DoubleType, IntegerType, StringType
import pyspark
from pyspark import SQLContext
conf = pyspark.SparkConf()
sc = pyspark.SparkContext.getOrCreate(conf=conf)
sqlcontext = SQLContext(sc)
schema = StructType([
StructField("sales", IntegerType(),True),
StructField("sales person", StringType(),True)
])
data = ([(10, 'Walker'),
( 20, 'Stepher')
])
df=sqlcontext.createDataFrame(data,schema=schema)
df.show()