Hey!
I new to the Jupyter environment. I’ve been trying to calculate the median by years (in my excel I’ve two columns, date (year, month, day) and sales.) .
When I try to run the cell where the code it shows the following:
AxisError Traceback (most recent call last)
in
----> 1 yhat = median (-12, -24, -36)
<array_function internals> in median(*args, **kwargs)
~/opt/anaconda3/lib/python3.8/site-packages/numpy/lib/function_base.py in median(a, axis, out, overwrite_input, keepdims)
3604
3605 “”"
→ 3606 r, k = _ureduce(a, func=_median, axis=axis, out=out,
3607 overwrite_input=overwrite_input)
3608 if keepdims:
~/opt/anaconda3/lib/python3.8/site-packages/numpy/lib/function_base.py in _ureduce(a, func, **kwargs)
3493 keepdim = list(a.shape)
3494 nd = a.ndim
→ 3495 axis = _nx.normalize_axis_tuple(axis, nd)
3496
3497 for ax in axis:
~/opt/anaconda3/lib/python3.8/site-packages/numpy/core/numeric.py in normalize_axis_tuple(axis, ndim, argname, allow_duplicate)
1389 pass
1390 # Going via an iterator directly is slower than via list comprehension.
→ 1391 axis = tuple([normalize_axis_index(ax, ndim, argname) for ax in axis])
1392 if not allow_duplicate and len(set(axis)) != len(axis):
1393 if argname:
~/opt/anaconda3/lib/python3.8/site-packages/numpy/core/numeric.py in (.0)
1389 pass
1390 # Going via an iterator directly is slower than via list comprehension.
→ 1391 axis = tuple([normalize_axis_index(ax, ndim, argname) for ax in axis])
1392 if not allow_duplicate and len(set(axis)) != len(axis):
1393 if argname:
AxisError: axis -24 is out of bounds for array of dimension 0
Thanks for your time!