[Python] How to rename columns in multiple csv files in a folder?

Discussão em 'Python' iniciado por Stack, Agosto 11, 2025.

  1. Stack

    Stack Membro Participativo

    I have two csv files in a folder

    https://www.dropbox.com/sh/jyu2rj2ra01vuvb/AADht6uAhJcjnSjIFpNufVlka?dl=0

    How to rename the columns of all the files in the folder as the following

    S.No Fruit Vendor Price


    Input:

    Expected Output:

    File df1

    S.No Fruit VendorA PriceA
    1 Apple AB 89
    2 Banana CA 72


    File df2

    S.No Fruit VendorB PriceB
    1 Mango AB 55
    2 Watermelon BC 23


    Expected Output:

    File df1

    S.No Fruit Vendor Price
    1 Apple AB 89
    2 Banana CA 72


    File df2

    S.No Fruit Vendor Price
    1 Mango AB 55
    2 Watermelon BC 23

    Continue reading...

Compartilhe esta Página