Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python how to copy a 2d array leaving out last column

In [1]: import numpy as np

In [2]: H = np.meshgrid(np.arange(5), np.arange(5))[0]

In [3]: H
Out[3]: 
array([[0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4],
       [0, 1, 2, 3, 4]])

In [4]: Hsub = H[1:-1,1:-1]

In [5]: Hsub
Out[5]: 
array([[1, 2, 3],
       [1, 2, 3],
       [1, 2, 3]])
Comment

PREVIOUS NEXT
Code Example
Python :: python number guessing game 
Python :: pandas add column from list 
Python :: You did not provide the "FLASK_APP" environment variable 
Python :: sklearn accuracy 
Python :: python install gimp 
Python :: how to take second largest value in pandas 
Python :: python gtts 
Python :: coco.py 
Python :: remove after and before space python 
Python :: string to hex python 
Python :: codeforces 677a solution 
Python :: python last element of list 
Python :: matplotlib axes labels 
Python :: how to change a string to small letter in python 
Python :: pygame keys pressed 
Python :: frequency unique pandas 
Python :: how to multiply two tuples in python 
Python :: plot horizontal line in python 
Python :: discordpy 
Python :: write json to file python 
Python :: tkinter change button text 
Python :: converting pandas._libs.tslibs.timedeltas.Timedelta to days 
Python :: python strip newline from string 
Python :: python tkinter treeview get selected item 
Python :: python to golang 
Python :: gamestop 
Python :: Add a quit button Tkinter 
Python :: python download s3 image 
Python :: python count distinct letters 
Python :: selenium zoom out python 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =