#π help with finding the bug
36 messages Β· Page 1 of 1 (latest)
@burnt oak
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
so the first bug i said was that lines 7 to 9 are not needed, since they remove half the ids and scores, which is not required in the question
the other bug was line 13. it indexes rows but it should index columns
whats the other bug?
the question says the three bugs r related to boolean masking, sorting logic and array indexing. so maybe something to do with sorting logic?
i cant find it tho
have you tried simply running some code? then tweak some stuff and run again
usually it helps out quite a bit
yep i did after adding the bug fixes
and it works
for example,
>>> import numpy as np
>>> a = np.arange(12).reshape(3, -1)
>>> a
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
>>> a[:, 1:3]
array([[ 1, 2],
[ 5, 6],
[ 9, 10]])
>>> a[1:3, :]
array([[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
```then note the sorting part
but there doesnt seem to be a 2nd bug
so is the issue that after you fixed 2 bugs it seems to run fine, but there should be 3 bugs?
yes
i commented this out
and rewrote this so it indexes columns
and after printing i get
hm
looks fine to me too
maybe the original problem just considers one of your found bugs as 2?
maybe this bug is 2 bugs
the question states tho
the script contains three bugs related to boolean masking, sorting logic, and
incorrect array indexing
so it must be something related to sorting logic?
but you can argue that "incorrectly re-ordering the rows instead of columns" is the sorting bug
like you can cut it a lot of ways
as to what constitutes a singular bug
hmm yh
so then what would the incorrect array indexing bug be then
you can say it's also the same line
i.e. the sorting bug is due to incorrect indexing
or like up above at the mask area
"you shouldn't remove people through indexing" or smthn
again I think there's multiple ways you can cut it
yeah that's what I mean
maybe what you consider 1 bug, the problem considers 2
resulting in your situation
thanks for ur help
could i say that once i fix this (i.le comment out the masking)
it also fixes
sorted_indices = np.argsort(ID)
which is the sorting logic bug, as np.argsort orriignally takes in the masked IDs?
like sure ig
!close
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.