Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Extracts timestamp from a given text/string

Project description


The main intent of this project is to extract mostly all possible timestamps from a given string where date and time written together. It extracts timestaamps in a string format. Later one can convert extracted timestamp to python timestamp using pandas datetime package.

How to install the package

	pip install datetime-extractor


  from datetime_extractor import DateTimeExtractor

  import pandas as pd
  import re

  samplestring = 'scala> val xorder= new order(1,"2016-02-22 00:00:00.00",100,"COMPLETED")'


  Out: ['2016-02-22 00:00:00.00']


Suppose if one has a dataframe with text column where timestamps written, the above function can be used to create a new column with extracted timestamp strings. One can use below command in this case

  data = pd.read_csv('sampledata.csv')
  data['textcolumn'] = data['textcolumn'].fillna('')

  data['ExtractedTimestamp'] = data['textcolumn'].apply(lambda x: DateTimeExtractor(str(x)))

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for datetime-extractor, version 0.5
Filename, size File type Python version Upload date Hashes
Filename, size datetime_extractor-0.5.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page