For this task I would probably recommend using numpy.digitize applied via xarray.apply_ufunc:>>> bins = [0., 20., 40., 60., 80., np.inf]>>> result = xr.apply_ufunc(np.digitize, result, kwargs={'bins': bins}) 这篇关于xarray相当于pandas的qcut()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 10:25