How do I make type hint for a function, which takes any kind for object that behaves like a float?
For example, consider
def cubed(x):
return x**3
This function can accept a float (f(5)), but also any other kind of object which supports the same operations as float:
pandas series:
s = pd.Series([1,2,3])
cubed(s)
xarray dataarray
a = xr.DataArray([1, 2, 3], dims='x')
cubed(a)