[Python] Find points in curve

Discussão em 'Python' iniciado por Stack, Abril 24, 2025.

  1. Stack

    Stack Membro Participativo

    Can you share some ideas of how to find curve points (orange color marked places) like shown in picture: [​IMG]

    I've tried this code:

    result = []
    for i in range(len(df)):
    if i == 0 or df['y'].iloc != df['y'].iloc[i - 1]:
    result.append(df.iloc)
    continue
    if i < len(df) - 1 and df['y'].iloc != df['y'].iloc[i + 1]:
    result.append(df.iloc)


    but the problem is, my 'y' isn't always equal between breakpoints and returns too many values. Could you give some advice, how to achieve my goal?

    Used data for picture:

    time = np.arange(0, 2200, 100)
    values = np.array([-0.1, 0, 0.13, 0.27, 0.27, 0.4, 0.27, 0.27, 0.13, 0.13,
    0.01, 0.01, -0.13, -0.13, -0.27, -0.4, -0.4, -0.27, -0.13, -0.13, 0, 0])

    full_time = np.arange(0, 2200, 1)
    full_values = np.interp(full_time, time, values)

    Continue reading...

Compartilhe esta Página