久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

'numpy.float64' 對象不可迭代

#39;numpy.float64#39; object is not iterable(numpy.float64 對象不可迭代)
本文介紹了'numpy.float64' 對象不可迭代的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試迭代使用 numpy.linspace 生成的值數組:

I'm trying to iterate an array of values generated with numpy.linspace:

slX = numpy.linspace(obsvX, flightX, numSPts)
slY = np.linspace(obsvY, flightY, numSPts)

for index,point in slX:
    yPoint = slY[index]
    arcpy.AddMessage(yPoint)

這段代碼在我的辦公室電腦上運行良好,但我今天早上坐在家里的另一臺機器上工作,出現了這個錯誤:

This code worked fine on my office computer, but I sat down this morning to work from home on a different machine and this error came up:

File "C:	empgssm_arcpy.1.0.3.py", line 147, in AnalyzeSightLine
  for index,point in slX:
TypeError: 'numpy.float64' object is not iterable

slX 只是一個浮點數組,腳本打印內容沒有問題——只是,顯然是迭代它們.關于導致它崩潰的任何建議以及可能的修復方法?

slX is just an array of floats, and the script has no problem printing the contents -- just, apparently iterating through them. Any suggestions for what is causing it to break, and possible fixes?

推薦答案

numpy.linspace() 為您提供一維 NumPy 數組.例如:

numpy.linspace() gives you a one-dimensional NumPy array. For example:

>>> my_array = numpy.linspace(1, 10, 10)
>>> my_array
array([  1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.,  10.])

因此:

for index,point in my_array

無法工作.您將需要某種二維數組,其中包含兩個二維元素:

cannot work. You would need some kind of two-dimensional array with two elements in the second dimension:

>>> two_d = numpy.array([[1, 2], [4, 5]])
>>> two_d
array([[1, 2], [4, 5]])

現在你可以這樣做了:

>>> for x, y in two_d:
    print(x, y)

1 2
4 5

這篇關于'numpy.float64' 對象不可迭代的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 91精品国产91久久久久久吃药 | 亚洲aⅴ | 男人的天堂久久 | 日韩高清黄色 | 欧美久久一级特黄毛片 | 一区在线播放 | 91麻豆精品一区二区三区 | 国产精品s色 | 亚洲bt 欧美bt 日本bt | 亚洲精品在线观看网站 | 黄a网站| 国产精品99 | 国产va| 久久一区二区三区四区 | 日韩一区三区 | 尤物在线精品视频 | 成人免费一区二区三区视频网站 | 日韩免费视频 | 成人在线观看网址 | 国产精品视频一二三区 | 在线观看免费av网 | 在线国产一区二区 | 国产精品人人做人人爽 | 欧美久久一级特黄毛片 | 欧美日韩一区二区在线观看 | 中文字幕精品一区二区三区精品 | 99久久成人| 日韩一级黄色毛片 | 久久国产一区二区三区 | 激情小说综合网 | 亚洲日日夜夜 | 电影91久久久 | 91精品久久久久久久久99蜜臂 | 亚洲最大看片网站 | 国产91精品久久久久久久网曝门 | 精品欧美乱码久久久久久 | 91色在线视频 | 中国黄色毛片视频 | 青青草原综合久久大伊人精品 | 中文字幕第一页在线 | 午夜小影院 |