How to record bad lines skipped by pandas

旧街凉风 提交于 2019-11-29 16:24:17

Warnings are printed in the standard error channel. You can capture them to a file by redirecting the sys.stderr output.

import sys
import pandas as pd

with open('bad_lines.txt', 'w') as fp:
    sys.stderr = fp
    pd.read_csv('my_data.csv', error_bad_lines=False)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!