Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Algemene Functies voor het Aanmaken van Arrays | Numpy Basisprincipes
Ultieme NumPy

bookAlgemene Functies voor het Aanmaken van Arrays

12345678910
import numpy as np # Сreating a 1D array of zeros with 5 elements zeros_1d = np.zeros(5) print(zeros_1d) # Сreating a 1D array of zeros with specifying dtype zeros_1d_int = np.zeros(5, dtype=np.int8) print(zeros_1d_int) # Сreating a 2D array of zeros of shape 5x3 zeros_2d = np.zeros((5, 3)) print(zeros_2d)
copy
12345678910
import numpy as np # Сreating a 1D array of ones with 5 elements ones_1d = np.ones(5) print(ones_1d) # Сreating a 1D array of ones with specifying dtype ones_1d_int = np.ones(5, dtype=np.int8) print(ones_1d_int) # Сreating a 2D array of ones of shape 5x3 ones_2d = np.ones((5, 3)) print(ones_2d)
copy
1234567
import numpy as np # Сreate an array of fours of size 5 array_fours_1d = np.full(5, 4) # Сreate an array of fives of shape 4x2 array_fives_2d = np.full((4, 2), 5) print(f'1D fours array: {array_fours_1d}') print(f'2D fives array:\n{array_fives_2d}')
copy
Taak

Swipe to start coding

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 6
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

Awesome!

Completion rate improved to 3.7

bookAlgemene Functies voor het Aanmaken van Arrays

Veeg om het menu te tonen

12345678910
import numpy as np # Сreating a 1D array of zeros with 5 elements zeros_1d = np.zeros(5) print(zeros_1d) # Сreating a 1D array of zeros with specifying dtype zeros_1d_int = np.zeros(5, dtype=np.int8) print(zeros_1d_int) # Сreating a 2D array of zeros of shape 5x3 zeros_2d = np.zeros((5, 3)) print(zeros_2d)
copy
12345678910
import numpy as np # Сreating a 1D array of ones with 5 elements ones_1d = np.ones(5) print(ones_1d) # Сreating a 1D array of ones with specifying dtype ones_1d_int = np.ones(5, dtype=np.int8) print(ones_1d_int) # Сreating a 2D array of ones of shape 5x3 ones_2d = np.ones((5, 3)) print(ones_2d)
copy
1234567
import numpy as np # Сreate an array of fours of size 5 array_fours_1d = np.full(5, 4) # Сreate an array of fives of shape 4x2 array_fives_2d = np.full((4, 2), 5) print(f'1D fours array: {array_fours_1d}') print(f'2D fives array:\n{array_fives_2d}')
copy
Taak

Swipe to start coding

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 6
single

single

some-alt