FlashKeepers

Data Science · College · College and University

NumPy Fundamentals

NumPy arrays, dtypes, shapes, indexing, slicing, broadcasting, vectorization and linear algebra functions.

About this set

39 basic cards for College Data Science. It opens with "How do you create a NumPy array from a Python list?" and "What does np.zeros((3, 4)) create?". Study it alongside the other College sets below.

39 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

How do you create a NumPy array from a Python list?
Show answerUse np.array() and pass the list as an argument
What does np.zeros((3, 4)) create?
Show answerA 3x4 array filled with zeros
What does np.ones((2, 3)) create?
Show answerA 2x3 array filled with ones
What does np.arange(10) return?
Show answerAn array with integers from 0 to 9
What does np.linspace(0, 1, 5) create?
Show answer5 evenly spaced values from 0 to 1, inclusive
What does np.random.rand(3, 2) return?
Show answerA 3x2 array of random values between 0 and 1
What is the dtype of an array?
Show answerThe data type of the array elements (int32, float64, etc.)
How do you specify a dtype when creating an array?
Show answerPass dtype parameter, like np.array([1, 2, 3], dtype=float)
How do you convert an array to a different dtype?
Show answerUse the astype() method, like arr.astype(float)
What is the difference between int32 and int64?
Show answerint32 uses 32 bits for smaller range; int64 uses 64 bits and can store larger integers
What does np.uint8 represent?
Show answerUnsigned integer using 8 bits, range 0 to 255
How do you check the dtype of an array?
Show answerAccess the dtype attribute, like arr.dtype
What is the shape of a NumPy array?
Show answerA tuple describing the size of the array along each dimension
How do you get the shape of an array?
Show answerAccess the shape attribute, like arr.shape
What does np.reshape(arr, (2, 5)) do?
Show answerReshapes array arr into a 2x5 array (must have same total elements)

24 more cards in the app

Study this set free