question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add documentation page on the internal representation of NumPy arrays

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Mukulikaacommented, Oct 30, 2021

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.

1reaction
melissawmcommented, Jul 5, 2021

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found