[Python] Using Python to change Excel cell value from 'YES' to 'TRUE'

Discussão em 'Python' iniciado por Stack, Junho 4, 2025.

  1. Stack

    Stack Membro Participativo

    Screenshot attached

    I've put together a Python code to import an .xlsx file and re-order the columns (which I'm pleased to say is working how i want it to) but i've spent most of the day trying to work out how to change a specific column, which contains either 'YES' or 'NO' value, to 'TRUE' (for yes) and 'FALSE' (for no).

    I figure there are possible ways:

    1. search the whole xlsx file for the 'YES' or 'NO' value and replace this text
    2. specifify the column name and do a search only it that column.

    I would much prefer to use the 2nd option as 'YES' is also contained in other columns and needs to remain as 'YES'

    I've watched endless youtube videos and visited a endless number of URLs today but havent found the answer - what python code do i need to add to my .py file please?

    Thank you in advance

    Continue reading...

Compartilhe esta Página