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
2
votes
1 answer

dataframe: how to get columns of Period objects (calendar+fiscal year and month)from DatetimeIndex?

I have a dataframe and these are the first 5 index, there are several rows with different datapoint for a date and then it goes to the next day DatetimeIndex(['2014-01-01', '2014-01-01', '2014-01-01', '2014-01-01', '2014-01-01'], …
neutralname
  • 383
  • 2
  • 4
  • 11
2
votes
2 answers

Converting period[Q-DEC] column into a dataframe to a string in Python

I am trying to convert period[Q-DEC] column into a string for modelling. This answer helped me to do this. My current data: df = {'Month': [1, 8], 'Year': [2015, 2020]} df = pd.DataFrame(data = df) df['Quarter'] =…
Anakin Skywalker
  • 2,400
  • 5
  • 35
  • 63
2
votes
1 answer

Calculating quarter length in pandas.period

Sample code: months = [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sept, Oct, Nov, Dec] months = pd.period_range(start='2020-01', periods=12, freq='M') for start, end in zip(months, months[11:]): end_q = end.qyear print(start, end, end_q) #…
Jack_T
  • 91
  • 1
  • 9
2
votes
1 answer

java.time.Period normalize() changes sign and value of month field despite having absolute value less than 12

The Java se 8 API for for normalize() reads: This normalizes the years and months units, leaving the days unit unchanged. The months unit is adjusted to have an absolute value less than 11, with the years unit being adjusted to compensate. For…
John
  • 741
  • 9
  • 18
2
votes
0 answers

Calculate daily (and nightly) variables from hourly dataset using R

I have a data.frame (df1) of times (POSIXct), hourly minimum temperatures (Tmin) and hourly maximum temperatures (Tmax). I also have a data.frame (df2) of daily sunrise and sunset times. I would like to calculate average Tmin and Tmax for every…
Texanum
  • 23
  • 4
2
votes
2 answers

Lubridate periods get messed up after using dplyr spread

I am using R-3.6.3, lubridate_1.7.4, dbplyr_1.4.2. Reprex: df_0 <- tibble(period_type = c("a", "b", "c"), period_value = c("1:1:1", "2:2:2", "4:4:4")) %>% mutate(period_value = hms(period_value)) df_0 ## A tibble: 3 x 2 # …
Habert
  • 347
  • 2
  • 10
2
votes
5 answers

Unrelated tables and time intervals

I am going to comment on the scenario that I currently have when designing my database. I have the following tables: user (id, name, lastname) role (id, name) user_role (user_id, role_id, from_date, to_date) period (id, name, from_date,…
Mr. Mars
  • 762
  • 1
  • 9
  • 39
2
votes
1 answer

T-SQL: process consequtive periods and count by group

I deal with big job to find max period by FULL months of enrollment within the year (12 months period), which I did OK if we have 2 periods. Just got stuck at the end while testing if I have 3+ periods. Data below and picture hope will provide all…
Mich28
  • 519
  • 3
  • 14
2
votes
0 answers

Unable to Pull Aggregated Data by Period - Facebook Graph API with Python

Hoping the best for everyone today. Context: Currently I use Facebook Analytics to pull data from my specific Facebook pages about my visitors and their posts. This data is then entered into a monthly report manually. I'm building a python script…
John
  • 21
  • 3
2
votes
1 answer

How to fire a command at HH:29:55 and HH:59:55 in a windows batch file

In a windows batch file (x.bat), how can I fire a command once every 30 minutes, when the second component of the time is greater than 55? What I have now is: :loop program.exe PING localhost -n 1800 >NUL goto loop The problem is that the…
Chong Lip Phang
  • 8,755
  • 5
  • 65
  • 100
2
votes
6 answers

Get count of active users for each day

I have a data which gives idea about user when did the user subscribed to a service, in a city and when it will expire. It is as below +------+------------+------------+ | City | Start_Date | End_Date | +------+------------+------------+ | LA |…
Rookie_123
  • 1,975
  • 3
  • 15
  • 33
2
votes
0 answers

How to configure endless polling for libnfc library?

nfc-poll command stops polling after 30000ms by default when using libnfc library. I need an endless polling when calling this command from the raspberry pi 3 b+ (raspbian stretch) command line. I´ve looked into the libnfc library source code and…
2
votes
2 answers

Python3 How to convert date into monthly periods where the first period is September

Working with a group that has a Fiscal Year that starts in September. I have a dataframe with a bunch of dates that I want to calculate a monthly period that = 1 in September. What works: # Convert date column to datetime format df['Hours_Date'] =…
Arthur D. Howland
  • 4,363
  • 3
  • 21
  • 31
2
votes
0 answers

Is there a way to calculate how many times a joda period fits into a year?

I'm using org.joda.time.Period to calculate the frequency of an event happening. That frequency can be yearly, quarterly, monthly, weekly, daily, etc. I would like to know if there is a way to calculate how many times my period fits into a year. For…
Sorin
  • 31
  • 2
  • 4
2
votes
0 answers

Python Pandas to_csv 20x slower with a column of type period[D]

I noticed a change in the performance in one of my scripts that is using Pandas to_csv to write a data set to file. Specifically, when writing a long csv (@ 1 mil rows the difference is very pronounced) with a column of type Period[D], performance…
AndrewH
  • 234
  • 1
  • 6