[Python] How to erase segments where NaN values in a plot

Discussão em 'Python' iniciado por Stack, Março 12, 2025.

  1. Stack

    Stack Membro Participativo

    I have a date column and other columns with some NaN values. I'd like to only have a plot for non-nan values, but there are segments between 2 non-nan values values (see image).

    plt.figure()
    plt.plot(merge_nal_cont["Date"], merge_nal_cont["GPP_DT_uStar"], label="daytime")
    plt.plot(merge_nal_cont["Date"], merge_nal_cont["GPP_uStar_f"], label="nighttime")
    plt.grid()
    plt.legend()
    plt.title("GPP à Nalohou")
    plt.show()


    [​IMG]

    Continue reading...

Compartilhe esta Página