1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How can I inverse a slice of an array?

Discussão em 'Python' iniciado por Stack, Setembro 10, 2024.

  1. Stack

    Stack Membro Participativo

    I want to do something along the lines of...

    import numpy as np

    arr = np.linspace(0, 10, 100)
    s = slice(1, 10)
    print(arr)
    print(arr[~s])


    How could I apply the "not" operator to a slice, so that in this case arr[~s] would be the concatenation of arr[0] and arr[10:]?

    Continue reading...

Compartilhe esta Página