Skip to content

Instantly share code, notes, and snippets.

@1ambda
Created December 20, 2021 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1ambda/8e99398b8dcc496fb721fe2dff1f20b0 to your computer and use it in GitHub Desktop.
Save 1ambda/8e99398b8dcc496fb721fe2dff1f20b0 to your computer and use it in GitHub Desktop.
# 컬럼을 선택하고 이름을 변경합니다.
# SQL 의 SELECT 'ID' as id, 'Year_Birth' as 'year_birth'... 과 동일합니다.
dfSelected = df.select(
col("ID").alias("id"),
col("Year_Birth").alias("year_birth"),
col("Education").alias("education"),
col("Kidhome").alias("count_kid"),
col("Teenhome").alias("count_teen"),
col("Dt_Customer").alias("date_customer"),
col("Recency").alias("days_last_login")
)
dfSelected.count()
dfSelected.printSchema()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment