• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Pyspark:以表格格式显示Spark数据框

用户头像
it1352
帮助1

问题说明

我正在使用pyspark读取如下所示的实木复合地板文件:

I am using pyspark to read a parquet file like below:

my_df = sqlContext.read.parquet('hdfs://myPath/myDB.db/myTable/**')

然后,当我执行my_df.take(5)时,它将显示[Row(...)],而不是像我们使用熊猫数据框时那样的表格式.

Then when I do my_df.take(5), it will show [Row(...)], instead of a table format like when we use the pandas data frame.

是否可以以表格格式(如熊猫数据框)显示数据框?谢谢!

Is it possible to display the data frame in a table format like pandas data frame? Thanks!

正确答案

#1

产生:

 --- --- 
|  k|  v|
 --- --- 
|foo|  1|
|bar|  2|
 --- --- 
only showing top 2 rows

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcgkbfb
系列文章
更多 icon
同类精品
更多 icon
继续加载