Skip to content
Data Science

Python for Data Science

🤖 AI-generated

Master Python for Data Science with 100 free flashcards. Study using spaced repetition and focus mode for effective learning in Data Science.

100 cards · ~50 min · Advanced · Updated

Sample card

What function creates a NumPy array from a Python list?

np.array([1, 2, 3]) converts a Python list into a NumPy ndarray.

Share: 𝕏 Twitter LinkedIn WhatsApp ☆ Save deck

🎯 What You'll Learn

Preview cards

Q · 1 of 100

What function creates a NumPy array from a Python list?

Q · 2 of 100

How do you create a 1D array of zeros with 5 elements in NumPy?

Q · 3 of 100

How do you create a 3x3 identity matrix in NumPy?

+9 more cards →

Preview Questions

12 shown

What function creates a NumPy array from a Python list?

Show ▼

np.array([1, 2, 3]) converts a Python list into a NumPy ndarray.

How do you create a 1D array of zeros with 5 elements in NumPy?

Show ▼

np.zeros(5) returns array([0., 0., 0., 0., 0.]).

How do you create a 3x3 identity matrix in NumPy?

Show ▼

np.eye(3) returns a 3×3 array with ones on the diagonal and zeros elsewhere.

What does np.arange(0, 10, 2) return?

Show ▼

It returns array([0, 2, 4, 6, 8]) — values from 0 up to (not including) 10 with step 2.

How do you generate 5 evenly spaced values between 0 and 1 in NumPy?

Show ▼

np.linspace(0, 1, 5) returns array([0., 0.25, 0.5, 0.75, 1.]).

How do you access the element at row 1, column 2 of a 2D NumPy array arr?

Show ▼

arr[1, 2] uses zero-based indexing to retrieve the element at the second row, third column.

What does arr[:, 0] select from a 2D NumPy array?

Show ▼

It selects all rows of the first column, returning a 1D array.

How do you slice rows 1 through 3 (inclusive) from a NumPy array?

Show ▼

arr[1:4] selects rows at indices 1, 2, and 3 (the stop index is exclusive).

What is broadcasting in NumPy?

Show ▼

Broadcasting is NumPy's ability to perform element-wise operations on arrays of different shapes by automatically expanding the smaller array to match dimensions.

Give an example of NumPy broadcasting with a scalar.

Show ▼

arr * 3 multiplies every element of arr by 3 without an explicit loop — the scalar is broadcast across the array.

How do you reshape a 1D array of 12 elements into a 3x4 matrix?

Show ▼

arr.reshape(3, 4) returns a 3×4 view of the array (total elements must match).

What does arr.ravel() do?

Show ▼

It flattens a multi-dimensional array into a 1D array, returning a view when possible.

🎓 Start studying Python for Data Science

🎮 Study Modes Available

🔄

Flashcards

Flip to reveal

🧠

Focus Mode

Spaced repetition

Multiple Choice

Test your knowledge

⌨️

Type Answer

Active recall

📚

Learn Mode

Multi-round mastery

🎯

Match Game

Memory challenge

Related Topics in Data Science

📖 Learning Resources