更新时间:2021-07-05 00:59:11
警告显示在标准错误通道中.您可以通过重定向sys.stderr
输出将它们捕获到文件中.
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)