例如,如果我使用z.show()直接输出表
%pyspark
df = spark.createDataFrame([
(0, 0, "2018-06-03", "2018-06-03"),
(1, 1, "2018-06-04", "2018-06-04"),
(2, 10, "2018-06-03", None),
(4, 1, "2018-06-05", "2018-06-01")])\
.toDF("orderid", "customerid", "product_name", "product_name2")
print("test print string 1")
z.show(df)
z.show(df.describe())
输出很好,就像这个
但是,如果我在输出表之间添加一个字符串
%pyspark
df = spark.createDataFrame([
(0, 0, "2018-06-03", "2018-06-03"),
(1, 1, "2018-06-04", "2018-06-04"),
(2, 10, "2018-06-03", None),
(4, 1, "2018-06-05", "2018-06-01")])\
.toDF("orderid", "customerid", "product_name", "product_name2")
print("test print string 1")
z.show(df)
print("test print string 2") # If I add this
z.show(df.describe())
输出变为此,(没有显示表格)
我想知道,我怎样才能将弦乐和Zeppelin的表格混合在一起?
我认为问题可能是由于字符串导致Zeppelin的表显示格式错误?
答案 0 :(得分:1)
df = spark.createDataFrame([
(0, 0, "2018-06-03", "2018-06-03"),
(1, 1, "2018-06-04", "2018-06-04"),
(2, 10, "2018-06-03", None),
(4, 1, "2018-06-05", "2018-06-01")])\
.toDF("orderid", "customerid", "product_name", "product_name2")
print("test print string 1")
z.show(df)
print("%text test print string 2") # If I add this
z.show(df.describe())