Код: Выделить всё
vertices = df1.select(F.explode(F.array('issuer_id_indexed', 'receiver_id_indexed'))) \
.distinct() \
.rdd.map(lambda row: row[0]) # Transform the exploded values into an RDD
# Create an index for each vertex
vertices_with_index = vertices.zipWithIndex().map(lambda x: (x[1], x[0])) # Swap to (index, value)
# Convert the RDD to a DataFrame with column names 'id' and 'node'
vertex_df = vertices_with_index.toDF(["id", "node"])
# Show the resulting DataFrame
vertex_df.show()

Похоже, ошибка возникает, когда я вызываю функцию toDF в моем vertices_with_index, чтобы преобразовать ее из pyspark.rdd.PipelinedRDD< /strong> в кадр данных Spark.
В настоящее время я пытаюсь запустить Pyspark на своем локальном компьютере и безуспешно пробовал выполнить следующие действия, чтобы попытаться устранить эту ошибку:
- Убедился, что мои переменные env верны
- Установил более раннюю версию Java 8
- Увеличил количество ресурсов, переданных Spark.
Подробнее здесь: https://stackoverflow.com/questions/793 ... python-pyt