How to read file with space separated values in pandas

yemu picture yemu · Oct 28, 2013 · Viewed 122.3k times · Source

I try to read the file into pandas. The file has values separated by space, but with different number of spaces I tried:

pd.read_csv('file.csv', delimiter=' ')

but it doesn't work

Answer

HYRY picture HYRY · Oct 28, 2013

add delim_whitespace=True argument, it's faster than regex.