I want a python code that will read and pasrse the excel file. It must take each
ID: 3904140 • Letter: I
Question
I want a python code that will read and pasrse the excel file. It must take each number (1,2,3,4,5,6,7) and make them column headers. Then I want each Time stamp values to be on the corressponding row headers. Each RANDOMSTRING should be under its corresponding column headers
? Book1 Excel Sign in -? × File Home Insert Draw Page Layout FormulasData Review View JMP Tell me what you want to do 2 Share A422 Formula Bar tzoffset name 1 datetime 2 0000-00-26T16:38:08.000Z UTC -04:00 3 0000-00-26T16:38:08.0002 UTC -04:00 4 0000-00-26T16:38:08.000Z UTC -04:00 5 0000-00-26T16:38:08.000Z UTC -04:00 6 0000-00-26T16:38:08.0002 UTC-04:00 7 0000-00-26T16:38:08.000Z UTC-04:00 8 0000-00-26T16:38:08.000Z UTC -04:00 9 0000-00-26T16:38:09.0002 UTC-04:00 10 0000-00-26T16:38:09.000Z UTC -04:00 11 0000-00-26T16:38:09.000Z UTC -04:00 12 0000-00-26T16:38:09.0002 UTC -04:00 13 0000-00-26T16:38:09.000Z UTC -04:00 14 0000-00-26T16:38:09.000Z UTC -04:00 150000-00-26T16:38:09 .000Z UTC-04:00 16 0000-00-26T16:38:10.000Z UTC -04:00 17 0000-00-26T16:38:10.0002 UTC -04:00 18 0000-00-26T16:38:10.000Z UTC-04:00 19 0000-00-26T16:38:10.0002 UTC -04:00 20 0000-00-26T16:38:10.0002 UTC -04:00 21 0000-00-26T16:38:10.000Z UTC-04:00 22 0000-00-26T16:38:10.000ZUTC -04:00 string 1 RANDOMSTRING 2 RANDOMSTRING 3 RANDOMSTRING 4 RANDOMSTRING 5 RANDOMSTRING 6 RANDOMSTRING 7 RANDOMSTRING 1 RANDOMSTRING 2 RANDOMSTRING 3 RANDOMSTRING 4 RANDOMSTRING 5 RANDOMSTRING 6 RANDOMSTRING 7 RANDOMSTRING 1 RANDOMSTRING 2 RANDOMSTRING 3 RANDOMSTRING 4 RANDOMSTRING 5 RANDOMSTRING 6 RANDOMSTRING 7 RANDOMSTRING 24 Sheet1 + 100%Explanation / Answer
1)parsing
import pandas as pd
xls = pd.ExcelFile("yourfilename.xls")
sheetX = xls.parse(2) #2 is the sheet number
var1 = sheetX['ColumnName']
print(var1[1]) #1 is the row number...
2)
python xlrd library can better solution for this problem
import xlrd
to open a workbook
workbook = xlrd.open_workbook('your_file_name.xlsx')
open sheet by name
worksheet = workbook.sheet_by_name('Name of the Sheet')
open sheet by index
worksheet = workbook.sheet_by_index(0)
read cell value
worksheet.cell(0, 0).value
3)import pandas as pd
dfs = pd.read_excel("your_file_name.xlsx", sheet_name="your_sheet_name")
print(dfs.head(10))
You need to have the xlrd installed for read_excel function to work
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.