Table of Contents
The process of reading specific columns from an Excel file using Pandas involves using the Pandas library in Python to import the Excel file as a data frame. The specific columns to be read can then be selected by indexing or specifying their names. This allows for efficient and targeted data extraction from the Excel file, making it easier to manipulate and analyze the data. Additionally, using Pandas provides access to various data manipulation and analysis functions, making it a powerful tool for handling Excel data.
Pandas: Read Specific Columns from Excel File
You can use the following methods to read specific columns from an Excel file into a pandas DataFrame:
Method 1: Read Specific Columns
df = pd.read_excel('my_data.xlsx', usecols='A, C')
Method 2: Read a Range of Columns
df = pd.read_excel('my_data.xlsx', usecols='A:C')
Method 3: Read Multiple Ranges of Columns
df = pd.read_excel('my_data.xlsx', usecols='A:C, F, G:J')
The following examples show how to use each method in practice with the following Excel file called player_data.xlsx:

Example 1: Read Specific Columns
We can use the following code to import the data in columns A and C from the Excel file:
import pandas as pd #import columns A and C from Excel file df = pd.read_excel('player_data.xlsx', usecols='A, C')#view DataFrame print(df) team rebounds 0 A 8 1 B 12 2 C 4 3 D 4 4 E 6 5 F 7
Notice that only the data from columns A and C in the Excel file were imported.
Example 2: Read a Range of Columns
We can use the following code to import the data in columns A through C from the Excel file:
import pandas as pd #import columns A through C from Excel file df = pd.read_excel('player_data.xlsx', usecols='A:C')#view DataFrame print(df) team points rebounds 0 A 24 8 1 B 20 12 2 C 15 4 3 D 19 4 4 E 32 6 5 F 13 7
Notice that only the data from columns A through C in the Excel file were imported.
Example 3: Read Multiple Ranges of Columns
We can use the following code to import the data in columns A through C and column D from the Excel file:
import pandas as pd #import columns A through C from Excel file df = pd.read_excel('player_data.xlsx', usecols='A:C, D')#view DataFrame print(df) team points rebounds assists 0 A 24 8 5 1 B 20 12 3 2 C 15 4 7 3 D 19 4 8 4 E 32 6 8 5 F 13 7 9
Notice that the data from columns A through C and column D in the Excel file were imported.
Note: You can find the complete documentation for the pandas read_excel() function .
The following tutorials explain how to perform other common tasks in pandas:
Cite this article
stats writer (2024). How can I read specific columns from an Excel file using Pandas?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-read-specific-columns-from-an-excel-file-using-pandas/
stats writer. "How can I read specific columns from an Excel file using Pandas?." PSYCHOLOGICAL SCALES, 25 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-read-specific-columns-from-an-excel-file-using-pandas/.
stats writer. "How can I read specific columns from an Excel file using Pandas?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-read-specific-columns-from-an-excel-file-using-pandas/.
stats writer (2024) 'How can I read specific columns from an Excel file using Pandas?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-read-specific-columns-from-an-excel-file-using-pandas/.
[1] stats writer, "How can I read specific columns from an Excel file using Pandas?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I read specific columns from an Excel file using Pandas?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
