0

I want create a Dataframe from excel file. I am using pandas read_excel function. My requirement is to create a Dataframe for all elements if the column matches some value.

For eg:- Below is my excel file and I want to create the Dataframe with all elements that has Module equal to 'DC-Prod'

Exccel File Image

1

1 Answer 1

1

Welcome, Saagar Sheth!

to make a Dataframe, just import "pandas" it like so...

import pandas as pd

then create a variable for the file to access, like this;

file_var_pandas = 'customer_data.xlsx'

and then, create its dataframe using the read_excel;

customers = pd.read_excel(file_var_pandas,
sheetname=0,
header=0,
index_col=False,
keep_default_na=True
)

finally, use the head() command like so;

customers.head()

if you want to know more just go to this website!

Packet Pandas Dataframe

and have fun!

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Ron, Thanks for the reply. However if you could please refer the snippet of excel file as my requirement is not just creating a dataframe but reading all the row which will have the value in Module column as 'DC-Prod'
Thanks but i have already checked the pandas documentation. Not much help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.