Python Forum
df and regex, NaN and df.concat
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
df and regex, NaN and df.concat
#3
here is nice site to test your regex patterns.
https://regex101.com/

you will see that your patterns do not match anything.
here is first pattern with some changes
https://regex101.com/r/dER5xH/1

note that using named groups could help and will make your code more readble
Actually, because you just want the year, pattern can be updated to catch all possible cases from your example
r"199\d{1}|20\d{2}|\d{2}(?![/,\-\w ])"
https://regex101.com/r/naVdDj/1
if you wish you may add named group, as is the entire match is what you need
Reply


Messages In This Thread
df and regex, NaN and df.concat - by metalray - Jan-04-2018, 10:04 AM
RE: df and regex, NaN and df.concat - by metalray - Jan-05-2018, 09:30 AM
RE: df and regex, NaN and df.concat - by buran - Jan-05-2018, 09:58 AM
RE: df and regex, NaN and df.concat - by metalray - Jan-10-2018, 09:29 AM
RE: df and regex, NaN and df.concat - by buran - Jan-10-2018, 07:02 PM
RE: df and regex, NaN and df.concat - by metalray - Jan-22-2018, 03:12 PM
RE: df and regex, NaN and df.concat - by buran - Jan-22-2018, 04:37 PM
RE: df and regex, NaN and df.concat - by metalray - Feb-06-2018, 03:11 PM
RE: df and regex, NaN and df.concat - by buran - Feb-06-2018, 03:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  concat two list based on array MeeranRizvi 9 7,635 Jan-03-2017, 06:28 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020