代码如下:
from pyspark import *
from pyspark.sql import *
spark=SparkContext()
sc=SQLContext(spark)
valuesA = [('Pirate',1),('Monkey',2),('Ninja',3),('Spaghetti',4)]
TableA = sc.createDataFrame(valuesA,['name','id'])
valuesB = [('Rutabaga',1),('Pirate',2),('Ninja',3),('Darth Vader',4)]
TableB = sc.createDataFrame(valuesB,['name','id'])
TableA.describe('name').show()
错误如下:
---------------------------------------------------------------------------
Py4JJavaError Traceback (most recent call last)
<ipython-input-11-dcdbe2628b72> in <module>
1 TableA.describe('name').show()
答案 0 :(得分:-1)
请尝试使用如下描述函数:
TableA.describe(['name']).show()