Extracts timestamp from a given text/string using this package
Project description
datetime_extractor
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
Example1
from datetime-extractor import DateTimeExtractor
import pandas as pd
samplestring = 'scala> val xorder= new order(1,"2016-02-22 00:00:00.00",100,"COMPLETED")'
DateTimeExtractor(samplestring)
Out: ['2016-02-22 00:00:00.00']
Example2
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['ExtractedTimestamp'] = data['textcolumn'].apply(lambda x: DateTimeExtractor(x))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for datetime_extractor-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8334bbbb769145fd2bb5c5c4faca59bb3881ea6a919513cb3e51c6f35a040dd7 |
|
MD5 | 77cb4b491f0afb4b30cc6f62c153b5be |
|
BLAKE2b-256 | 7a937317bbe9403351ef494fc2408ca14184575a4aa0ab3c8e67c5aeadc9baf6 |