[Python] How can I create duplicate dataframes from list of existing dataframes Python?

Discussão em 'Python' iniciado por Stack, Maio 19, 2025.

  1. Stack

    Stack Membro Participativo

    Task

    • Create a set of duplicate dataframes with a different set of names, such as item28, item30, item31...item38.
    • After creating the new copies, I then have to modify the contents of specific columns.

    Current Process

    • Step 1: Create new dataframes by copying the original:

    item28 = item1.copy();
    item29 = item2.copy();
    item30 = item3.copy();
    item31 = item4.copy();
    item32 = item5.copy();
    item33 = item6.copy();
    item34 = item7.copy();
    item35 = item8.copy();
    item36 = item9.copy();
    item37 = item10.copy();
    item38 = item11.copy();

    • Step 2. Modify the columns in the new data frame: item28['indicator_number'] = 28;

    Goal

    • Reproduce this manual process in a dynamic, Pythonic way.

    Continue reading...

Compartilhe esta Página