2015-11-08 What to do when read_csv fails?ΒΆ

I recently faced some issues with method read_csv which could not read my text file. There was an issue with a null character. So I revisited some old code I wrote long time ago about guessing the schema of a text file: TextFileColumns:

f = TextFileColumns(filename)
for row in f:

Each row is given as a dictionary:

{'Adj_Close': 5.95, 'High': 6.04, 'Open': 5.99, 'Low': 5.92, 'Volume': 5426200, 'Close': 5.95, 'Date': '2012-12-14'}

The function guess the column types based on the first rows. It also guesses the column separator.