Skip to content
Advertisement

Remove and add values to ​numpy array

Is there a more efficient way to remove the 0 from the beginning and insert the 20 at the end and retain the shape (1, 20)?

JavaScript

Output:

JavaScript

Advertisement

Answer

You can just select a subset of the current array excluding the first element and then add 20 or whatever scalar you want at the end.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement