I am trying to print out the number of duplicates per cell in a column. For example:
Jan-06-12 = 6
Fen-06-12 = 10
? No idea how to do that..all I did was print out the whole column onto IDLE.
wb = load_workbook(filename = r'GenieSales.xlsx', use_iterators = True)
count = 0
ws = wb.get_sheet_by_name(name = 'Sheet1')
for column in ws.iter_rows(range_string =('I2:I51509')): # it brings a new method: iter_rows()
for cell in column:
print cell.internal_value
#print sheet_ranges['I2'].value # D18
#if sheet_ranges['I'].value == 'Jan-06-12':
# print '1'
cell.internal_value
refers to the value stored by Excel. This is always either a string or a number. Dates are numbers based on a calendar with 1900-01-01 as the epoch. If you want to work with the values in Python just use the cell.value
which will convert the Excel value to Python.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.