Problem found in Regular Expression Basics mission 7

I lost a lot of time on this one…takeaway is to look at the solution sooner.
I do most of my work in Jupyter and then transfer to the console.

The directions are to use a regex pattern to count frequency of tags.

Here is the solution from the course:
pattern = r’[(\w+)]'
tag_freq = titles.str.extract(pattern).value_counts()
This doesn’t work because str.extract returns a dataframe and value_counts() doesn’t work on a dataframe.

Here is the solution that works in Jupiter (which causes an error in the DQ console):

tag_freq = titles.str.extract(pattern).iloc[:,0].value_counts()

I think this is an unfortunate example of sloppiness on the part of the course, all solutions should be checked outside of their java console.

1 Like

Hi there @rlatta, welcome to the community!!

This issue was actually brought up by another learner only recently! It was addressed here:

What it comes down to is that DQ’s platform runs Pandas version 0.22.0, whereas the Pandas version you were using locally was 0.23.0, where the expand parameter is set to True by default - hence why you were getting a Dataframe object. You could confirm this by setting the expand parameter to False, and then checking whether DQ’s solution works for you locally after that.

1 Like

Thank you @blueberrypudding85 (may I call you puddin?).
I hope they add that to the FAQ for affected projects.


Sure, I could get used to that!

Yep, I definitely intend to forward that suggestion to Dataquest staff, especially since this has already been brought up before.

1 Like

yeah, second that. hit the same problem too :weary: