369-8 Advanced Regular Expression

Hi Community,

I’m getting an error on my Jupyter Notebook and can’t figure out why.

value_counts is a Series method rather than a DataFrame method and you are trying to use it on a DataFrame. You need to perform this on a specific column:


It doesn’t usually make sense to perform value_counts on a DataFrame, though you could apply it to every entry by flattening the underlying values array:


From here.

Additionally, this post details the problem with str.extract() in different versions of Pandas. A simple fix is to set the expand parameter as False so that it returns a Series instead of a Dataframe.


This is the second time I’m wowed! Thanks a million… I’m getting better solutions here than on Stack Overflow. You guys are awesome!!!