2,963 questions
2
votes
1
answer
123
views
Why does my Python solution for selecting 2 points from each interval give incorrect results for overlapping intervals?
I’m trying to solve the following Leetcode problem:
You are given a 2D integer array intervals where intervals[i] = > [starti, endi] represents all the integers from starti to endi
inclusively.
A ...
Advice
0
votes
13
replies
174
views
How to replace Joda dateTime and interval with Java.time
I am trying to replace Joda datetime and interval methods with Java.time and also trying to specify explicitly timezone as Duser.timezone=America/Chicago.
This my code fragment
public void ...
4
votes
5
answers
385
views
How to compute the union and intersection of time intervals with covariates by group id?
I am looking for an efficient way to compute the union and intersection of time intervals (start–stop format) by group (id), while keeping the covariates associated with each interval.
Each patient (...
1
vote
1
answer
65
views
In pandas, what is the difference between a datetime-based Interval and Period
In pandas, there are two obvious ways to represent timespans: Interval[datetime64] and Period. When do I use which? Is there a prefered one in all cases?
I couldn't find this in the documentation - ...
0
votes
2
answers
95
views
How to split overlapping time intervals in R, assign precedence, and fill gaps with dummy events?
I’m working with machine events data in R, where each event has a start and end time, a unique event code, and a precedence level (ordered factor). Events may overlap, and I need to transform this ...
4
votes
3
answers
143
views
Getting mean of multiple rows based on interval dataframe in R
Let's say I have the following dataframe
df1=read.table(text="ID POSITION S1 S2
1 1 10 10
1 2 20 0
1 3 10 0
1 4 20 0
1 5 10 50
2 1 10 0
2 2 20 10
2 3 20 10
2 4 20 10
2 5 20 ...
1
vote
1
answer
84
views
Can a value reach a given interval by just adding digits? [closed]
I've got a given value and interval and want to check if the value, if not inside the interval, can still reach the interval by just adding digits
Bottom/Top/Value
Bottom < Top
legende
Inside: ...
2
votes
1
answer
85
views
R predFit(): Problem with prediction interval for nls in two variables
I am fitting a nonlinear regression on a dataset with two explanatory variables Day and Treatment modelling a response Amount using {nls}. I want to get the predicted values for Amount together with ...
2
votes
3
answers
122
views
Group rows by group & overlapping time intervals & then keep highest priority row in R
I have a dataset as follows
data<- data.frame(group_ID= c("cred", "cred", "cred", "cyellow", "cyellow", "cgreen"),
...
1
vote
1
answer
49
views
Finding the most common interval in a list of doubles
I am currently stuck on evaluating a list of some Doubles representing time intervals. Let's say I have an unordered list of up to 100 values fluctuating around 1: [0.897, 0.912, ... 1.214, 0.981]
I ...
2
votes
0
answers
114
views
Finding the minimum cost at each point in time from a set of weighted intervals
Let’s say we have a list of intervals, each of which has a cost associated with it. Assume that there is always at least one interval active.
The solution would be a timeline of non overlapping ...
4
votes
6
answers
134
views
Counting dates in a range of dates
I have a pandas dataframe that contains two date columns, a start date and an end date that defines a range. I'd like to be able to collect a total count for all dates across all rows in the dataframe,...
2
votes
1
answer
76
views
chartjs 4.4 : not able to plot 2 time series in 1 graph
I have an issue with plotting 2 lines in 1 graph using chartjs: I get 2 graphs with 1 line in stead of 1 graph with 2 lines, and I think I made a very simpe error, but I can't find it. I have spend ...
-3
votes
3
answers
236
views
How should I idiomatically represent time intervals (not just durations) in C++?
I like C++11's std::chrono facilities, which let me work with:
time points
clocks
durations (= differences between time points)
but I occasionally need to work with time intervals, i.e. not just the ...
1
vote
3
answers
56
views
Combination of piso functions to create dataframe of last inspection dates for intervals of an asset?
I'm struggling with the right combo of piso functions to perform the following analysis:
Let's say I have a length of road with mile markers as such:
0---1---2---3---4---5
And let's say I have a ...
0
votes
1
answer
204
views
How to change the y-axis interval with R Base (barplot) [duplicate]
I want to create a barplot with R base. My problem now is, that I would like to change the y-axis interval from 2 to 1.
(at the moment I have the steps 0,2,4,6,8,10,12; and I want 0,1,2,3,4,5,6,7,8,9,...
0
votes
0
answers
55
views
informix 4gl forms "Error status number -30284. Invalid conversion."
i got this error each time i want to display DATETIME or INTERVAL in 4GL Form Field.
Error status number -30284.
Invalid conversion."
I dont understand if is caused due to formatting issue or
the ...
0
votes
0
answers
28
views
Page Performance Issue with Countdown in Angular on Component Reload
I'm developing an Angular app where I fetch a list of coupons from an API. Each coupon has a countdown timer showing the remaining time until it expires. However, I am facing performance issues when ...
0
votes
1
answer
42
views
How to shift ticks and labels in-between grouped boxplots with a discrete x scale using ggplot2?
Surely already asked, but I'm struggling to find a clear solution that fits my case.
How to shift ticks between grouped boxplots (rather than centered on them) so that to define hours intervals?
...
1
vote
2
answers
119
views
setdiff in lubridate
Trying to figure out why this doesn't work. What I'm looking to do is break up test_int_1 into 3 segements -> before test_init_2, test_init_2, after test_init_2.
library(lubridate)
test_int_1 <-...
0
votes
2
answers
93
views
Vlookup the equivalent value if it matches or fits inside a range [duplicate]
How to VLOOKUP the equivalent value if it matches or fits inside a range. Is there a way to get this using vlookup?
Normal VLOOKUP and INDEX/MATCH formulas are not working.
The Excel file I currently ...
0
votes
1
answer
121
views
Select rows without overlap / dynamic 1 hour intervals
time_start
time_end
'2024-01-01 12:30'
'2024-01-01 13:30'
'2024-01-01 12:40'
'2024-01-01 13:40'
'2024-01-01 12:45'
'2024-01-01 13:45'
'2024-01-01 13:36'
'2024-01-01 14:36'
'2024-01-01 13:50'
'2024-01-...
0
votes
0
answers
33
views
Associate rows with time values to night with unique identifier
I have the data frame (moon_data) below with moon altitude and illumination for each hour of the days.
date altitude illum
9 2020-08-31 05:30:00 -0.29518673 0.9676100
10 ...
1
vote
2
answers
95
views
R, data.table and manually defined start of 24 hour intervals
please, give me a hint to solve the following problem:
DT[ , .N, by=date], with date is of class Date and format %F,
will give the number of rows by day.
DT[ , .N, by=format(DateTime, "%F")],...
0
votes
1
answer
116
views
Add date interval determined from table column
I'm trying to add a number of days to a date column in an AWS Athena table, where the number of days is determined by another column.
I can add a fixed number of days to the column as:
select (...
1
vote
2
answers
104
views
How to remove overlaps from intervals? [closed]
I have two datasets:
one consisting time periods when persons worked
second consisting time periods when persons were on vacation
I need to remove these vacation periods from working periods as ...
0
votes
0
answers
102
views
How do you insert an interval into a disjoint segment tree in Haskell?
I don't think this is standard terminology, but we will define a "disjoint segment tree" as a segment tree (a flavor of binary search tree) whose values are pairwise-separated intervals (a,b)...
0
votes
1
answer
98
views
Sometimes in Space Invaders JS I shoot two aliens when the shoot hits the same time aliens shift
I would be very grateful for any help, trying to code Space Invaders in JS, managed to move aliens in functions to shift the board right left and down in Intervals, the laser shoot is also in another ...
0
votes
1
answer
213
views
Merge intervals based on condition
This is the classical approach to merge intervals:
def merge(intervals: List[List[int]]) -> List[List[int]]:
result = []
intervals.sort()
prev_interval = intervals[0]
for ...
0
votes
1
answer
40
views
Issues with Handling setupIntervalButton() in refreshFetch() Function for Weather Map API
I'm currently working on a weather map API and encountering an issue with my setupIntervalButton() function when trying to use it in the refreshFetch() function. Specifically, I'm having trouble ...
0
votes
1
answer
68
views
MariaDB running total on weather data (rain fall)
I am receiving rainfall data from my weather station in one minutes intervals e.g:
+---------------------+----------+
| tid | regn1min |
+---------------------+----------+
| 2024-09-09 ...
2
votes
2
answers
527
views
casting (converting) integer into interval in PostgreSQL
If I execute query: SELECT '10' AS a_name; it gives 10 AS text type.
In case of query: SELECT 10::text AS a_name; it gives again 10 as text.
So one could expect that following two queries gave the ...
0
votes
1
answer
94
views
How to calculate times in variable cells [closed]
I am trying to create an Excel file that logs diver times. Specifically, I am logging their in/out times, total dive time, and surface intervals. If you're not a diver, the total dive time is the ...
2
votes
1
answer
105
views
Find the next datetime determined by overlaping intervals
I can have at maximum N intervals running in the same period. An interval starts at time X and ends at time X + 7 (one week).
Is there any way to get the next date where I can start a new interval ...
1
vote
1
answer
60
views
Adding conditions to loop to generate class intervals using ClassInt in R for areas with fewer n classes
I have issues with assigning classes to intervals that dont meet the criteria in my loop function using the classInt library in R. How do a include a condition for an automatic class if the rows in ...
0
votes
1
answer
59
views
Query over 30-day increments in Postgresql
I have two queries. One that returns a count of records over the last 30 days, and another for the 30 days prior. I'd like to combine them into one query.
SELECT
cat.title as category, count(*) as ...
1
vote
1
answer
101
views
Is there a way to filter out negative Interval values?
Currently I have a interval column after subtracting two timestamp without time zone columns
SELECT started_at - ended_at AS ride_length
FROM [dbo]
However, I am getting negative values for the ...
-1
votes
3
answers
95
views
How to stop the timeout when score reaches over 1000
I want to know how to clear the interval and the score, because it works, but when it reaches over 1000 and I hit reset it doesn’t reset fully.
I tried putting the clearTimeout functions before ...
0
votes
2
answers
44
views
Why is this setInterval cause value over 1?
I have a progress bar the value should be from 0.1 to 1.
but sometimes progressValue will over 1, for example refresh the page.
Why ?
https://codesandbox.io/p/devbox/g9wwqf?file=%2Fsrc%2FApp.jsx%3A6%...
0
votes
1
answer
71
views
how to open a textgrid with Praatio when xmin = xmax
I try to open a textgrid with praatio :
from praatio import textgrid
tg = textgrid.openTextgrid(myfile)
But in this textgrid, it happen sometimes that xmin = xmax :
"intervals [11]: xmin = 3.34, ...
0
votes
2
answers
73
views
Different class intervalls (breaks) according to specific values in the histogram
I would like to create class intervals in the histogram according to the Body mass index (BMI) classification, and color the columns.
The categories are:
Underweight (Severe thinness) < 16.0 -> ...
0
votes
1
answer
44
views
How to Group Records where Record interval is less than 15 minutes apart
I want to be able to group data by the time gap between records being less than 15 minuetes.
I have the below Query
SELECT TimeStamp
FROM Batch
WHERE Product = '1203'
AND TimeStamp BETWEEN '2024-04-17 ...
0
votes
1
answer
53
views
How to make the time of a timestamp the top of the hour?
I am trying to convert a timestamp that contains minutes and seconds to just be a timestamp at the hour interval
i.e.
2022-05-03 11:14:59.000
becomes
2022-05-03 11:00:00.000
I have tried a number of ...
3
votes
1
answer
97
views
How to call different methods with their own sample intervals inside a class using different a TimerInterval class working with io_context
I am trying to use the same idea suggested as answer of my question in this post. Thi goal is to implement a class that will call 3 different methods with their own intervals inside a start_trigger ...
1
vote
1
answer
73
views
How to find max score for all intervals?
I ran into this problem while working on a project, and was wondering a optimal way to solve this:
Say I have the following intervals with scores, I want to find the max score within the intervals, at ...
0
votes
2
answers
32
views
interval not getting cleared in react
I have this problem where my intervals are not getting removed. When the intervalActive prop from its parent gets changed to false, it should run the function stopPagination, but instead it doesnt. ...
0
votes
3
answers
802
views
How can I efficiently merge overlapping intervals in a list of tuples in Python?
I'm working with a dataset in Python where I have a list of tuples, each representing an interval (start, end). I've encountered a scenario where some of these intervals overlap, and I need to merge ...
1
vote
1
answer
58
views
Cut intervals to add specific dates
I have a rather wide dataset (700k rows and 100+ columns) with multiple entity_id and multiple datetime intervals.
There are many columns attr associated with different values.
I am trying to cut ...
2
votes
2
answers
440
views
Combination of Non-overlapping interval PAIRS
I recently did a coding challenge where I was tasked to return the number of unique interval pairs that do not overlap when given the starting points in one list and the ending points in one list. I ...
1
vote
2
answers
100
views
MySQL query to get the number of read unique pages for book
The users to submit an interval of starting and ending pages that he/she read in a specific
book. Note that the user can submit multiple intervals for the same book.
I need the query announce the most ...