Add documentation page on the internal representation of NumPy arrays
See original GitHub issueIn 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
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
NumPy: the absolute basics for beginners
The NumPy ndarray class is used to represent both matrices and vectors. A vector is an array with a single dimension (there's no...
Read more >NumPy quickstart — NumPy v1.24 Manual
To create sequences of numbers, NumPy provides the arange function which is analogous to the Python built-in range , but returns an array....
Read more >How to contribute to the NumPy documentation
How to contribute to the NumPy documentation#. This guide will help you decide what to contribute and how to submit it to the...
Read more >Structured arrays — NumPy v1.24 Manual
Structured datatypes may be created using the function numpy.dtype . ... A record array representation of a structured array can be obtained using...
Read more >NumPy internals — NumPy v1.21 Manual
Internal organization of numpy arrays¶. It helps to understand a bit about how numpy arrays are handled under the covers to help understand ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think this issue can be closed by gh-19791 for now. There is also a separate tracking issue (gh-20112) for future work on this topic.
Hello, @mrityagi - I think we talked about this in the documentation meeting but I’m not sure if you intend to follow up on this? If not maybe @Mukulikaa can pick this up. Thanks!