I am in need of some guidance and/or help! I have a dataframe that has a unique observation for each row. There is a variable that has THE APPEARANCE of nested lists as the observation but is actually a string.
For example:
Var1
[X, Y, [Z, A, B]]
[A, [R,S,T]]
[B]
What I need is to append a variable/series that has the count of the number of items within that list. So for example:
Var2:
5
4
1
The values are strings and I need a count not a sum. That the lists are nested is irrelevant, each item separated by a comma is considered 1 count.
Thanks so much! I don't know if I'm searching the wrong terms, but any time I do a length statement (whether I use for loops or not), I get the length of characters, not the length of items.
ETA: Realized that it's actually a string for the observations.