Find and bold duplicates with python macro

I have a python macro, that does many things with my workbook, but I would like to add to it a function that goes through the columns on the first sheet, finds duplicates by row, removes any that are found, and bolds the remaining instance. The data is already sorted, so it is enough to compare the cell to the one before.

What I was thinking, in pseudocode, is:

oSheet1 = oDoc.getSheets().getByIndex(0)
for column in oSheet1:
    for cell (starting from 2) in column:
        if cell == cell-1:
            remove(cell-1)
            bold(cell)

Can anyone give examples on how to do this, or if there is a better way?

Edit: Here is an example. The sheet “Raw Data” has an example of how the data is formatted. “Desired Result” is an example of what I would like to have

example.ods

I don’t understand “finds duplicates by row”, what exactly do? better, attach file with an example.

I mean find duplicate cells by going through the column row by row

Try:

from collections import Counter

def mark_duplicate():
    BOLD = 150

    doc = XSCRIPTCONTEXT.getDocument()
    sheet = doc.Sheets['Raw data']
    target = doc.Sheets['Desired Result']
    cursor = target.createCursorByRange(target[0,0])
    cursor.collapseToCurrentRegion()
    cursor.clearContents(1023)

    cursor = sheet.createCursorByRange(sheet[0,0])
    cursor.collapseToCurrentRegion()
    data = cursor.DataArray

    for col in range(len(data[0])):
        values = tuple(zip(*data))[col]
        counter = Counter(filter(None, values))
        row = 0
        for k, v in counter.items():
            cell = target[row, col]
            cell.String = k
            if not v == 1:
                cell.CharWeight = BOLD
            row += 1
    return

This works. Thank you kindly.