我无法将我的数据框导出到 csv。消息“CSV 数据源不支持数组”
predictions.write.option("delimiter", "\t").csv("/mnt/classification2018/testpredic2")
我尝试了这个命令但连接了,但没有成功
from pyspark.sql.functions import concat_ws
predictions.withColumn("probability", concat_ws(",", "probability")).show()
日志错误
/databricks/spark/python/pyspark/sql/utils.py in deco(*a, **kw)
61 def deco(*a, **kw):
62 try:
---> 63 return f(*a, **kw)
64 except py4j.protocol.Py4JJavaError as e:
65 s = e.java_exception.toString()
/databricks/spark/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
326 raise Py4JJavaError(
327 "An error occurred while calling {0}{1}{2}.\n".
--> 328 format(target_id, ".", name), value)
329 else:
330 raise Py4JError(
Py4JJavaError: An error occurred while calling o1472.csv.
: java.lang.UnsupportedOperationException: CSV data source does not support array<string> data type.
at org.apache.spark.sql.execution.datasources.csv.CSVUtils$.org$apache$spark$sql$execution$datasources$csv$CSVUtils$$verifyType$1(CSVUtils.scala:127)