datetime

How to format datetimes in Power BI for a matplotlib visualization

How to format datetimes in Power BI for a matplotlib visualization Question: I have a problem with the Power BI dataset that I could not resolve in the past month so In the below picture you can see my steps which are numbered. In the first step, you can see my data source which is …

Total answers: 1

Datetime / Unix Date convertor

Datetime / Unix Date convertor Question: I need an input prompt that will allow the user to enter a date at the point the function is called and then run to concert the date to Unix date for an API call later in the program. At the moment every attempt seems to hand back an …

Total answers: 1

How to calculate current time in different timezone correctly in Python

How to calculate current time in different timezone correctly in Python Question: I was trying to calculate the current time in NYC (EST time aka Eastern Daylight time or GMT+4) given current time in Israel (Israel daylight time, currently GMT+3) where I’m currently located. So right now Israel is 7 hrs ahead of NYC, but …

Total answers: 1

Convert string that was originally a `timedelta` back into a `timedelta` object in Python

Convert string that was originally a `timedelta` back into a `timedelta` object in Python Question: I have strings which were originally produced from timedelta objects like so: print(f'{my_delta}’). I have many of these statements logged (e.g. "12:21:00", "1 day, 0:53:00", "2 days, 9:28:00") and I simply want to parse these logged statements to convert back …

Total answers: 3

Select previous row from the given parameters

Select previous row from the given parameters Question: I have a data frame that looks like this: id code date 1 37 2022-01-11 1 22 2021-10-01 1 39 2019-02-11 1 21 2018-10-08 1 17 2018-09-19 1 18 2018-09-10 1 39 2017-03-20 1 36 2017-02-28 1 34 2017-02-14 1 31 2017-01-20 1 21 2016-11-17 1 17 …

Total answers: 1

Python3: Update date format

Python3: Update date format Question: I have a tricky with date format with time series data. In my dataframe of over one hundred thousand rows I have a column datetime with date value but the format is %M:%S.%f. Example: datetime 0 59:57.7 1 00:09.7 2 00:21.8 What I want in output is to convert this …

Total answers: 1

how to calculate time between two datetime in python?

how to calculate time between two datetime in python? Question: I have two datetime as below start=2023/04/05 08:00:00, end=2023/04/05 16:00:00 I want to get time by lTime = start + (end – start) /3 or lTime = (start * 2 + end) /3 I used code as below lTime = start + timedelta(end – start) …

Total answers: 1

Add incrementing seconds to DateTime column Pandas

Add incrementing seconds to DateTime column Pandas Question: I have the following type of df: Date_time Col1 0 2023-03-04 10:30:00 10 1 2023-03-04 10:30:00 11 2 2023-03-04 10:30:00 21 3 2023-03-04 10:30:00 54 4 2023-03-04 10:30:00 12 5 2023-03-04 10:30:00 13 6 2023-03-04 10:30:00 21 … 58 2023-03-04 10:30:00 22 59 2023-03-04 10:30:00 21 60 …

Total answers: 1

How to format different data types to a dd/mm/yyyy format in Python

How to format different data types to a dd/mm/yyyy format in Python Question: I have an code that I want to change all the date column to a format of dd/mm/yyyy. All the values passed in the date column are already in this kind of format, even the second value: 01/02/2001, where I want to …

Total answers: 1

Merge 'Date' and 'Time' columns with specific format into 'Date_Time' column Pandas

Merge 'Date' and 'Time' columns with specific format into 'Date_Time' column Pandas Question: I have a df with Time and Date columns in this specific format. Time Date 213919 220806 220905 220806 225351 220806 4101 220806 12037 220806 The format of Time is: hhmmss The format of Time is a bit strange, the reading must …

Total answers: 2