Read a TSV File into Python


You can read (import) a tab separated values file (.TSV) into Python (pandas) easily. We’ll be using pandas for this because we want to read the file into a DataFrame.

Let’s use a very simple file to prove that this works. Here is what the file looks like in Notepad++

name	number
Bob	24
Sally	39

I created a project in Jupyter Notebook in Anaconda Navigator that’s called Read TSV File to pandas.

import pandas as pd
df = pd.read_csv(r'D:\MyData\Test\people.tsv', sep='\t')
df

At this site we have a post called Read a CSV File into Python.

Leave a Reply