I have a pyspark dataframe that looks like this:
+-------------+
|list|
+-------------+
|1,1,1,1
+-------------+
|New,Upgrade,Old
+-------------+
How can I generate a field that counts the elements separated by commas? The ideal dataframe looks like this:
+---------------+-----------
|list |count
+----------------+----------
|1,1,1,1 | 4
+----------------+--------
|New,Upgrade,Old | 3
+----------------+-------