Units of Production Method (UNITS)

Calculate the unitsofproduction depreciation and book value at the end of year t. 
 syse.units(cost, salvage, expected_units_lifetime, production_t, t)
Calculate the unitsofproduction depreciation and book value at the end of year t.
 Parameters:
cost (float) – The original cost of the asset
salvage (float) – The estimated salvage value of the asset at the end of its useful life
expected_units_lifetime (float) – The total expected number of units produced over the asset’s lifetime
production_t (numpy array) – A numpy array of units produced per year for t years
t (int) – Number of years
 Returns:
Depreciation expense in year t float: Book value at the end of year t
 Return type:
float
Examples:
On January 1, Miners, Inc. bought a backhoe for $500,000. They expect to use it for 5,000 hours, about 1,000 per year for 5 years, before selling it for $100,000. What is the depreciation expense for the first year if they opt for unitsofproduction method and used it for 1,500 hours?
cost = 500000 salvage = 100000 expected_units_lifetime = 5000 production_t = np.array([1500]) # Only the first year's usage is given, so the array has one element t = 1 # Calculate depreciation expense for the first year syse.units(cost, salvage, expected_units_lifetime, production_t, t) Output = 120000.0