我正在尝试在 spyder 中运行代码并引发错误" return self.do_open(http.client.HTTPConnection, req) File "C:\Users\name\AppData\Local\Continuum\Anaconda3-5.2.0\lib\urllib\request.py", line 1320, in do_open raise URLError(err)URLError: <urlopen error [Errno 11001] getaddrinfo failed>"same code works fine in jupyter notebook. 代码如下import overpyimport pandas as pdimport timeimport osroot = r'C:/Users/(name)/Documents/abc'fstem = 'sample'fname = fstem+'.csv'df = pd.read_csv(os.path.join(root,fname))#df.sort_values(by=['cvdt35_timestamp_s'],inplace=True)print('# of records = '+str(len(df)))api= overpy.Overpass()
1 回答
郎朗坤
TA贡献1921条经验 获得超9个赞
pd.read_csv
将文件名解释为 URL,而不是本地路径。
您可以自己打开文件,并传递文件对象。
with open(os.path.join(root, fname)) as f: df = pd.read_csv(f)
添加回答
举报
0/150
提交
取消