二维np。数字化

问题描述 投票:6回答:1

我有二维数据,我有一堆用scipy.stats.binned_statistic_2d生成的二维箱。对于每个数据点,我都希望它占用bin的索引。这正是np.digitize的用途,但是据我所知,它仅处理一维数据。Thisstackexchange似乎有一个答案,但这完全归纳为n维。有没有针对二维的更直接解决方案?

python numpy pandas scipy binning
1个回答
5
投票

您已经可以从scipy.stats.binned_statistic_2d的第四个返回变量中获得每个观测值的bin索引:

scipy.stats.binned_statistic_2d
© www.soinside.com 2019 - 2024. All rights reserved.