Change language

# numpy.tri () in Python

|

numpy.tri (R, C = No, k = 0, dtype = & # 39; float & # 39;): Creates an array with 1 at and below the given diagonal (about k) and 0 elsewhere.
Parameters :

R:  Number of rows  C:  [optional] Number of columns; By default R = C  k:  [int, optional, 0 by default] Diagonal we require; k" 0 means diagonal above main diagonal or vice versa.  dtype:  [optional, float (byDefault)] Data type of returned array.

 # Python program illustrating # numpy.tri method   import numpy as geek   print ( "tri with k = 1:" , geek.tri ( 2 , 3 , 1 , dtype = float ), "" )   print ( " tri with main diagonal: " , geek.tri ( 3 , 5 , 0 ), "" )   print ( "tri with k = -1:" , geek.tri ( 3 , 5 , - 1 ), "" )

Exit:

tri with k = 1: [[1. 1. 0.] [1. 1. 1.]] tri with main diagonal: [[1. 0. 0. 0. 0 .] [1. 1. 0. 0. 0.] [1. 1. 1. 0. 0.]] tri with k = -1: [[0. 0. 0. 0. 0.] [1. 0. 0. 0. 0.] [1. 1. 0. 0. 0.]]

https: / /docs.scipy.org/doc/numpy/reference/generated/numpy.tri.html
Notes:
These NumPy-Python programs will not work with onlineID, so run them on your systems to examine them
,

## Shop

Learn programming in R: courses

\$

Best Python online courses for 2022

\$

Best laptop for Fortnite

\$

Best laptop for Excel

\$

Best laptop for Solidworks

\$

Best laptop for Roblox

\$

Best computer for crypto mining

\$

Best laptop for Sims 4

\$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

NUMPYNUMPY

How to convert Nonetype to int or string?

NUMPYNUMPY

How to specify multiple return types using type-hints

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

## Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method