单项选择题

以下用于求NumPy一维数组arr中非0元素的位置索引的是()。

A.arr[arr!=0]
B.arr.index(arr!=0)
C.arr.findall(arr!=0)
D.np.where(arr!=0)