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

  • Does this answer your question? [Reading an Excel file in python using pandas](https://stackoverflow.com/questions/17063458/reading-an-excel-file-in-python-using-pandas) – Soumendra Mishra Sep 27 '20 at 12:06

1 Answers1

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!

  • 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' – Saagar Sheth Sep 27 '20 at 11:07
  • maybe this would help; https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html –  Sep 27 '20 at 11:20
  • Thanks but i have already checked the pandas documentation. Not much help – Saagar Sheth Sep 27 '20 at 11:48