display, show and to_html doesn't work in iPython notebook

时间:2016-07-11 21:57:25

标签: python apache-spark ipython show

I am trying to display or show()/to_html my dataframes inside an ipython notebook but it is throwing error "AttributeError". Only display(df1) is printing df schema as below:

DataFrame[name: string, age: bigint]

Here is my code:

from IPython.display import display, HTML

data = [('Alice',1),('Bob',2)]
df1 = sqlContext.createDataFrame(data, ['name','age'])
sqlContext.registerDataFrameAsTable(df1, "df1_table")
df2 = sqlContext.sql("Select * from df1_table")

#display(df1)
HTML(df1.to_html)
df1.to_html()

any ideas?

0 个答案:

没有答案