Questions tagged [string-to-datetime]
217 questions
0
votes
1 answer
Pandas DataFrame use Timedelta to set time in H:M:S:f format to 00:00:00:000
I have a pandas DataFrame with the following column (first column = index):
0 14:43:45:921
1 14:43:45:923
2 14:43:45:925
I would like to modify this column, or add another column with the time starting at 0:
0 …

M195
- 21
- 3
0
votes
1 answer
Convert Time and Date in string to date VB.net
I'm using RSS feeds from multiple sources and I'm sorting the feeds by date. However, the dates I receive are in different time zones.
This is the format of some of the date strings that I get:
Wed 08 Dec 2021 01:40:31 -0500
Wed 08 Dec 2021 11:11:19…

Burger Jordaan
- 27
- 4
0
votes
2 answers
How a find an error occurring in rows in dataframe in Python?
df["Dt_Customer"] = pd.to_datetime(df["Dt_Customer"],format='%d-%m-%y')
I have tried to convert the date column, the dataset contains more than 1 million rows... I have to find the date rows which are not getting converted.
TypeError: Unrecognized…

Thiru Balaji G
- 163
- 2
- 10
0
votes
1 answer
How to convert timestamp to pandas to_datetime?
I do realize this has already been addressed here. Nevertheless, I hope this question was different.
I have a dataframe with timestamp with dtype as object.
sample = {"Timestamp" : ["2021-03-19-17.03.19.149168", "2021-02-26-17.03.40.062637",
…

Ailurophile
- 2,552
- 7
- 21
- 46
0
votes
2 answers
Convert string to date and get Day
How to convert string Date to Date?
I have a string "20210712" in the format yyyymmdd how to convert it into date...And how to get the day of It.

S4nj33v
- 299
- 3
- 11
0
votes
5 answers
Getting date from format yyyy_d_m
In SQL Server, I have a column containing a string formatted as yyyy_d_m_(randominteger)_(randominteger)_blahblahblah string.
So
column
2021_28_6_42_blahblahblahblah
2021_8_12_17_4_blahblahblahblah
etc.
I need to retrieve everything…

elboi
- 1
- 2
0
votes
0 answers
Convert string values in Pandas Dateframe to Datetime
I have a dataframe (data) where one column('BEG_DT') is a string representation of a date in the format of YYYYmmdd (example 19490713 = 1949, July, 13).
data[data.columns[0:3]].head()
NCDC BEG_DT END_DT
1 10000001 19490713 …

John S.
- 1
- 1
0
votes
1 answer
Correct fomat of date to parse it
Probably very simple, however I cannot find the right format for parsing dates in a dataframe.
Date to parse: Thu, Apr 1, 2021 (df name: df data, column name: Date )
My attempt:
date_p = pd.to_datetime(nba_data.Date, format = '%a%b%-m%Y')
I am…
0
votes
1 answer
pd.to_datetime wrong format
I have a dataframe df, where I want to set the column 'Time' to a datetimeindex. The column before converting looks like this:
01-10-19 09:05
01-10-19 10:04
01-10-19 11:05
01-10-19 12:04
01-10-19 13:04
...
31-05-20 …

Tijmen Stronks
- 49
- 5
0
votes
0 answers
Pandas: A better/faster way to convert a column of strings to dates and back again?
I need a column of strings, 'yyyymmdd', converted to date so I can do an operation (subtract one day) and then return the format to string. The combined method works in the line below, but seems to take considerably longer than two separate…

Randy Leonard
- 1
- 1
0
votes
1 answer
pd.to_datetime() with spanish locale system
d1 = today.strftime("%b-%y")
print("d1 =", d1)
d1 = ene.-21
But the variable I want to convert in my data set is Jan-21.
My code
data['date_text_DATE'] = pd.to_datetime(data['date_text'], format = '%b-%y')
The error I got:
ValueError: time data…

Karlos Garcia
- 61
- 5
0
votes
1 answer
mongo db: use $gte & $lte to find string dates by inputing only years
I have an object that looks like this:
name:"Aachen"
mass:"21"
year:"1880-01-01T00:00:00.000"
I am trying to use $gte and $lte to find the entries that happened between certain YEARS.
I have tried this: db.collectionName.find({$expr: {$and:…

elisa
- 229
- 1
- 2
- 8
0
votes
1 answer
Date Time Format Trouble
I'm having some troubles with Datetime formats. My database comes with this datetime format:
"2020-11-01T03:17:54Z"
Thing is that I just can't find the format that fits this string in order for me to convert it to a datetime object. I've gone all…

Gustavo Zárate
- 128
- 9
0
votes
1 answer
Using Pandas to reformat dates with inconsistent User inputs
I am trying to clean a spreadsheet of user-inputted data that includes a "birth_date" column. The issue I am having is that the date formating ranges widely between users, including inputs without markers between the date, month, and year. I am…

Reid Haynie
- 1
- 1
0
votes
1 answer
PyMongo - Python List to MongoDB datatype conversion
I am getting json response in string format from requests as below:
results = requests.request("POST", url, data=json.dumps(payload), headers=header).json()['product']
Sample output:
print(results) - object type =
[
{
'id':…

ManiK
- 377
- 1
- 21