Created
December 20, 2021 11:28
-
-
Save 1ambda/f3704bee6946627a5e42afff7639d3f7 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
educationInvalid = '2n Cycle' | |
educationDefault = 'NONE' | |
# 다음 SQL 구문과 동일합니다. | |
# | |
# SELECT CASE WHEN education = '2n Cycle' THEN 'NONE' ELSE education as education | |
# | |
dfConverted2 = dfConverted1.withColumn( | |
"education", | |
when(col("education") == lit(educationInvalid), educationDefault).otherwise(col("education")) | |
) | |
dfConverted2.select("education").distinct().show() | |
# `show()` 의 출력 결과 | |
+----------+ | |
| education| | |
+----------+ | |
| PhD| | |
| Master| | |
|Graduation| | |
| Basic| | |
| NONE| | |
+----------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment