I am running a python script using pandas.read_csv
to import a csv file. Pandas provides console warnings when it doesn't see what it expects such as:
Skipping line 163: Expected 41 fields in line 163, saw 42
How can I log this to a text file?
If I run the script from a command line, python > logfile.txt
only the output of print shows up in the file, not the warnings.