A text file looked like this. I want to covert it into a CSV file.
With Pandas, when I used:
df = pd.read_fwf(f)
It looks like:
It seems there are tab and space used for delimiters, I changed the line to:
df = pd.read_csv('Water level.txt' , sep = '[" "|\t]', encoding='GBK', engine = 'python')
But it warns:
pandas.errors.ParserError: Expected 14 fields in line 4, saw 16. Error could possibly be due to quotes being ignored when a multi-char delimiter is used.
What's the right way with Python to convert it into a CSV file?