Pandas tseries offsets BusinessHour function copy() in Python
The Pandas tseries offsets BusinessHour function copy() used to create a copy of the BusinessHour's frequency. It returns a BusinessHour's frequency.
Syntax
 1 BusinessHour.copy()
copy() function
 1 import pandas as pd
 2 
 3 offset = pd.offsets.BusinessHour(n = 4)
 4 
 5 copy = offset.copy()
 6 res = offset == copy
 7 print(f'Does both objects are equals : {res}')
 8 
 9 print(f'The original object : {offset}')
 10 print(f'The copy object : {copy}')
In the above example, a BusinessHour object is created by passing an n frequency value. A copy() function is called that creates a copy of BusinessHour object and assign to the variable. A variables are compared that returns boolean value True, as both objects are same. The result will be printed on console with original and copy object.
Output
 1 Does both objects are equals : True
 2 
 3 The original object : <4 * BusinessHours: BH=09:00-17:00>
 4 The copy object : <4 * BusinessHours: BH=09:00-17:00>

BusinessHour with start and end offset

BusinessHour with start and end offset
 1 import pandas as pd
 2 
 3 offset = pd.offsets.BusinessHour(start = '11:00', end = '18:00')
 4 copy = offset.copy()
 5 res = offset == copy
 6 print(f'Does both objects are equals : {res}')
 7 
 8 print(f'The original object : {offset}')
 9 print(f'The copy object : {copy}')
In the above example, a BusinessHour object is created by passing a start and end offset. A copy() function is called that creates a copy of BusinessHour object and assign to the variable. A variables are compared that returns boolean value True, as both objects are same. The result will be printed on console with original and copy object.
Output
 1 Does both objects are equals : True
 2 The original object : <BusinessHour: bh=11:00-18:00>
 3 The copy object : <BusinessHour: bh=11:00-18:00>

BusinessHour with normalize as true

BusinessHour with normalize as true
 1 import pandas as pd
 2 
 3 offset = pd.offsets.BusinessHour(normalize = True)
 4 copy = offset.copy()
 5 res = offset == copy
 6 print(f'Does both objects are equals : {res}')
 7 
 8 print(f'The original object : {offset}')
 9 print(f'The copy object : {copy}')
In the above example, a BusinessHour object is created by passing a normalize as true. A copy() function is called that creates a copy of BusinessHour object and assign to the variable. A variables are compared that returns boolean value True, as both objects are same. The result will be printed on console with original and copy object.
Output
 1 Does both objects are equals : True
 2 The original object : <BusinessHour: bh=09:00-17:00>
 3 The copy object : <BusinessHour: bh=09:00-17:00>
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us