from collections import Counter
from openpyxl import load_workbook
nomefile = 'SerieA18_19.xlsx'
wb = load_workbook(nomefile)
ws = wb.worksheets
sheet = wb.active
max_row = sheet.max_row
results = []
for i in range(1, max_row + 1):
cell_obj = sheet.cell(i, 1).value
cell_obj.strip()
cell_obj.replace('\\xa0', ' ')
if cell_obj[2:3] == '-':
results.append(cell_obj)
if cell_obj[3:4] == '-' and cell_obj[:1] != '(':
results.append(cell_obj)
results_counter = Counter()
for response in results:
results_counter.update(response.split(','))
print(results_counter)
OUTPUT is as follows : Counter({'1\xa0-\xa01': 44, '2\xa0-\xa01': 39, '1\xa0-\xa00': 35, '0\xa0-\xa00': 34, '2\xa0- \xa00': 28, '0\xa0-\xa01':
I am not able to delete/replace these '\xa0' that are probably coming from the Excel file