
然后只需
map将RDD(
labelsAndPredictions)的行转换为字符串(CSV的行)即可
rdd.saveAsTextFile()。
def toCSVLine(data): return ','.join(str(d) for d in data)lines = labelsAndPredictions.map(toCSVLine)lines.saveAsTextFile('hdfs://my-node:9000/tmp/labels-and-predictions.csv')欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)