简体   繁体   中英

Pandas Skipping lines(Stop warnings from showing)

I am reading a csv file in python this way using pandas

data = pd.read_csv('file1.csv', error_bad_lines=False)

I am getting Skipping line 6: expected 4 fields, saw 6

How do i stop this warnings from showing up? Thanks

来自文档

data = pd.read_csv('file1.csv', error_bad_lines=False, warn_bad_lines=False)

From the docs :

warn_bad_lines : boolean, default True

If error_bad_lines is False, and warn_bad_lines is True, a warning for each “bad line” will be output.

So set warn_bad_lines=False

data = pd.read_csv('file1.csv', error_bad_lines=False, warn_bad_lines=False)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM