Questions tagged [period]

A period of time is an interval, a span of time. You can also use it for questions related to the actual punctuation mark.

508 questions
3
votes
2 answers

Extract the overlaps of time intervals for the calculation of availabilities

I have a dataset on malfunction times. The start of the malfunction is the Begin column and the end is the End column. In addition there are 3 malfunction categories, which can also overlap in time. My actual goal is to calculate the sum of the time…
TobKel
  • 1,293
  • 8
  • 20
3
votes
2 answers

How can I extract information from the string returned in Period.between()? (Kotlin)

For example, I'd have two dates as expected in the function. val period = Period.between(date1, date2) What is returned is a String like this "P*y*Y*x*M*z*D" where y is the year, x is the month and z is the day. I want to store each of these values…
berry
  • 43
  • 2
3
votes
1 answer

How can I get daily login user number?

I have a logged_log table, the table have username, login_time and logout_time column. I need to count daily login user. Table structure: column name type username varchar(32) login_time datetime logout_time datetime nullable sample…
黃梓榆
  • 45
  • 5
3
votes
2 answers

How to set a pandas PeriodIndex with yearly frequency?

I am able to create quarterly and monthly PeriodIndex like so: idx = pd.PeriodIndex(year=[2000, 2001], quarter=[1,2], freq="Q") # quarterly idx = pd.PeriodIndex(year=[2000, 2001], month=[1,2], freq="M") # monthly I would expect to be able to…
Luca Guarro
  • 1,085
  • 1
  • 11
  • 25
3
votes
1 answer

Reproducibility: Failing to rerun code over time

I fear that a running code could fail in the future. I've seen this with tidyverse functions that were running well but after a time returned an error because they had been Defunct. To give some reproducible example try this piece of code from How…
LulY
  • 976
  • 1
  • 9
  • 24
3
votes
6 answers

How to extract 3 numbers from a String

I have an array of strings that contains the following: "1 years, 2 months, 22 days", "1 years, 1 months, 14 days", "4 years, 24 days", "13 years, 21 days", "9 months, 1 day"; I need to extract the amount of years,months, days of each item in the…
KenobiBastila
  • 539
  • 4
  • 16
  • 52
3
votes
2 answers

Is there a straightforward way to convert java.time.Period into java.time.Duration?

I understand that java.time.Period is an "estimate" and java.time.Duration is exact. Still I'd like to convert a Period into a Duration. Or at least declare a duration of weeks or greater without resorting to tricks. Even though this compiles, it…
marathon
  • 7,881
  • 17
  • 74
  • 137
3
votes
1 answer

What are the start and end times of a pandas.Period() object? What role does the parameter 'freq' play in the Period object?

Suppose a Period object is created in Pandas as - In [1]: pd.Period('2021', 'M') Out [1]: Period('2021-01', 'M') What are the start and end points of this period object? How does the frequency M affect those start and end points? In fact, what role…
Anirban Chakraborty
  • 539
  • 1
  • 5
  • 15
3
votes
5 answers

LocalDateTime class in Java and Period

Have such a simple Java class: public static void main(String[] args) { LocalDateTime dateTime = LocalDateTime.of(2017, 11, 26, 15, 38); Period period = Period.ofYears(1).ofMonths(2).ofDays(3); dateTime =…
Eugene
  • 93
  • 4
3
votes
2 answers

How to show localized date units in a formatted string in Java/Android?

Let's say I have a period of days: Period p = Period.ofDays(3); And I want to format the period with the "days" label in the string to get this string as output: // "3 days" ...but, I want to localize the "days" component, so I can't use a…
Benstrom
  • 240
  • 2
  • 9
3
votes
2 answers

For each day, subtract last time row from the first time row with Python

I have 5 minutes-interval meteorological df for many days. Some rows and days are missing. Index is datetime format. DateTime Data 2016-01-01 07:00:00 1 2016-01-01 10:30:00 2 2016-01-01 16:55:00 3 2016-03-25 09:25:00 …
k.ko3n
  • 954
  • 8
  • 26
3
votes
1 answer

Useing amChart serias

We have created something like this, and now I wont to add some periods to my chart codepen. but the code that I wrote doesn't work. Thank you am4core.useTheme(am4themes_animated); let items = [ { "X": 1, "Y":…
Aro
  • 1,078
  • 1
  • 7
  • 26
3
votes
3 answers

SQL Count different timeframes over a known period

How can I count continuous time frames My data looks like this: Id| Em_Name|Em_Reg_Date -------------------------------- 1 | John |2010-03-30 00:00:00 1 | John |2010-03-31 00:00:00 2 | Marc |2010-10-26 00:00:00 2 | Marc |2010-10-27…
3
votes
1 answer

Pandas Period with custom duration

Reading the docs of the pandas Period objects leaves me confused as to whether it is somehow possible to create a custom Period. By custom I mean a Period that does not follow a certain frequency dtype but where each Period in a PeriodIndex…
meow
  • 2,062
  • 2
  • 17
  • 27
3
votes
3 answers

java.time.Period , dividing the period gives wrong results

I tried using java.time.Period, and the results were different from my manual calculations by three days. The weird thing here is when I divide the period into two periods, the results matches my manual calculations. The second method is just like…
ahmed galal
  • 109
  • 8