The Pandas tseries offsets CustomBusinessHour property normalize represents whether to shift the start of the next business hour to midnight. It returns a boolean value that specifies whether the timestamp shift to next business hour to midnight.
1 CustomBusinessHour.normalize
1 import pandas as pd
2
3 offset = pd.offsets.CustomBusinessHour(n = 4)
4
5 res = offset.normalize
6 print('The CustomBusinessHour default value for normalize :')
7 print(res)
In the above example, a CustomBusinessHour object is created by passing a n frequency value. A normalize property is access that returns boolean value False, as the default value of the normalize property is False if not specified. The result is assign to the variable that will be printed on console.
1 The CustomBusinessHour default value for normalize :
2 False
CustomBusinessHour object with normalize
CustomBusinessHour object with normalize
1 import pandas as pd
2
3 tstamp = pd.Timestamp(2022, 1, 25, 12, 30)
4 offset = pd.offsets.CustomBusinessHour(n = 4, normalize = True)
5
6 res = tstamp + offset
7 print('The timestamp with offset as normalize :')
8 print(res)
In the above example, a CustomBusinessHour object is created with normalize parameter as True. An offset is added to timestamp that will shift the business day to midnight.
1 The timestamp with offset as normalize :
2 2022-01-25 00:00:00
CustomBusinessHour with start and end offset
CustomBusinessHour with start and end offset
1 import pandas as pd
2
3 offset = pd.offsets.CustomBusinessHour(start = '11:00', end = '18:00')
4 res = offset.normalize
5
6 print('The CustomBusinessHour default value for normalize :')
7 print(res)
In the above example, a CustomBusinessHour object is created by passing a start and end offset. A normalize property is access that returns boolean value False, as the default value of the normalize property is False if not specified. The result is assign to the variable that will be print.
1 The CustomBusinessHour default value for normalize :
2 False
CustomBusinessHour with normalize as true
CustomBusinessHour with normalize as true
1 import pandas as pd
2
3 offset1 = pd.offsets.CustomBusinessHour(normalize = True)
4 res1 = offset1.normalize
5
6 print('The CustomBusinessHour default value for normalize :')
7 print(res1)
In the above example, a CustomBusinessHour object is created by passing a normalize as true. A normalize property is access that returns boolean value False, as the default value of the normalize property is False if not specified. The result is assign to the variable that will be print.
1 The CustomBusinessHour default value for normalize :
2 True
Related options for your search