pyspark在ipython笔记本中将数据帧显示为具有水平滚动的表 [英] pyspark show dataframe as table with horizontal scroll in ipython notebook
本文介绍了pyspark在ipython笔记本中将数据帧显示为具有水平滚动的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
a pyspark.sql.DataFrame
显示凌乱的 DataFrame.show()
- 换行而不是滚动。
a pyspark.sql.DataFrame
displays messy with DataFrame.show()
- lines wrap instead of a scroll.
但显示 pandas.DataFrame.head
but displays with pandas.DataFrame.head
我试过这些选项
import IPython
IPython.auto_scroll_threshold = 9999
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
from IPython.display import display
但不是运气。虽然在Atom编辑器中使用jupyter插件时滚动有效:
but no luck. Although the scroll works when used within Atom editor with jupyter plugin:
推荐答案
这是一种解决方法
spark_df.limit(5).toPandas().head()
虽然,我不知道这个查询的计算负担。我在想 limit()
并不贵。更正欢迎。
although, I do not know the computational burden of this query. I am thinking limit()
is not expensive. corrections welcome.
这篇关于pyspark在ipython笔记本中将数据帧显示为具有水平滚动的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文