How to read text file in Python using Pandas

You can read the text file in Python using Pandas with the following code. I highly recommend you This book to learn Python.

Read text file

# Import the Pandas libraray as pd
import pandas as pd

# Read text file
data = pd.read_csv('Data.txt', sep="\t", header=None)

# Display the Data


         0   1
0    Harry  77
1     John  59
2  Hussain  88
3   Satish  93

Free Learning Resources

Leave a Comment

Your email address will not be published.