The Pandas tseries offsets Minute function is_quarter_start() used to determine whether a timestamp occurs on the quarter start. It returns a boolean value that specifies whether a timestamp occurs at the quarter start.
1 Minute.is_quarter_start()
is_quarter_start() function
1 import pandas as pd
2
3 offset = pd.tseries.offsets.Minute()
4
5 tstamp = pd.Timestamp(2022, 4, 1)
6 res = offset.is_quarter_start(tstamp)
7 print(f'Does timestamp occurs at quarter start : {res}')
8
9 tstamp1 = pd.Timestamp(2022, 3, 1)
10 res1 = offset.is_quarter_start(tstamp1)
11 print(f'Does timestamp occurs at quarter start : {res1}')
In the above example, a Timestamp objects are created by passing a date value. A is_quarter_start() function is called that determine whether a timestamp occurs at the start of quarter. The result is assign to the variable that will be printed on console.
1 Does timestamp occurs at quarter start : True
2 Does timestamp occurs at quarter start : False
Example 2
1 import pandas as pd
2
3 tstamp = pd.Timestamp(2023, 4, 1, 12, 3)
4 print('The timestamp object :', tstamp)
5
6 offset = pd.tseries.offsets.Minute(n = 1)
7 res = offset.is_quarter_start(tstamp)
8 print(f'Does timestamp occurs at quarter start : {res}')
In the above example, a Timestamp objects are created by passing a date value and Minute object with unit frequency as 1. A is_quarter_start() function is called that determine whether a timestamp occurs at the start of quarter.
1 The timestamp object : 2023-04-01 12:03:00
2 Does timestamp occurs at quarter start : True
Example 3
1 import pandas as pd
2
3 tstamp1 = pd.Timestamp(2024, 10, 1, 10, 4)
4 print('The timestamp object :', tstamp1)
5
6 offset1 = pd.tseries.offsets.Minute(n = 3)
7 res1 = offset1.is_quarter_start(tstamp1)
8 print(f'Does timestamp occurs at quarter start : {res1}')
In the above example, a Timestamp objects are created by passing a date value and Minute object with unit frequency as 3. A is_quarter_start() function is called that determine whether a timestamp occurs at the start of quarter.
1 The timestamp object : 2024-10-01 10:04:00
2 Does timestamp occurs at quarter start : True
Related options for your search