[Python] How to drop only the null cells in pandas dataframe and shift the values up?

Discussão em 'Python' iniciado por Stack, Dezembro 21, 2024.

  1. Stack

    Stack Membro Participativo

    I can drop entire row/column using drop(), how to drop a single cell and shifting the next value up without dropping the entire row. Is there any in-built function for this?

    My table looks like this,

    SMA_5 Pandas_5
    54 nan
    34 nan
    54 nan
    32 nan
    51 89
    94 90
    51 70
    32 31
    ... ...
    ...etc ...etc

    and i want the result like this:

    SMA_5 Pandas_5
    54 89
    34 90
    54 70
    32 31
    51 98
    94 13
    51 23
    32 13
    ... ...
    ...etc ...etc

    Continue reading...

Compartilhe esta Página