👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
I have a dataframe with column as String. I wanted to change the column type to Double type in PySpark.
Following is the way, I did:
toDoublefunc = UserDefinedFunction(lambda x: x,DoubleType())
changedTypedf = joindf.withColumn("label",toDoublefunc(joindf["show"]))
Just wanted to know, is this the right way to do it as while running through Logistic Regression, I am getting some error, so I wonder, is this the reason for the trouble.
👻 Read also: what is the best laptop for engineering students?
We hope this article has helped you to resolve the problem. Apart from How to change a dataframe column from String type to Double type in PySpark?, check other code Python module-related topics.
Want to excel in Python? See our review of the best Python online courses 2023. If you are interested in Data Science, check also how to learn programming in R.
By the way, this material is also available in other languages:
- Italiano How to change a dataframe column from String type to Double type in PySpark?
- Deutsch How to change a dataframe column from String type to Double type in PySpark?
- Français How to change a dataframe column from String type to Double type in PySpark?
- Español How to change a dataframe column from String type to Double type in PySpark?
- Türk How to change a dataframe column from String type to Double type in PySpark?
- Русский How to change a dataframe column from String type to Double type in PySpark?
- Português How to change a dataframe column from String type to Double type in PySpark?
- Polski How to change a dataframe column from String type to Double type in PySpark?
- Nederlandse How to change a dataframe column from String type to Double type in PySpark?
- 中文 How to change a dataframe column from String type to Double type in PySpark?
- 한국어 How to change a dataframe column from String type to Double type in PySpark?
- 日本語 How to change a dataframe column from String type to Double type in PySpark?
- हिन्दी How to change a dataframe column from String type to Double type in PySpark?
Milan | 2023-03-21
Maybe there are another answers? What How to change a dataframe column from String type to Double type in PySpark? exactly means?. I just hope that will not emerge anymore
London | 2023-03-21
Maybe there are another answers? What How to change a dataframe column from String type to Double type in PySpark? exactly means?. Will use it in my bachelor thesis
Moscow | 2023-03-21
Simply put and clear. Thank you for sharing. How to change a dataframe column from String type to Double type in PySpark? and other issues with re Python module was always my weak point 😁. I just hope that will not emerge anymore