Last active
March 14, 2018 19:26
-
-
Save christianplazas-wf/67c61b691762c1d95f4a74869e5eb736 to your computer and use it in GitHub Desktop.
ExcelSortScript.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openpyxl | |
import pandas as pd | |
wb = openpyxl.load_workbook('RawCageData.xlsx', data_only=True) | |
sheet = wb['Sheet1'] | |
print(sheet["A1"].value) | |
n = input("Please Enter the Total Number of Devices: ") | |
deviceNum = range(1,n+1) | |
print deviceNum | |
x = sheet.max_row | |
y = sheet.max_column | |
# columnH = [] | |
# columnF = [] | |
# # def | |
deviceDict = {} # This makes a new dict | |
for i in deviceNum: | |
deviceDict[i] = [] #this makes a new list for a device | |
for j in range(1, x): | |
if (sheet.cell(row=j,column = 2).value) == i: | |
columnH = [] | |
# columnF = [] | |
param1 = "H%s" % str(j) | |
# param2 = "F%s" % str(j) | |
#columnH.append(sheet[param1].value) | |
deviceDict[i].append(sheet[param1].value) | |
# columnF.append(sheet[param2].value) | |
#print columnH | |
print deviceDict[i] | |
#dataFrameH = pd.DataFrame(columnH, columns = list("a")) | |
dataFrameH = pd.DataFrame(deviceDict) | |
print dataFrameH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment