【问题标题】:how to add **** at the end of each row in a dataframe?如何在数据框中的每一行的末尾添加 ****?
【发布时间】:2021-01-14 10:01:18
【问题描述】:

有没有办法在我的数据框每一行的末尾添加“****”?

例如

detail orientated
marketing and events
community development consultant
leader medical assistant instructor
android developerator project
natural hair care specialist

转向

detail orientated ****
marketing and events ****
community development consultant ****
leader medical assistant instructor ****
android developerator project ****
natural hair care specialist ****

【问题讨论】:

  • 是的,确实有

标签: python apache-spark text pyspark apache-spark-sql


【解决方案1】:

你可以使用concat:

import pyspark.sql.functions as F

df2 = df.withColumn('column1', F.concat('column1', F.lit(' ****')))

【讨论】:

  • 当我在 CSV 上写这篇文章时,所有 **** 都消失了
  • 你在df2上给write.csv打电话了吗?不是df
  • 你检查你的文件路径是否正确?
猜你喜欢
  • 1970-01-01
  • 2012-07-03
  • 2014-05-29
  • 1970-01-01
  • 1970-01-01
  • 2017-04-28
  • 2010-10-10
  • 2011-07-15
  • 1970-01-01
相关资源
最近更新 更多