pandas read_csv fix columns to read data with newline characters in data

Viewed 20975

Using pandas to read in large tab delimited file

df = pd.read_csv(file_path, sep='\t', encoding='latin 1', dtype = str, keep_default_na=False, na_values='')

The problem is that there are 200 columns and the 3rd column is text with occasional newline characters. The text is not delimited with any special characters. These lines get chopped into multiple lines with data going into the wrong columns.

There are a fixed number of tabs in each line - that is all I have to go on.

2 Answers
Related