# Questions tagged [time]

15006 questions

1

votes

1

answer

1.5k

Views

### Schedule time and date to run script

I'm trying to find a package that can do the following in Python:
Add/Remove a specified date and time
Add/Remove it to a scheduler
What I've looked at:
https://docs.python.org/2/library/sched.html
Looks like it only does time, not dates.
https://pypi.python.org/pypi/python-crontab
Does reoccurring...

-3

votes

0

answer

15

Views

### Which algorithm should i used for implementation for below attached screenshot for sales datasets?

I have a sales dataset for which I got the following plot I want to know which machine learning algorithm best suits for it?

0

votes

0

answer

12

Views

### Using Prophet package to forecast by groups and create plot

I am using Prophet package to forecasting in groups in a dataframe, and I want to create plots using the grouped dataframe.
I was following the answers in Using Prophet Package to Predict by Group in Dataframe in R. Are there easier ways to create the plots, compared to how I did it below?
library(d...

1

votes

1

answer

2.2k

Views

### ValueError: freq T not understood. Please report if you think this in error. (seasonal_decompose)

I was trying out seasonal_decompose to decompose my time series. The data is perfect time series with frequency of '2T' i.e. 2 Minutes. From file tsatools.py (site-pkgs\statsmodels\tsa\tsatools.py), in line 655, I added the following.
_ elif freq == 'T':
return 6024752_
I added this from the followi...

0

votes

0

answer

4

Views

### sum of preceding 12 months in R

I am trying to sum rows that are withing last 12 months period.
df

1

votes

2

answer

2.1k

Views

### Is it possible to get the current html5 video timeframe with milliseconds?

I am trying to build a live video captioning editor and require that the JS/DOM returns the current video timeframe with milliseconds. According to the DOM, video.currentTime only returns the value in seconds. Is there anyway to get the value in/with milliseconds?

1

votes

2

answer

1.1k

Views

### Calculate average daily value from large data set with R standard format date/times?

I have a dataframe of approximately 10 million rows spanning about 570 days. After using striptime to convert the dates and times, the data looks like this:
date X1
1 2004-01-01 07:43:00 1.2587
2 2004-01-01 07:47:52 1.2585
3 2004-01-01 17:46:14 1.2586
4 2004-01-01 17:56:08 1.2585
5 20...

-2

votes

1

answer

22

Views

### Which one is better in terms of space/time complexity?

in terms of space/time complexity, which is better?
if (!(N % 2 == 0) || N % 2 == 0 && (N >= 6 && N = 2 && N 20)) {
System.out.println("Not Weird");
}
// OR
if (!(N % 2 == 0)) {
System.out.println("Weird");
} else {
if (N >= 2 && N = 6 && N 20) {
System.out.println("Not Weird");
}
}
I'm try...

1

votes

2

answer

50

Views

### How to merge different time-series plot into a 2D in Python

I have three different time-series data of the following format where the first column is timestamp and the second column is the value.
0.086206438,10
0.086425551,12
0.089227066,20
0.089262508,24
0.089744425,30
0.090036815,40
0.090054172,28
0.090377569,28
0.090514071,28
0.090762872,28
0.090912691,27...

0

votes

0

answer

4

Views

### How to extrapolate on a time series based on correlation

I have a time series data for one year (T1). I have another time series data (T2) for 1 month (Jun). I find there are some similarities between two time series in Jun using correlation coefficients. How can I extrapolate (Jan to Dec) the second time series using the first time series.

2

votes

0

answer

8

Views

### How to make a qml object's property “dynamically updatable” through socket connection?

I am using PyQt5 and Qml to create a client application. This is a simplified sample of my Qml file:
import QtQuick 2.11
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
ApplicationWindow {
visible: true
width: Screen.width/2
height: Screen.height/2
Rectangle {
id: rectangle
x: 187
y: 92
wi...

0

votes

0

answer

7

Views

### How to use Keras to create LSTM time series model with many input and many output

I have training data like this:
train_x = np.random.randint(1, 20, (5, 4))
train_x
array([[ 4, 19, 5, 4],
[ 5, 2, 2, 8],
[11, 9, 17, 16],
[18, 18, 7, 10],
[ 2, 1, 1, 4]])
train_y = np.random.randint(1, 10, (5, 2))
train_y
array([[2, 7],
[2, 9],
[4, 5],
[7, 8],
[2, 8]])
And also validation...

0

votes

0

answer

3

Views

### How to output RTC_CLKOUT on GPIO Pin in MKE1Z?

I have the below configuration to see RTC_CLKOUT on Port C pin 4.
PCC_PORTC.PCCLK.BIT.CGC = 1;
PCIPORTC.PCR[4] = PORT_PCR_MUX(3);
ConfigGPIO(PORTC,4,OUTPUT_PUSHPULL);
RTC->CR = RTC_CR_CPE(3) | RTC_CR_CLKO(0)|RTC_CR_LPOS(0) | RTC_CR_CPS(1) |
RTC_CR_UM(0) | RTC_CR_SUP(0)| RTC_CR_OSCE(1);
But the Pin...

1

votes

3

answer

8.4k

Views

### Subtract Two DateTime objects - Python [duplicate]

This question already has an answer here:
How do I find the time difference between two datetime objects in python?
13 answers
I have two date time objects like this
a = first date time object
b = second date time object
And then
c = a - b
Now I want to compare c and check if the difference was gr...

0

votes

0

answer

5

Views

### HBase Data Model for Specific Time Series IoT Data?

I have 100 machine, and each machine has 20 component, and each component has 3 different sensor type, and each sensor type may have 20 different sensors. For example; machine1 has component1, component1... component20 component, and each component has EV, PR, PT type, and EV, PR or PT type has temp...

1

votes

1

answer

391

Views

### Converting ISO8601 (I think) to hours:minutes:seconds in Powershell

I'm not sure if this is going to be a simple answer or not. I tried searching for ways to convert ISO times online and I believe ISO 8601 is the time format I'm dealing with but I'm not 100% sure, and I couldn't find much info about it.
To keep it super short, in an XML document I'm parsing in Powe...

1

votes

1

answer

39

Views

### Since updating to business_time gem version 0.9.2 dates miscalculating

I've got a daily smoke test running every morning in multiple environments via Jenkins from around 6 - 8 AM.
Everything was running smoothly until I updated business_time gem to version 0.9.2 from 0.9.1. Now the date calculation I have 0.business_days.from_now calculates to yesterday's date.
This...

1

votes

1

answer

80

Views

### algorithm find O(n) with two T(n) on the other side of the recurrence equation

next days I will have my exam on algorithms, the professor asked us to learn how to find O(n) of equations at this form:
T(n) = T(n/3) + T(n/4) + 5n
T(n) = T(n/3) + 2T(n/4) + 5n
T(n) = T(n/3) + T(n/4) + 15n
T(n) = 2T(n/3) + T(n/4) + 4n
I know how to use master theorem but I doubt I can use it someho...

0

votes

0

answer

12

Views

### Error in nls: number of iterations exceeded maximum of 100

My model: beta1+sin(beta2*time*pi) +error
I used nls function in r :
nlm.1

1

votes

2

answer

54

Views

### Get wrong date and time with high_resolution_clock in Visual Studio 2017 / Get number of milliseconds from epoch time (1 jan 1970)

I have a problem with Visual Studio 2017.
I'm trying to get the current time and date with millisecond resolution. I tried the follwing code in a few compilers:
#define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
using namespace std;
using namespace chrono;
int main()
{
high_resolution_clo...

1

votes

2

answer

40

Views

### How to conduct timeseries analysis on half-hourly data?

I have the dataset below with half hourly timeseries data.
Date

1

votes

2

answer

59

Views

### Java fastest parser for OffsetDateTime

What is the fastest way to parse date/times into OffsetDateTimes in Java? Is there a library which is faster than the standard library?
e.g.
OffsetDatetime x = Something.parse("2018-01-02T12:34:56+00:00");

2

votes

0

answer

11

Views

### Socket creation speed huge difference Python3.7/Python2.7

I'm trying to create a socket, then connect to the same server until I can't make any connection from my PC and I face a problem : my program is WAY faster with Python 2.7 than with Python 3.7.
Here a minimal example:
import time
import socket
begin = time.time()
socket_list = []
while True:
try:
s...

0

votes

0

answer

14

Views

### What is the time-complexity for the “in” function in Python for strings?

I am trying to find out what would be the time complexity if I m trying to look for a string B in A in Python?
Here is the problem I am working on:
Question :Given two strings A and B, find the minimum number of times A has to be repeated such that B is a sub-string of it. If no such solution, retur...

0

votes

0

answer

2

Views

### How to calculate end time and duration of a time series based on number of occurrences of a number?

I have a dataframe with time series and a value. I want to create start time, end time and duration based on how long that number repeats itself. Here is my data frame:
enter image description here
I am expecting my output to be
enter image description here
Can someone help?

1

votes

1

answer

55

Views

### Convert time to “day” and “night”

I have a dataset giving a timepoint at which the ID is leaving on a trip (begin.trip).
The IDs are divided in 2 groups (treated & control) and I would like to know if the treatment caused a problem in the circadian clock.
Therefore, I would like to make 'time' a categorical factor like:
- ID leaves...

1

votes

2

answer

1.7k

Views

### Postgres LISTEN/NOTIFY - low latency, realtime?

I am planning to use postgres LISTEN/NOTIFY aproach to get insert time(actual transaction commit time) of records in a table. To achieve this, I plan to do the following. I issue a notification during insert time as shown below.
BEGIN;
INSERT INTO table_name(id, ...) values (id,....);
select pg_noti...

1

votes

2

answer

2.7k

Views

### SQL Server adding two time columns in a single table and putting result into a third column

I have a table containing two time columns like this:
Time1 Time2
07:34:33 08:22:44
I want to add the time in both these columns and put the result of addition into a third column may be Time3
Any help would be appreciated..Thanks

1

votes

3

answer

11.5k

Views

### Convert text date/time to a real date time in excel

My data is extracted from an application and it has a text that looks like a date/time in excel. How do I actually convert "3/24/2016 11:22:07 PM" (in text) to a real date/time conversion? I've tried formatting the cells but it doesn't work.

1

votes

1

answer

1.1k

Views

### How to calculate and plot multiple linear trends for a time series?

Fitting a linear trend to a set of data is straight forward. But how can I fit multiple trend lines to one time series? I define up and down trends as prices above or below a exponential moving average. When the price is above the EMA I need to fit a positive trend and when the trend turns negative...

1

votes

2

answer

6k

Views

### How do I find the time complexity (Big O) of while loop?

Code 1
int i = 0;
int j = 0;
while(i < n){
while(j < n){
printf("{%d,%d}",arr[i],arr[j]);
j++;
}
i++;
j = 0;
printf("\n");
}
Code 2
int result = 0;
int i = 0;
while (i < n / 2){
result += arr[i];
i += 1;
while (i >= n / 2 && i < n){
result += arr[i];
i += 1;
}
}
printf("%d\n", result);
I only know h...

1

votes

2

answer

6.9k

Views

### python realtime plot using pyqtgraph

I need to plot in realtime a series floating point numbers from the serial port. These values are sepparated by the '\n' character, so the data sequence is something like this:
x1
x2
x3
...
How would you plot the data?
I am using an Arduino board, the data rate is 200 samples/s, and my PC is runnin...

1

votes

1

answer

401

Views

### How to compare times in different time zones in Ruby?

I have this date that which is in timezone offset format that I need to convert to UTC format.
For example:
date1 = 2017-07-13T17:13:12-04:00
date2_utc = 2017-07-13 21:13:12 UTC
I need to compare if those two date are same date. Or If I can convert date1 to UTC then i can compare those two.

1

votes

3

answer

724

Views

### Limit CPU time of process group

Is there a way to limit the absolute CPU time (in CPU seconds) spend in a process group?
ulimit -t 10; ./my-process looks like a good option but if my-process forks then each process in the process group gets its own limit. The whole process group can use an arbitrary amount of time by forking every...

1

votes

2

answer

295

Views

### Why is Time complexity of the code O(log n)?

Here is the code given in the book "Cracking the Coding Interview" by Gayle Laakmann. Here time complexity of the code to find:-
int sumDigits(int n)
{ int sum=0;
while(n >0)
{
sum+=n%10;
n/=10
}
return sum ;
}
I know the time complexity should be the number of digits in n.
According to the book, it...

1

votes

1

answer

756

Views

### how to get tsclean working on data frame with multiple time series

I'm in the process of creating a forecast based on the hts package but before getting this far I need to clean the data for outliers and missing values.
For this I thought of using the tsclean function in the forecast package. I got my data stored in data frame with multiple columns (time series) t...

2

votes

0

answer

72

Views

### Why Linux “system” thread prevent my RT thread from working?

I have some data acquisition application running under Linux 2.6.37 on DM8148 with TI Linux. I have two threads:
thread named IDE, scheduled as SCHED_RR, prio 114 (75), which collects data from HW FIFO arriving at 200KiB/s into 30MiB ring buffer each 2ms:
while(1) {
sleep(ms);
while(DataInFIFO) {...

1

votes

2

answer

347

Views

### MySQL: Trying to get Current date with current hour, without minutes and seconds

I am trying this:
SELECT matchId FROM Matches where matchDate = CURRENT_DATE + HOUR(CURRENT_TIME) + ':00:00'
but cant get it to work. When I manually do this, it works:
SELECT matchId FROM Matches where matchDate = '2018-01-31 16:00:00'
I tried many variations of, containing CURDATE(), CURRENT_DATE,...

1

votes

1

answer

138

Views

### Converting midnight in to a date time format in R

I have a very specific problem. I have been trying to convert a date time character into a date time format in R. Example: "2017-05-21 00:00:00".
Whenever I try to convert it using strptime and as.POSIXct to a date time format it gives me "2017-05-21".
Thanks for any help

1

votes

1

answer

1.3k

Views

### Real-time anomaly detection from time series data

I have some problem when detecting anomaly from time series data.
I use LSTM model to predict value of next time as y_pred, true value at next time of data is y_real, so I have er = |y_pred - y_t|, I use er to compare with threshold = alpha * std and get anomaly data point. But sometime, our data i...