I'm trying to read an excel file with Pandas.
I'm trying to only read column 2 through column 4.
I'm trying to skip reading the first 9 rows.
- Even with,
skiprows=8, parse_col=["B:D"],my data stored indflooks the same as the incoming excel file, and it doesn't exclude the first 9 rows or exclude the desired columns.
What is wrong with my syntax and why isn't the database structure stored in df my inputted excel file minus 9 rows and a few columns?
My incoming data below:
Null,Null,Null,Null,Null,Null,Null,Null,Null
Null,Null,Null,Null,Null,Null,Null,Null,Null
Null,Null,Null,Null,Null,Null,Null,Null,Null
Null,Null,Null,Null,Null,Null,Null,Null,Null
Null,Null,Null,Null,Null,Null,Null,Null,Null
Null,Null,Null,Null,Null,Null,Null,Null,Null
Null,Null,Null,Null,Null,Null,Null,Null,Null
Null,Null,Null,Null,String1,String2,Null,Null,Null
Null,Phase to Phase Voltage,A - B,210.0,C - A,211.0,B - C,212.0
Null,Circuit/Breaker,Number,Internal Meter Amps,External Meter Amps,Measured Difference,% Difference,Location Identifier,Total Location Amperage,Comments
Null,Main Phase A,94.1,96.,2.8,3%,Null,Null,Null
Null,Main Phase B,90.1,92.6,2.5,3%,Null,Null,Null
Null,Main Phase C,91.9,92.1,0.2,0%,Null,Null,Null
Null,Neutral,0.0,0.4,0.4,100%,Null,Null,Null
Null,Ground 0.0,0.1,0.1,100%,Null,Null,Null
Null,1,10.6,10.2,-0.4,-4%,Null,Null,Null
Null,2,10.6,10.3,-0.3,-3%,Null,Null,Null
....
My code is below:
import pandas as pd
df = pd.read_excel('filelocation.xlsx', sheetname=['pnl1 Data ','pnl2 Data','pnl3 Data','pnl4 Data'], skiprows=8, parse_col=["B:D"], keep_default_na='FALSE', na_values=['NULL'])
sheet name) instead of several ? If you try to read several sheetsread_excelreturns a Dict ofDataFrames, with keys representing sheets. I think that reproducing the problem with only one sheet could permit to locate the problem.df = pd.read_excel('C:/Users/Jerry/Documents/panoptics/panopticsMeeting2.28.16/FDC 1301 Data Collection (upTo48BreakerDevice) - original.xlsx', sheetname=['pnl1 Data '], skiprows=8, parse_col=["B:D"], keep_default_na='FALSE', na_values=['NULL'])