Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设您有一个未排序的列表,并且您使用np.sort. 有没有办法使用numpy从原始列表中获取排序列表的索引?
np.sort
最简单的方法是使用位置索引来扩充数组,然后对二维数组进行排序。这会同时为您提供已排序的数据及其原始位置指示。
如果您只想要索引(而不是排序数据),请使用argsort:
>>> from numpy import array >>> arr = array([10, 5, 80, 20, 70, 18]) >>> arr.argsort() array([1, 0, 5, 3, 4, 2])
我有:主页和对话框上的按钮。
A 想要托管 bean (NewDialog.java) 的 ViewScope 生命周期,执行对话框。换句话说:按下按钮时重新创建 NewDialog bean,并在关闭对话框时销毁。
但是在加载主页时已经创建了 NewDialog bean。如何仅在按下按钮时强制创建bean?