filmov
tv
Reading data from Excel file and creating Pandas DataFrame using read_excel() in Python with options

Показать описание
We can read one excel file from our system and using that we can create Pandas DataFrame. We will use read_excel() method for reading data from local system.
import pandas as pd
The path we used here is D drive and my_data as directory , you can change it based on location of excel file.
sheet_name
By default it will read the first worksheet of we can specify the worksheet number as 0 ( default ) , 1 etc. We can write the worksheet name also.
index_col
Dataframe will add one index column, we can specify to use one of our column as index column by saying index_col
header
By default the column header is 0. We can give integer values. Here is the code to start from 1st row
We can specify not to use any header and use all as data
names
We can specify our one list of names to be used as headers.
cl=['c1','c2','c3','c4']
#pandas_read_excel #dataframereadexcel #pandasexcel #plus2net #pandas #datascience #pandastutorials
import pandas as pd
The path we used here is D drive and my_data as directory , you can change it based on location of excel file.
sheet_name
By default it will read the first worksheet of we can specify the worksheet number as 0 ( default ) , 1 etc. We can write the worksheet name also.
index_col
Dataframe will add one index column, we can specify to use one of our column as index column by saying index_col
header
By default the column header is 0. We can give integer values. Here is the code to start from 1st row
We can specify not to use any header and use all as data
names
We can specify our one list of names to be used as headers.
cl=['c1','c2','c3','c4']
#pandas_read_excel #dataframereadexcel #pandasexcel #plus2net #pandas #datascience #pandastutorials