Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
75 views

I use the following to write CSV lines in a loop while running sensor instrumentation, and I want to read them back in for post-processing without pandas. I would like to use the imported data to ...
onix's user avatar
  • 3
1 vote
1 answer
59 views

I have a Python numpy.ndarray of seconds of the day with a bunch of decimal seconds: import numpy as np sec = [40389.66574375, 40390.12063928, 40391.32714992, 40392.64457077, 40393.48519607, 40394....
Swawa's user avatar
  • 273
7 votes
2 answers
190 views

I am puzzled by an inconsistency when calling .strftime() for dates which are pre-1000 AD, using Python's datetime module. Take the following example: import datetime old_date = datetime.date(year=33, ...
Melipone's user avatar
  • 730
2 votes
1 answer
73 views

A little example: $ python Python 3.13.2 (main, Feb 5 2025, 08:05:21) [GCC 14.2.1 20250128] on linux Type "help", "copyright", "credits" or "license" for more ...
ctmbl's user avatar
  • 23
3 votes
1 answer
81 views

I'm attempting to parse HTML time strings in Python: from datetime import datetime input = "2025-03-24T07:01:53+00:00" output = datetime.strptime(input, "%Y-%m-%d%X%:z") print(...
The-Coder-Who-Knew-Too-Little's user avatar
0 votes
1 answer
59 views

In the following code datetime.strptime() is blocking asyncio.Queue.get() operation import time import asyncio from datetime import datetime from functools import partial def write(queue): data =...
Dinesh's user avatar
  • 1,886
0 votes
0 answers
91 views

I am trying to use pyqtgraphs DateAxisItem for relative times on the x axis, i.e., durations (which can be between a few hours and several days). I know I could simply use an ordinary AxisItem and ...
emma's user avatar
  • 337
0 votes
1 answer
70 views

Input (New York Time in string format) = '2024-11-01 13:00:00' Output (UTC Time in string format) = '2024-11-01 17:00:00'
Alpha Warrior's user avatar
2 votes
2 answers
156 views

I am trying to determine whether a given date string includes all three components: day, month, and year. Example Inputs and Expected Outputs: "2025-01-01" → True (All components are ...
Chinmai Veera's user avatar
0 votes
1 answer
64 views

I have a machine running some scripts that I need to keep an eye on. I have set up a script in python to send me emails using every hour. I would like to add timestamp to it so that I can see at a ...
excelman's user avatar
  • 439
0 votes
1 answer
112 views

When I use .shift() from Pandas on a column in a DataFrame with a date index, I can use it, for example, with .corr(), but I cannot update my old DataFrame or create a new one. Dataset My df looks ...
Mihuu's user avatar
  • 1
1 vote
2 answers
109 views

I'm doing some datetime math in python with the pytz library (although I'm open to using other libraries if necessary). I have an iterator that needs to increase by one day for each iteration of the ...
Pwnosaurus's user avatar
  • 2,206
-1 votes
1 answer
358 views

I have a df datetime column that I want to convert from Europe/Copenhgaen t.z to UTC but I just keep getting duplicate entries in the UTC column. The reason this happens is because of how I make my ...
Tom's user avatar
  • 115
1 vote
1 answer
66 views

I need to plot some patches which requires me to use the matplotlib mdate module (ideally) to have control over the tick markers. I have used mdates before and I can't for the life of me figure out ...
Yolkions's user avatar
  • 111
0 votes
1 answer
58 views

I'm connecting to an API that returns a list of articles, each article has created_at and modified_at properties. I want to return the difference (in hours) between the created_at and modified_at ...
Katie's user avatar
  • 9
0 votes
1 answer
49 views

Input: import pytz from datetime import datetime as dt targettz = pytz.timezone('America/New_York') d1 = dt(2024, 1, 1, 7, 40, 0, tzinfo=targettz) d1.isoformat() Output: '2024-01-01T07:40:00-04:56' ...
Anthony's user avatar
  • 12.9k
2 votes
1 answer
829 views

I'm trying to format a datetime object in Python using either the strftime method or an f-string. I would like to include the time zone offset from UTC with a colon between the hour and minute. ...
E_Cross's user avatar
  • 43
-2 votes
1 answer
47 views

I am fairly new to programming and to practice I decided to make a program to calculate how many days you have been alive and then convert that into how many hours you have been alive. However, I have ...
Joseph Lewis's user avatar
0 votes
2 answers
63 views

In python 3.9: datetime.datetime respects tzinfo but datetime.time does not appear to. import datetime from zoneinfo import ZoneInfo dta = datetime.datetime.now(tz=ZoneInfo("America/Los_Angeles&...
Nmhor Kmhor's user avatar
0 votes
1 answer
53 views

I am trying to store temporal data in mongodb with the use of mongoengine. As the date of the data is a primary component, I thought it would be best to map the data to the date. However, when ...
linkey apiacess's user avatar
2 votes
0 answers
93 views

In python I like the datetime module of the standard library to parse timestamps. However, some of the format codes depend on the locale set for the machine where it's run, which makes the code ...
Thrastylon's user avatar
  • 1,000
0 votes
1 answer
38 views

I Would like to Compare the Nasdaq's Monday's daily performance with the PREVIOUS Friday's performance, if they are the same record event in a counter. I create a column that specifies if Nasdaq went ...
Patrizio's user avatar
0 votes
3 answers
94 views

I am trying to parse a date string like this: import datetime document_updated_on = '01-Feb-2024#15:22 WET' format_str = "%d-%b-%Y#%H:%M %Z" updated_on_date = datetime.datetime.strptime(...
Tino's user avatar
  • 65
-3 votes
1 answer
45 views

I'm working on a local program in which I want the first day of the given number of year like(Monday, Tuesday etc). How can I have it? firstly I try datetime module for this purpose but it gives ...
M Behzad Nawaz's user avatar
0 votes
0 answers
178 views

The time_machine module in python keeps setting a time that is one day earlier than the date that I set. I must be missing something obvious! Here's an example of a simple program showing the ...
l'anonyme's user avatar
0 votes
1 answer
40 views

There is currently (version 1.1.0) no python datatable.time.week() or datatable.time.day_of_year() functions. Here is some example data: from datetime import date import datatable as dt DT = dt.Frame({...
makeyourownmaker's user avatar
0 votes
1 answer
73 views

I have data on frequencies (N), for combinations of [from, to, subset], and the month. Importantly, when N=0, the row is missing. N from to subset month ...
FooBar's user avatar
  • 16.7k
1 vote
0 answers
31 views

When trying to convert the "Date" field of a pandas DataFrame using pd.to_datetime(), I get an "OutOfBoundsDatetime" error only when the date is before Year 1700 (otherwise the ...
el_pazzu's user avatar
  • 436
0 votes
1 answer
55 views

I have a folder directory (shown below) that contains folders titled "year-month." They will be continuously added over time. I am trying to write a python code that selects any files in ...
George Bunkall's user avatar
1 vote
1 answer
105 views

I am trying to set the number of tick marks for both the x and y axis to 12. However, only the y axis is being set and the x axis stays the same. I am using the locator_params to set both axis. plt....
jmthompson32's user avatar
1 vote
2 answers
219 views

I am working with a set of monthly averaged time-series data that spans 20+ years and have put the data into a pandas dataframe. The index of the dataframe is composed of the datetime objects that ...
jrmact's user avatar
  • 23
0 votes
2 answers
59 views

I have a simple function get_start_of_period which takes in a date and returns the start of that period. It looks as follows: import datetime as dt from dateutil.relativedelta import relativedelta ...
bhub's user avatar
  • 149
0 votes
1 answer
366 views

I would like to ask for little support. I have here a python frame containing data giving in UTC format. I would like to transform the column into date-format. Order Date 15-Feb-2024 UTC 17-Feb-2024 ...
SMS's user avatar
  • 402
0 votes
2 answers
116 views

I'm trying to figure out how to find the first market day of each month and to wait until each of those days after running some logic. I've figured out some of the code to be able to do this, but I ...
Michael P's user avatar
3 votes
1 answer
79 views

With a dataframe that has a datetime index, I am used to getting data for quarters with the syntax eg. df.loc["2014-Q1"] to grab the data for the first quarter of 2014 (Jan, Feb, Mar). This ...
Someone1348's user avatar
0 votes
1 answer
165 views

This code iterates through an excel spreadsheet and finds a specific column where energy is zero, then calculates the duration of that zero-energy-value period by calculating difference between first &...
Stt24's user avatar
  • 1
0 votes
1 answer
58 views

For testing purposes, I have deployed the following Firebase Cloud Function. When the function gets called, it adds a document to my Firestore collection with two fields containing two datetimes. @...
jaakdentrekhaak's user avatar
0 votes
1 answer
224 views

When attempting to get a time using mktime, I get a overflow exception. This occurs on a Debian docker image, but not on my host machine: docker pull python:3.9.7 https://hub.docker.com/layers/...
SomeGuy's user avatar
  • 61
3 votes
1 answer
2k views

I need the current timestamp in EST but the current_timestamp() is returning PST. Tried the following code but it's not working and showing 6 hours before EST time: # Import the current_timestamp ...
newbie's user avatar
  • 55
1 vote
0 answers
761 views

i have raw date = March 5, 2024, 5:33 a.m. is it possible to convert it in datetime.datetime(2024, 3, 5, 5, 33) using python I have tried from datetime import datetime date_string = "March 5, ...
kishan Kumar's user avatar
-1 votes
1 answer
65 views

I was trying to caltculate the date using datetime module, but when I entered 1 in define dates it showed me: 41 days, 0:00:00 Traceback (most recent call last): File "", line 22, in <...
Ptalemon's user avatar
0 votes
2 answers
89 views

I have a dict with hourly measurement data where some entries are missing (gaps). My current approach is to create a dataframe with an hourly datetime index and prefilled with NaN. Then replace the ...
monok's user avatar
  • 585
0 votes
0 answers
33 views

ValueError: time data "44033" doesn't match format "%d/%m/%Y", at position 0. You might want to try: - passing format if your strings have a consistent format; - passing format='...
Akshat Poladia's user avatar
0 votes
1 answer
25 views

I have few data as follows: 0.907752 0.916137 0.923206 0.919096 0.928631 ........ 0.922548 and I want to do is to insert year ,month, date and time in the data as follows: 2012-12-01 00:00:00 0.907753 ...
pranjal's user avatar
7 votes
2 answers
2k views

I am running a script that uses pd.to_datetime() on inputs that are sometime not able to be parsed. For example if I try to run pd.to_datetime('yesterday') it results to an error DateParseError: ...
kosnik's user avatar
  • 2,474
0 votes
2 answers
84 views

I am trying to create a plot using time in the hour:min format on the x-axis and some values on the y-axis. The data on the x-axis is built using the datetime.datetime method. However, the figure ...
Ivan Castro's user avatar
0 votes
1 answer
153 views

I am trying to get the local time without the application of daylight savings time. I know that I can get the local time with the following, but when my location is in DST I get an extra hour. I want ...
orsapihki wiioiv's user avatar
2 votes
1 answer
644 views

Summary Inserting datetime with timezone object into postgres column without timezone appears to first convert to a local timestamp and then removes the offset. Eg for 2024-01-15 19:04:38.921936+00:00 ...
Heath's user avatar
  • 148
0 votes
1 answer
708 views

Hi im new in programming in python with datetime (and in general to be honest). So im doing a project where I need to check if the user is more than 18 years old. I used timedelta to get the ...
BrunoRoda's user avatar
5 votes
1 answer
200 views

I am using pandas version 1.0.5 The example dataframe below lists time intervals, recorded over three days, and I seek where some time intervals overlap every day. For example, one of the overlapping ...
usr_lal123's user avatar

1
2 3 4 5
39