9
でnumpyの整数配列にゼロを交換して、私は下のPythonスクリプトを書いた:ナン
import numpy as np
arr = np.arange(6).reshape(2, 3)
arr[arr==0]=['nan']
print arr
しかし、私はこのエラーを得た:
Traceback (most recent call last):
File "C:\Users\Desktop\test.py", line 4, in <module>
arr[arr==0]=['nan']
ValueError: invalid literal for long() with base 10: 'nan'
[Finished in 0.2s with exit code 1]
ナンでnumpyの配列にゼロを交換する方法?
の可能な重複 - (http://stackoverflow.com/questions/6701714/numpy-replace-a-number-with-nan)numpyのはNaNと番号を交換] – trblnc