Skip to content
Advertisement

Tag: datetime

List iteration through JSON array with dates (date format conflict)

I’ve been diving into List Comprehensions, and I’m determined to put it into practice. The below code takes a month and year input to determine the number of business days in the month, minus the public holidays (available at https://www.gov.uk/bank-holidays.json). Additionally, I want to list all public holidays in that month/year, but I’m struck with a date format conflict. TypeError:

Add one day for certain time

I want to update my date column with certain times because some of the dates are not correct. For some reason, they key in the date with time between 00:00 and 7:30 with the day before. For example: Which supposes to be like this: I know I can update all of dates with this code. But I have no idea

Pivot matrix to time-series – Python

I’ve got a dataframe with date as first column and time as the name of the other columns. Date 13:00 14:00 15:00 16:00 … 2022-01-01 B R M M … 2022-01-02 B B B M … 2022-01-03 R B B M … How could I transform that matrix into a datetime time-series? My objective its something like this: Date Data

Is there a bug in Python 3.8 datetime with DST transitions?

I’m trying to convert a timezone-aware datetime in Europe/Sofia to the start of the day in Europe/Sofia, but returning the datetime in UTC. Doing this, I encountered a strange problem: Which prints: The bug happens when subtracting the timedelta or doing the replace(), because the result should be midnight in Europe/Sofia with +2 offset, however we’re seeing an incorrect +3

How would I find the quarterly averages of these monthly figures?

My dataset is similar to the below: How can I add columns to this which show the quarterly figure, which is an average of the preceding three months? Eg, suppose we started at adding a column after ‘Dec-21’ called Q4 2021 which took the average of the columns called ‘Oct-21’, ‘Nov-21’ and ‘Dec-21’. Will I need to create a function

Advertisement