How to read a particular column from CSV file in Python using Pandas

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

Read a specific column from CSV file

# Import the Pandas library as pd
import pandas as pd

# Read a particular column from CSV file
df = pd.read_csv("house_price.csv", usecols=["Price"])

# Display the DataFrame
print(df)

Output:

   Price
0  75000
1  65000
2  60000
3  58000
4  50000
5  90000
6  85000
7  80000
8  95000

Free Learning Resources

Leave a Comment

Your email address will not be published.