我不知道出了什么问题,但我无法将一个简单的.csv文件导入我的colab工作区。
我写了以下代码:
# set the url of the data
data_url =r'C:UsersStartklarDesktop20210709_CL1_PX_SETTLE.csv'
# read the alphabet data
cl1_data = pd.read_csv(data_url, sep=';')
系统总是告诉我以下错误信息:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-79-1e0d246819b0> in <module>()
3
4 # read the alphabet data
----> 5 cl1_data = pd.read_csv(data_url, sep=';')
4 frames
/usr/local/lib/python3.7/dist-packages/pandas/io/parsers.py in __init__(self, src, **kwds)
2008 kwds["usecols"] = self.usecols
2009
-> 2010 self._reader = parsers.TextReader(src, **kwds)
2011 self.unnamed_cols = self._reader.unnamed_cols
2012
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()
FileNotFoundError: [Errno 2] No such file or directory: `'C:\Users\Startklar\Desktop\20210709_CL1_PX_SETTLE.csv'`
我绝对确信url是正确的,当然文件存在于上述路径中。怎么了?
您可能需要稍微更改url。
filepath = "C:\Users\DELL\txt.csv"
帮助python解析文件路径并通过colab或jupyter ntbk访问它。第二行代码似乎适合