The Pandas tseries offsets BQuarterBegin property rule_code used to retrieve a rule code as frequency. It returns a string that represents the rule code.
1 BQuarterBegin.rule_code
1 import pandas as pd
2
3 offset = pd.tseries.offsets.BQuarterBegin()
4 res = offset.rule_code
5 print(f'The BQuarterBegin rule code : {res}')
6
7 offset1 = pd.tseries.offsets.BQuarterBegin(startingMonth = 2)
8 res1 = offset1.rule_code
9 print(f'The BQuarterBegin rule code : {res1}')
In the above example, a BQuarterBegin objects are created with and without startingMonth parameter. A rule_code property is access that returns a frequency string with last month of the quarter. The result is assign to the variable that will be printed on console.
1 The BQuarterBegin rule code : BQS-MAR
2 The BQuarterBegin rule code : BQS-FEB
Example 2
1 import pandas as pd
2
3 offset = pd.tseries.offsets.BQuarterBegin(normalize = True)
4 res = offset.rule_code
5 print(f'The BQuarterBegin rule code : {res}')
In the above example, a BQuarterBegin objects are created without startingMonth parameter and normalize as true. A rule_code property is access that returns a frequency string with last month of the quarter.
1 The timestamp object : 2023-03-31 12:23:00
2 The BQuarterBegin rule code : BQS-MAR
Example 3
1 import pandas as pd
2
3 offset1 = pd.tseries.offsets.BQuarterBegin(startingMonth = 4, normalize = True)
4 res1 = offset1.rule_code
5 print(f'The BQuarterBegin rule code : {res1}')
In the above example, a BQuarterBegin objects are created with startingMonth parameter and normalize as true. A rule_code property is access that returns a frequency string with last month of the quarter.
1 The timestamp object : 2024-03-31 10:12:00
2 The BQuarterBegin rule code : BQS-APR
Related options for your search