[Python] Pandas apply does not modify DataFrame

Discussão em 'Python' iniciado por Stack, Julho 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am just starting pandas so please forgive if this is something stupid.

    I am trying to apply a function to a column but its not working and i don't see any errors also.

    capitalizer = lambda x: x.upper()
    for df in pd.read_csv(downloaded_file, chunksize=2, compression='gzip', low_memory=False):
    df['level1'].apply(capitalizer)
    print df
    exit(1)


    This print shows the level1 column values same as the original csv not doing upper. Am i missing something here?

    Continue reading...

Compartilhe esta Página