Commit 743ad657 authored by 高雅喆's avatar 高雅喆

update

parent 9cd86509
...@@ -101,7 +101,8 @@ print(result.take(10)) ...@@ -101,7 +101,8 @@ print(result.take(10))
result1 = result.map( result1 = result.map(
lambda x: (str(x[0]), str(x[1]), str(x[2])) lambda x: (str(x[0]), str(x[1]), str(x[2]))
) )
spark.createDataFrame(result1).toDF("device", "search_words", "user_portrait").coalesce(1).write.format('com.databricks.spark.csv').save("~/test_df.csv", header='true') df = spark.createDataFrame(result1).toDF("device", "search_words", "user_portrait").toPandas()
df.to_csv("~/test_df.csv", index=False)
# path = "hdfs:///strategy/esmm/" # path = "hdfs:///strategy/esmm/"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment