[Python] In Python, how can I replace a number from a numpy array with 2 others?

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

  1. Stack

    Stack Membro Participativo

    I'm trying to replace for example [1,2,3,4,5,6] and replace the 4s and 6s with 2,2 and 2,3 respectively thus returning [1,2,3,2,2,5,2,3] Is there an efficient way to do this?

    I tried with np.select to little results and couldn't find a lot more

    Continue reading...

Compartilhe esta Página