Skip to content
Y
yTube.SITE v8.0.4
media / worlds / tools / internet oddities
YouTube / video information

Useful NumPy functions you should know! ๐ŸŽš๏ธ

Video information, playback and saved actions.

Useful NumPy functions you should know! ๐ŸŽš๏ธ

Description: #python #coding #programming

00:00:00 zeros()
00:01:29 ones()
00:01:52 full()
00:02:16 eye()
00:03:09 empty()
00:03:59 arange()
00:05:16 linspace()

import numpy as np

# Creates an array with zeros
array = np.zeros((2, 3, 10))
print(array)

# Creates an array with ones
array = np.ones((2, 3, 10))
print(array)

# Creates an array with a given value
array = np.full((2, 3), 9)
print(array)

# Creates an array w/o initializing entries
array = np.empty((2, 3))
print(array)

# Creates an identity matrix with 0s and 1s
array = np.eye(5)
print(array)

# Creates an array with evenly spaced values up to a given range
array = np.arange(0, 100, 0.1) # (start, stop, step)
print(array)

# Creates an array with a set number of values that are evenly spaced
array = np.linspace(0, 10, 5) # (start, stop, num)
print(array)ย Close description
ย ย ย ย ย ย 
Videos related to "Useful NumPy functions you should know! ๐ŸŽš๏ธ"