If you really want this to be a built-in function, you can simply create a class to accommodate your data frame. Then you can define any values or functions that you want. I wrote a quick example below, but you can easily add a definition of units or a more complex uncertainty formula
import pandas as pd
data={'target_column':[100,105,110]}
class data_analysis():
def __init__(self, data, percentage_uncertainty):
self.df = pd.DataFrame(data)
self.uncertainty = percentage_uncertainty*self.df['target_column'].values
When i run
example=data_analysis(data,.01)
example.uncertainty
I get an array ([1., 1.05, 1.1])
Hope this helps
source
share