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 - Accessing and Changing Elements, Rows, Columns

See original GitHub issue

Describe your problem and how to reproduce it: The output does not align with the question, nor does it align with the code. I suspect this is what the output was meant to be:

# Output:
# [[ 1  2  20  4  5 ]
# [ 6  7  20  9 10 ]]

Also, I would suggest the formatting of the code to change. Ie. spacing between numbers and [], and spacing between numbers.

Add a Link to the page with the problem: https://www.freecodecamp.dev/learn/data-analysis-with-python/numpy/accessing-and-changing-elements-rows-columns

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box): image

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ShaunSHamiltoncommented, May 29, 2020

@scissorsneedfoodtoo , well. What was your intent? I assumed the output was there as an example for what the end result should become. Ie. after performing:

a[:, 2] = 20

Or, was the output just another representation of the output of the np.array?

I suggest it be the expected output of the code the user needs to select, as this helps the user clarify what needs to be done.

0reactions
niteshseramcommented, May 31, 2020

Okay. I will be working on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transpose ndarray (swap rows and columns, rearrange axes)
To transpose NumPy array ndarray (swap rows and columns), use the T attribute (.T), the ndarray method transpose() and the numpy.transpose() ...
Read more >
Modify a particular row/column of a NumPy array
If you want to change the values of a row or column of an array, you can assign it to a new list...
Read more >
How to access a NumPy array by column - GeeksforGeeks
Accessing a NumPy-based array by a specific Column index can be achieved by indexing. NumPy follows standard 0-based indexing in Python.
Read more >
How to Set Axis for Rows and Columns in NumPy
Specifically, operations like sum can be performed column-wise using axis=0 and row-wise using axis=1. In this tutorial, you will discover how ...
Read more >
The Basics of NumPy Arrays | Python Data Science Handbook
Array Indexing: Accessing Single Elements¶ ... Keep in mind that, unlike Python lists, NumPy arrays have a fixed type. This means, for example,...
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