我有一个有两列的数据帧,我想把它分成两个数组。我知道在Python2中我可以使用:
result = spark.sql("SELECT acoustic_data, time_to_failure from df order by acoustic_data asc")
result_rdd = result.rdd.sample(False, 0.0001).map(lambda row: (row.acoustic_data, row.time_to_failure))
result_signal = result_rdd.filter(lambda (acoustic_data, time_to_failure): acoustic_data).collect()
其他栏目也一样。你知道吗
但如果我现在试着这么做,我会得到一个错误:
TypeError: () missing 1 required positional argument: 'time_to_failure'
结果返回:
所以我想从中提取两个数组。你知道吗
您好
Python 3removed tuple parameter unpacking,所以这不再有效:
替换为如下内容:
相关问题 更多 >
编程相关推荐