E3FD Add documentation page on the internal representation of NumPy arrays · Issue #15793 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Add documentation page on the internal representation of NumPy arrays #15793

@Irio

Description

@Irio

In my understanding, based on the definitions in NEP 44, my proposal is to make an Explanation page around the topic.

I am aware about two places in the docs mentioning this topic for NumPy users: the Quickstart tutorial and NumPy: the absolute basics for beginners. The former, starts with the following:

When operating and manipulating arrays, their data is sometimes copied into a new array and sometimes not. This is often a source of confusion for beginners.

Sometimes, even after five years using NumPy, I have to go with my gut feeling to predict if an operation will trigger a copy in the underlying data. I'd love to have an official documentation page for helping people build a better mental model of this.

Some questions and ideas:

  • What does an advanced user of NumPy needs to know about the underlying data structure?
  • What are the operations that will cause data to be moved/copied in memory?
  • How to tell if Numpy did or will copy data in an operation?
  • When is recommended to choose between creating a view or making a copy?
  • May include or link to a good overview of indexing
  • Shallow copy vs deep copy
  • Cite the classic SettingWithCopyWarning exception in Pandas, which I believe is caused by not having a good understanding of this very same subject

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0