Hey all! I am really confounded by this and can use your help. This is based on the capturing groups section in the Regular Expression Basics unit.
I typically take what I learn and basically reproduce it in a Jupyter notebook. This is almost never an issue. However, I am having an issue and can’t figure it out. The code works in the DataQuest GUI, but not in Jupyter.
This is what is running in DataQuest, but not in Jupyter:
import pandas as pd
hn=pd.read_csv(‘hacker_news.csv’)
titles=hn[‘title’]
pattern = r"\[(\w+)\]"
tag_freq=titles.str.extract(pattern).value_counts()
When I run this in Jupyter, I keep getting:
AttributeError: ‘Dataframe’ object has no attribute ‘value_counts’
In Jupyter, I verified that title is recognized as a series object. So, I know it’s not that.
I feel like I am missing something really obvious.
Thanks for your help!