[Python] Pandas - apply multiplication factor to column values

Discussão em 'Python' iniciado por Stack, Setembro 5, 2025.

  1. Stack

    Stack Membro Participativo

    I have I dataframe:

    cases_df = pd.DataFrame(list(cases.items()),
    columns=['day', 'cases'])


    where case.items() is structured like so:

    ([('2020-04-04T00:00:00Z', 10360), ('2020-04-05T00:00:00Z', 11130), ('2020-04- 06T00:00:00Z', 12161)])


    how can I apply a multiplication factor, say 'x', only to 'cases' column?

    example x = 100:

    '2020-04-04T00:00:00Z' 1036000
    '2020-04-05T00:00:00Z' 1113000
    '2020-04- 06T00:00:00Z' 1216100

    Continue reading...

Compartilhe esta Página