[Python] pandas.pct_change weirdness

Discussão em 'Python' iniciado por Stack, Fevereiro 3, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to figure out percent change of values between rows and pandas.pct_change() gives me other values than when I do the math myself. Can someone explain? [​IMG]

    I can't figure out where I am doing wrong. my "manual" Formula is: 100 - (prev/current *100)

    close manual calculation Pandas ptc_change
    0.7419 #VALUE! NaN
    0.7406 -0.175533351 -0.175226
    0.736 -0.625 -0.621118
    0.733 -0.409276944 -0.407609
    0.7409 1.066270752 1.077763
    0.7371 -0.515533849 -0.51289
    0.7371 0 0
    0.7324 -0.641725833 -0.637634
    0.7115 -2.937456079 -2.853632
    0.7107 -0.112565077 -0.112439

    Continue reading...

Compartilhe esta Página