[python] 幾個常見問題

1.使用numpy.ndarray時遇到
TypeError: type numpy.ndarray doesn't define __round__ method
解決方法:將round方法改爲np.round即可

2 加窗時遇到:
ValueError: Window length M must be a non-negative integer
錯誤原因:值錯誤:窗口長度m必須是非負整數
解決方法:**用math.ceil()或者int()函數取整 **

3 使用griddata插值函數時,遇到:

ValueError: different number of values and points

錯誤原因:值錯誤:插值的點數與值的數量不同,對於插值函數,值的個數和點的個數要一樣
解決方法:在前面調整參數或者函數來讓相應的值和點的個數對應

4 (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
解決方法:在路徑的引號前加一個r或者把路徑上的 "“改成”//"

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章