Capturing dates of a particular format from raw data

Capturing dates of a particular format from raw data

I'm trying to capture dates of the form -

I'm trying to capture dates of the form -

20 Apr 2009

20 April 2009

20 Apr. 2009

20 April, 2009

...from raw text in a pandas dataframe. I want to get rid of rest of the text apart from the dates

I'm been partially successful in my attempt

df['some_column'] = df['some_column'].str.replace(r'(.*?)(\d{1,2}[ ](?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?,?[ ]\d{4})(.*?)\n\1', lambda x: x.groups()[1])

But for some cases I'm getting the preceding/succedding text as well .. Any inputs would be appreciated

regex pandas

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

Python Pandas Objects - Pandas Series and Pandas Dataframe

In this post, we will learn about pandas’ data structures/objects. Pandas provide two type of data structures:- ### Pandas Series Pandas Series is a one dimensional indexed data, which can hold datatypes like integer, string, boolean, float...

How to insert a new row in a Pandas Dataframe? - SaralGyaan

In this Pandas Tutorial, we will learn to insert/add a new row to an existing Pandas Dataframe. We will use pandas.DataFrame.loc, pandas.concat() and numpy.insert(). Using these methods you can add multiple rows/lists to an existing or an empty...

Learning Pandas.Series(Part-7)( Handling NaN/Missing Data in Series)

Handling NaN in Series is Mandatory to learn to start with handling the Missing Data in field of Data Analytics .. Let’s explore the same…

Tutorial: Python Regex (Regular Expressions) for Data Scientists

In this Python regex tutorial, learn how to use regular expressions and the pandas library to manage large data sets during data analysis.

How to Use Regex in Java

In this article, we will learn about Java Regex, and how to use Regex with examples in Java. Java regex is also known as Java Regular Expression.