我要做的是使用matplotlib、basemap、python等在地图上绘制特定风暴的纬度和经度值。我的问题是,我试图提取地图上风暴的纬度、经度和名称,但在第41-44行之间,我一直会出现错误,在第41-44行之间,我试图将列提取到列表中。有人能帮我弄清楚吗。提前谢谢。
文件如下所示:1957,AUDREY,HU, 21.6N, 93.3W
1957,AUDREY,HU,22.0N, 93.4W
1957,AUDREY,HU,22.6N, 93.5W
1957,AUDREY,HU,23.2N, 93.6W
我希望列表如下所示:latitude = [21.6N,22.0N,23.4N]
longitude = [93.3W, 93.5W,93.8W]
name = ["Audrey","Audrey"]
以下是我目前掌握的情况:data = np.loadtxt('louisianastormb.csv',dtype=np.str,delimiter=',',skiprows=1)
'''print data'''
data = np.loadtxt('louisianastormb.csv',dtype=np.str,delimiter=',',skiprows=0)
f= open('louisianastormb.csv', 'rb')
reader = csv.reader(f, delimiter=',')
header = reader.next()
zipped = zip(*reader)
latitude = zipped[3]
longitude = zipped[4]
names = zipped[1]
x, y = m(longitude, latitude)
这是我收到的最后一条错误消息/回溯:Traceback (most recent call last):
File "/home/darealmzd/lstorms.py", line 42, in
header = reader.next()
_csv.Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?