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.

Numpy - Copying Arrays Warning – unnecessary commas

See original GitHub issue

Describe your problem and how to reproduce it:

The challenge in the numpy module Numpy - Copying Arrays Warning provides the different options separating the items with , comma characters

[1, 2, 3, 4, 5]
[1, 2, 20, 4, 5]
[1, 20, 3, 4, 5]

Since the challenge describes numpy arrays however, the correct syntax would be

[1 2 3 4 5]
[1 2 20 4 5]
[1 20 3 4 5]

I’d be more than glad to fix this with a pull request if you agree 👍

Add a Link to the page with the problem:

https://www.freecodecamp.dev/learn/data-analysis-with-python/numpy/copying-arrays-warning

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ojeytonwilliamscommented, Jun 19, 2020

Don’t worry, it happens. So, the first thing to do is make sure you make a backup of your work, because you’ll need to reset your master branch. Once you’ve backed it up these are the steps

git fetch upstream master
git checkout master
git reset --hard FETCH_HEAD

at this point your master will only have the commits that this remote has.

Now, create a new branch off master:

git checkout -b fix/copying-arrays-warning

That branch is where you can put the commits to fix this issue.

The other PR looked fine, so I merged it. No need to worry about that one!

1reaction
ojeytonwilliamscommented, Jun 19, 2020

That makes sense to me. @borntofrappe a PR would be very welcome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

why an extra comma in the shape of a single index numpy array
With lists, the trailing comma is not needed although some style guides recommend ... A numpy array's shape property always returns a tuple....
Read more >
4.5. Understanding the internals of NumPy to avoid ...
In this recipe, we will see how to avoid unnecessary array copies in order to save memory. In that respect, we will need...
Read more >
Structured arrays — NumPy v1.24 Manual
A string of comma-separated dtype specifications ... Warning. In Numpy 1.15, indexing an array with a multi-field index returned a copy of the...
Read more >
Chapter 4. NumPy Basics: Arrays and Vectorized Computation
Calling astype always creates a new array (a copy of the data), even if the new dtype is the same as the old...
Read more >
PEP 8: The Style Guide for Python Code
This document gives coding conventions for the Python code comprising the ... When trailing commas are redundant, they are often helpful when a...
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