Sahaj.blogs

Day page

8 Feb 2024

Study

NumPy · Indexing and slicing

Multi-dimensional indexing with a[i, j], slicing rows and columns, and the most important rule: basic slices are views, not copies.

  • A basic slice of a NumPy array is a view, so writing to it changes the original array.
  • Use .copy() when you need an independent array.

Read the post →