[Python] Pandas fillna(method='ffill') vs ffill()

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

  1. Stack

    Stack Membro Participativo

    ffill() outperformed fillna(method='ffill'), are they doing the same thing? If so why are they different in performance? Is ffill() implemented in Cython?

    df = pd.DataFrame([[np.nan, 2, np.nan, 0],
    [3, 4, np.nan, 1],
    [np.nan, np.nan, np.nan, 5],
    [np.nan, 3, np.nan, 4]],
    columns=list('ABCD'))
    df.fillna(method='ffill')
    #vs
    df.ffill()

    Continue reading...

Compartilhe esta Página