【发布时间】:2020-07-01 18:22:14
【问题描述】:
我正在使用 Python 2.6.6 和 Spark 1.6.0。我有df 这样的:
id | name | number |
--------------------------
1 | joe | 148590 |
2 | bob | 148590 |
2 | steve | 279109 |
3 | sue | 382901 |
3 | linda | 148590 |
每当我尝试运行类似
df2 = df.groupBy('id','length','type').pivot('id').agg(collect_list('name')),我收到以下错误
pyspark.sql.utils.AnalysisException: u'undefined function collect_list;'这是为什么呢?
我也试过:
hive_context = HiveContext(sc)
df2 = df.groupBy('id','length','type').pivot('id').agg(hive_context.collect_list('name')) 并得到错误:
AttributeError: 'HiveContext' object has no attribute 'collect_list'
【问题讨论】:
标签: python dataframe apache-spark pyspark