Equivalent of np.delete?

There is InvertedIndices.jl, which combined with selectdim might be the closest translation:

julia> using InvertedIndices: Not

julia> A = rand(Int8,4,5,3)
4×5×3 Array{Int8, 3}:
[:, :, 1] =
 -16   -71    64  -56   10
  42  -116  -111  106  -52
 -82     5    75  -75  -65
  89   -53    40   32  -74

[:, :, 2] =
   29   24   -77   21  -30
  -87  -38    64   40   51
   30  -84    44  -52  -29
 -118   55  -103   64  -97

[:, :, 3] =
 -109   52   32  100  -83
  -82   86  -24  117  121
  118   32  108   82   29
  124  106  -23  -87   62

julia> selectdim(A, 2, Not(2:4))
4×2×3 view(::Array{Int8, 3}, :, [1, 5], :) with eltype Int8:
[:, :, 1] =
 -16   10
  42  -52
 -82  -65
  89  -74

[:, :, 2] =
   29  -30
  -87   51
   30  -29
 -118  -97

[:, :, 3] =
 -109  -83
  -82  121
  118   29
  124   62

julia> ans == A[:, Not(2:4), :]
true
1 Like