【问题标题】:I am not able to upload the github data link to Google Colab我无法将 github 数据链接上传到 Google Colab
【发布时间】:2020-01-25 22:54:50
【问题描述】:

我正在尝试什么: url ='https://github.com/Anubhav1107/Machine_Learning_A-Z/blob/master/Part%202%20-%20Regression/Section%205%20-%20Multiple%20Linear%20Regression/50_Startups.csv'

dataset = pd.read_csv(url)

我得到了什么:


3 帧 /usr/local/lib/python3.6/dist-packages/pandas/io/parsers.py in read(self, nrows) 1993 def read(self, nrows=None): 1994
尝试: -> 1995 data = self._reader.read(nrows) 1996 除了 StopIteration: 1997 if self._first_chunk:

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.read()

pandas/_libs/parsers.pyx 在 pandas._libs.parsers.TextReader._read_low_memory()

pandas/_libs/parsers.pyx 在 pandas._libs.parsers.TextReader._read_rows()

pandas/_libs/parsers.pyx 在 pandas._libs.parsers.TextReader._tokenize_rows()

pandas/_libs/parsers.pyx in pandas._libs.parsers.raise_parser_error()

ParserError:标记数据时出错。 C 错误:预期有 1 个字段在行 75,锯7

【问题讨论】:

    标签: pandas github


    【解决方案1】:

    改用这个。

    url = 'https://raw.githubusercontent.com/Anubhav1107/Machine_Learning_A-Z/master/Part%202%20-%20Regression/Section%205%20-%20Multiple%20Linear%20Regression/50_Startups.csv'
    

    否则你只会得到 HTML,而不是 CSV。

    【讨论】: