如何将spark数据帧保存为tfrecords格式我尝试过,但给出了错误



我正试图将我的spark数据帧保存为tfrecords格式,但出现了错误。

这是我的命令,

df.write.format("tfrecords").mode("overwrite").save()

错误消息:

Py4JJavaError: An error occurred while calling o1095.save.
: java.lang.ClassNotFoundException: Failed to find data source: tfrecords. Please find packages at http://spark.apache.org/third-party-projects.html

spark版本2.4.5

您需要确保使用spark-tfrecordJAR运行Spark Job。GitHub存储库提供了一些关于如何做到这一点的说明。