I have a spark dataframe with column (age). I need to write a pyspark script to bucket the dataframe as a range of 10years of age( for ex age 11-20,age 21-30 ,...) and find the count of each age span entries .Need guidance on how to get through this
for ex :
I have the following dataframe
+-----+
|age |
+-----+
| 21|
| 23|
| 35|
| 39|
+-----+
after bucketing (expected)
+-----+------+
|age | count|
+-----+------+
|21-30| 2 |
|31-40| 2 |
+-----+------+