[英]Python 3 append array in float32?
当我遍历数据,.csv文件并将每行的值分配给数组元素时,//我需要将值设置为float32,该怎么做? 这有效,但是它们不是我想要的类型吗? 底图抱怨,谢谢!
csvReader = csv.reader(stores)
header = next(csvReader, None)
latIndex = header.index("lati")
lonIndex = header.index("long")
# Make an empty list
coordList = []
# Loop through the lines in the file and get each coordinate
for row in csvReader:
lat = row[latIndex]
lon = row[lonIndex]
result = (lat, lon)
coordList.append(result) # how to make it float32 ?
假设您的意思是numpy.float32(香草python中没有这样的名称):
lat = numpy.float32(row[latIndex])
lon = numpy.float32(row[lonIndex])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.