import pandas as pd import io txt = io.StringIO(""" col1 col2 a 1 b 2 c 3 d 4 """) df = pd.read_csv(txt, sep="\t") df