Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
Problema de declaración de caso en Pyspark

Actualmente estoy escribiendo este código en Pyspark, pero recibo errores y sé que está mal, pero no estoy seguro de cómo solucionarlo. Estoy tratando de decir que si 1 entonces quiero usar una columna determinada con el valor dentro de ella, si 2 esta otra columna con el valor dentro de ella y así sucesivamente.

 ABC_SCHED = ABC_SCHED.withColumn("ABC123", F.when(F.col("MINS_TRA" == "1"), ABC_SCHED.T1_0to30) .when(F.col("MINS_TRA" == "2"), ABC_SCHED.T2_31to60) .when(F.col("MINS_TRA" == "3"), ABC_SCHED.T3_61to90) .when(F.col("MINS_TRA" == "4"), ABC_SCHED.T4_91to120) .when(F.col("MINS_TRA" == "5"), ABC_SCHED.T4_120ORMORE) .otherwise(F.lit(None)) )
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

¡Encontré la respuesta! Solo tenía paréntesis en los lugares equivocados.

 ABC_SCHED = ABC_SCHED.withColumn("ABC123", F.when((F.col("MINS_TRA") == "1"), ABC_SCHED.T1_0to30) .when((F.col("MINS_TRA") == "2"), ABC_SCHED.T2_31to60) .when((F.col("MINS_TRA") == "3"), ABC_SCHED.T3_61to90) .when((F.col("MINS_TRA") == "4"), ABC_SCHED.T4_91to120) .when((F.col("MINS_TRA") == "5"), ABC_SCHED.T5_120ORMORE) .otherwise(F.lit(None)) )
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!