We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/sbgowtham/pyspark/blame/6426d2fe52acb0366fa70541e21261b5a71e6c5f/delimiter.py#L16
so I have changed the expression like below:
from pyspark.sql.functions import regexp_replace
df = df.withColumn('value', regexp_replace(col('value'), "[,\t|]", ","))
And one more thing is instead of using df.withColumn multiple times use the below code for readability purpose:
df = df.withColumns({ "id": split_col.getItem(0), "name": split_col.getItem(1), "age": split_col.getItem(2), "city": split_col.getItem(3) })
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://github.com/sbgowtham/pyspark/blame/6426d2fe52acb0366fa70541e21261b5a71e6c5f/delimiter.py#L16
so I have changed the expression like below:
from pyspark.sql.functions import regexp_replace
df = df.withColumn('value', regexp_replace(col('value'), "[,\t|]", ","))
And one more thing is instead of using df.withColumn multiple times use the below code for readability purpose:
df = df.withColumns({
"id": split_col.getItem(0),
"name": split_col.getItem(1),
"age": split_col.getItem(2),
"city": split_col.getItem(3)
})
withColumns will work from pyspark 3.3+
The text was updated successfully, but these errors were encountered: