Capturing group confusing

pattern = r"([1-2][0-9]{3})"

years= merged["SpecialNotes"].str.extract(pattern, expand=True)

years2= merged["SpecialNotes"].str.extract(pattern)

print(years2.head(10))

print(years.head(10))

I run this code but did not catch any difference. What’s happening here? Anybody out there?

Thanks.

Well, since you’re extracting the same pattern from the same place there shouldn’t be any difference. Can you post the output and maybe a link to the screen?

If you are expecting a difference because of the expand parameter, you won’t see any because the default value for it is True, which means that even if you do no to explicitly set it to True, it will still be True. So years and years2 should be exactly the same.

You can see more about this parameter here.