what’s the best way to find spaces in column values?

You can replace the white spaces with '' then continue with split-explode-value_counts, or you can also use get_dummies:

s.str.replace('\s+', '').str.get_dummies(',').sum()

Output:

a    36
b    49
c    35
d    15
e     9
f    13
g    18
h     5
i     1
j     1
k     4
l     5
m     2
n     5
o    13
dtype: int64

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top