# How to Read a Text File in Pandas?

## Problem –

You want to read a text file in pandas.

## Solution –

To read a text file in pandas we use the read_csv method along with the delimiter that is used in the file. Your file could have other delimiter like tab ( ‘\t’ ) , commas ( ‘,’ ), space ( ‘ ‘ ) etc. Here we have semicolon so we used that.

import pandas as pd

df.head()