python – Reading tab-delimited file with Pandas – works on Windows, but not on Mac
The biggest clue is the rows are all being returned on one line. This indicates line terminators are being ignored or are not present.
You can specify the line terminator for csv_reader. If you are on a mac the lines created will end with
rrather than the linux standard
n or better still the suspenders and belt approach of windows with
pandas.read_csv(filename, sep=t, lineterminator=r)
You could also open all your data using the codecs package. This may increase robustness at the expense of document loading speed.
import codecs doc = codecs.open(document,rU,UTF-16) #open for reading with universal type set df = pandas.read_csv(doc, sep=t)
Another option would be to add
engine=python to the command
pandas.read_csv(filename, sep=t, engine=python)