Answers for "ellipsis python"

1

ellipsis python

# Ellipsis is an object that can appear in slice notation. 
# For example:
myList[1:2, ..., 0]

'''
>>> a
array([[ 1,  2,  3,  4],
       [ 5,  6,  7,  8],
       [ 9, 10, 11, 12],
       [13, 14, 15, 16]])

>>> a[:2,:2]  # Ellipsis top left
array([[1, 2],
       [5, 6]])
'''
Posted by: Guest on April-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language