Pandas dataframe read_csv on bad data

后端 未结 3 1938
庸人自扰
庸人自扰 2020-12-02 22:13

I want to read in a very large csv (cannot be opened in excel and edited easily) but somewhere around the 100,000th row, there is a row with one extra column causing the pro

3条回答
  •  情话喂你
    2020-12-02 22:41

    pass error_bad_lines=False to skip erroneous rows:

    error_bad_lines : boolean, default True Lines with too many fields (e.g. a csv line with too many commas) will by default cause an exception to be raised, and no DataFrame will be returned. If False, then these “bad lines” will dropped from the DataFrame that is returned. (Only valid with C parser)

提交回复
热议问题