date parser python code example

Example 1: date parser python pandas

mydateparser = lambda x: pd.datetime.strptime(x, "%Y %m %d %H:%M:%S")
df = pd.read_csv("file.csv", sep='\t', names=['date_column', 'other_column'], parse_dates=['date_column'], date_parser=mydateparser)

Example 2: pyton recognize any datetime format

import datefinder
string_value = " created 01/15/2005 by ACME inc.and associates.January 4th,2017 at 8pm"
matches = datefinder.find_dates(string_value)            
for match in matches:
    print("match found ",match)

Example 3: date parser python pandas

format='%d%m%Y'