Pyspark: display a spark data frame in a table format

前端 未结 4 1730
粉色の甜心
粉色の甜心 2020-12-25 09:50

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

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

Then when I do

4条回答
  •  爱一瞬间的悲伤
    2020-12-25 10:44

    As mentioned by @Brent in the comment of @maxymoo's answer, you can try

    df.limit(10).toPandas()
    

    to get a prettier table in Jupyter. But this can take some time to run if you are not caching the spark dataframe. Also, .limit() will not keep the order of original spark dataframe.

提交回复
热议问题