close

how to read certain columns from Excel using Pandas – Python

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about how to read certain columns from Excel using Pandas – Python in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

how to read certain columns from Excel using Pandas – Python?

  1. how to read certain columns from Excel using Pandas – Python?

    “usecols” should help, use range of columns (as per excel worksheet, A,B…etc.) below are the examples
    1. Selected Columns

  2. read certain columns from Excel using Pandas – Python

    “usecols” should help, use range of columns (as per excel worksheet, A,B…etc.) below are the examples
    1. Selected Columns

Method 1

parse_cols is deprecated, use usecols instead

that is:

df = pd.read_excel(file_loc, index_col=None, na_values=['NA'], usecols = "A,C:AA")

Method 2

“usecols” should help, use range of columns (as per excel worksheet, A,B…etc.) below are the examples

1. Selected Columns

df = pd.read_excel(file_location,sheet_name='Sheet1', usecols="A,C,F")

2. Range of Columns and selected column

df = pd.read_excel(file_location,sheet_name='Sheet1', usecols="A:F,H")

3. Multiple Ranges

df = pd.read_excel(file_location,sheet_name='Sheet1', usecols="A:F,H,J:N")

4. Range of columns

df = pd.read_excel(file_location,sheet_name='Sheet1', usecols="A:N")

Conclusion

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read