I am able to load a csv file fine into a pandas dataframe with the panda defaults:
df = pd.read_csv(file)
>>> df
distance recession_velocity
0
Python's file objects will automatically translate \r\n
to \n
in text mode. read_csv
uses its own file handling, it will indeed see \r\n
instead, so if you pass lineterminator="\n"
it will really just trim that one character.
If you don't pass the lineterminator
parameter at all, it will guess the line-ending style. You can also pass in a file object instead of a path. This may slow things down a bit, but it will give you the same transformation behaviour that you see when you do a straight read.