Created
December 20, 2021 11:27
-
-
Save 1ambda/1ecd1d324316d010b5405834943c350a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dfConverted1 = dfSelected\ | |
withColumn("count_children", coalesce("count_kid", lit(0)) + coalesce("count_teen", lit(0))) | |
dfConverted1\ | |
.select(col("id"), col("count_kid"), col("count_teen"), col("count_children"))\ | |
.limit(5)\ | |
.show() | |
# `show() 출력 결과 | |
+----+---------+----------+--------------+ | |
| id|count_kid|count_teen|count_children| | |
+----+---------+----------+--------------+ | |
|5524| 0| 0| 0| | |
|2174| 1| 1| 2| | |
|4141| 0| 0| 0| | |
|6182| 1| 0| 1| | |
|5324| 1| 0| 1| | |
+----+---------+----------+--------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment