• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Pyspark Conditional statement

Resolved: Pyspark Conditional statement

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

Below is the input dataframe.
I want to perfrom the below based on the flag column
If the flag column is 1, I will do the below.
If the flag column is 2, I will do the below.
Below is the code Im using.
When I use the above, I am getting syntax error. Is there any other way I can achieve this using the pyspark conditional statements.
Thank you.

Answer:

Possible duplicate of this question.
You need to use when with (or without) otherwise from pyspark.sql.functions.
OR

If you have better answer, please add a comment about this, thank you!

apache-spark if-statement pyspark python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Azuer Service Bus SDK not receiving the specified messages

01/04/2023

Resolved: how to change date format from 201904 to Apr-19 in excel

01/04/2023

Resolved: Iterator for custom Hashtable C#

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.