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
import re
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['textcolumn'] = data['textcolumn'].fillna('')
data['ExtractedTimestamp'] = data['textcolumn'].apply(lambda x: DateTimeExtractor(str(x)))
Release files for datetime-extractor 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| datetime_extractor-0.5.tar.gz | 2.4 kB | Details |
Release files / datetime_extractor-0.5.tar.gz
| Download URL | datetime_extractor-0.5.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9706118af2c423dc3a23875651fe910a12fedb3fb1f31e44d6177be3e33a6234
|
|
BLAKE2b-256 checksum How to use checksums |
b9666b28056bdb706794db2c1546659d0417d18248b0efaf9b2c10e59efb678e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.7.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|