Rugby Case. Scipy rankdata error

I am getting an error utilizing rankdata from scipy.stats. Not sure where the issue is and how I can solve it. Would appreciate the help! (I am adding some code prior for the reference)

with model:
        trace.extend(az.from_pymc3(posterior_predictive=pm.sample_posterior_predictive(trace)))
    pp = trace.posterior_predictive
    const = trace.constant_data
    team_da = trace.posterior.team


    pp["home_win"] = (
    (pp["home_points"] > pp["away_points"]) * 3     # home team wins and gets 3 points
    + (pp["home_points"] == pp["away_points"]) * 2  # tie -> home team gets 2 points
)
pp["away_win"] = (
    (pp["home_points"] < pp["away_points"]) * 3 
    + (pp["home_points"] == pp["away_points"]) * 2
)
    groupby_sum_home = pp.home_win.groupby(team_da[const.home_team]).sum()
    groupby_sum_away = pp.away_win.groupby(team_da[const.away_team]).sum()
    pp["teamscores"] = groupby_sum_home + groupby_sum_away

from scipy.stats import rankdata

pp["rank"] = xr.apply_ufunc(
    rankdata,
    -pp["teamscores"],
    input_core_dims=[["team"]],
    output_core_dims=[["team"]],
    kwargs=dict(axis=-1, method="min"),
)

Error I am getting:

From github history, it looks like axis was added to scipy 13 months ago, only versions released after that should have the argument. See https://github.com/scipy/scipy/pull/11786 for the specific PR. Updating your scipy version should fix the issue.