为了清楚我的问题说,如果我有一个数组作为输出的[123]:1,3,4,6,9,10,54]当我尝试在列表中搜索号码,searchsort返回正确的值,但是当我尝试一些不在列表中,它返回一个荒谬的价值
这里是一些结果
In [131]: a
Out[131]: [1, 3, 4, 6, 9, 10, 54]
In [132]: searchsorted(a,1)
Out[132]: 0
In [133]: searchsorted(a,6)
Out[133]: 3
In [134]: searchsorted(a,[9,54,1])
Out[134]: array([4, 6, 0])
In [135]: searchsorted(a,[9,54,1,0])
Out[135]: array([4, 6, 0, 0])
***> # here 0 is not in the list, but turns up @ position 0***
In [136]: searchsorted(a,740)
Out[136]: 7
***> # here 0 is not in the list, but turns up @ position 7***
为什么会出现这种情况?