I have a dataframe and I want to slice all the values of that column but I don't know how to do this?
My DataFrame
+-------------+------+
| studentID|gender|
+-------------+------+
|1901000200 | M|
|1901000500 | M|
|1901000500 | M|
|1901000500 | M|
|1901000500 | M|
+-------------+------+
I have converted the studentID
into string but not able to remove first 190 from it. I want below output.
+-------------+------+
| studentID|gender|
+-------------+------+
| 1000200 | M|
| 1000500 | M|
| 1000500 | M|
| 1000500 | M|
| 1000500 | M|
+-------------+------+
I tried below method but it is giving me error.
students_data = students_data.withColumn('studentID',F.lit(students_data["studentID"][2:]))
TypeError: startPos and length must be the same type. Got <class 'int'> and <class 'NoneType'>, respectively.