我在Zeppelin 0.7笔记本中使用Spark 2和Scala 2.11。我有一个数据帧,我可以这样打印:
dfLemma.select("text", "lemma").show(20,false)
,输出如下:
+---------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|text |lemma |
+---------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|RT @Dope_Promo: When you and your crew beat your high scores on FUGLY FROG https://time.com/Sxp3Onz1w8 |[rt, @dope_promo, :, when, you, and, you, crew, beat, you, high, score, on, FUGLY, FROG, https://time.com/sxp3onz1w8] |
|RT @axolROSE: Did yall just call Kermit the frog a lizard? https://time.com/wDAEAEr1Ay |[rt, @axolrose, :, do, yall, just, call, Kermit, the, frog, a, lizard, ?, https://time.com/wdaeaer1ay] |
我试图通过以下方式在Zeppelin中使输出更好:
val printcols= dfLemma.select("text", "lemma")
println("%table " + printcols)
给出了这个输出:
printcols: org.apache.spark.sql.DataFrame = [text: string, lemma: array<string>]
和一个新的空白的Zeppelin段落为
[text: string, lemma: array]
有没有办法让数据框显示为格式良好的表格? TIA!