'Pyspark - cast a string to integer with trailing zero return Null
I'm using Pyspark v3 when casting the reference column it gives back null !
+-----------------+
| reference |
+-----------------+
| 012345 |
+-----------------+
Is this a correct behavior or it should be a pyspark issue ? How can we manage the trailing 0s in this case ?
df.select(f.col('reference').cast('integer'))
+-----------------+
| reference |
+-----------------+
| null |
+-----------------+
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
