#๐ Why are zeroes and commas not displayed in the output ??
38 messages ยท Page 1 of 1 (latest)
@long sage
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.
How can I resolve this ?
numpy arrays don't display with that by default
just convert it to a list
you can also use np.set_printoptions to configure numpy to use a different format for printing.
(np.set_string_function has been removed in 2.0.0)
Ohhh okay
Is there any particular reason for that ?
okay
it's an unnecessary visual element, you can tell what the arrays look like without commas
that's my assumption as to why at least 
might just be a preformance thing
I think it's not about performance. It just takes too much space in the output.
!e py import numpy as np print(np.array([np.arange(0, 100, 1) for i in range(100)]))
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | [[ 0 1 2 ... 97 98 99]
002 | [ 0 1 2 ... 97 98 99]
003 | [ 0 1 2 ... 97 98 99]
004 | ...
005 | [ 0 1 2 ... 97 98 99]
006 | [ 0 1 2 ... 97 98 99]
007 | [ 0 1 2 ... 97 98 99]]
Much cleaner without all the commas.
ah lol it doesn't convert back
you should probably just use jenna's solution
there are simple ways to convert them but it's still more involved than that
but this doesnt have commas
they were just giving an example of why we don't need commas
!e py import numpy as np rng2=list(np.arange(3,5,0.5)) print(rng2)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
[3.0, 3.5, 4.0, 4.5]

i did this
maybe it depends on the version.
!e py import numpy as np rng2=list(np.arange(3,5,0.5)) print(f"{rng2=}") print(f"{type(rng2[0])=}") print(f"{np.version.version=}")
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | rng2=[3.0, 3.5, 4.0, 4.5]
002 | type(rng2[0])=<class 'numpy.float64'>
003 | np.version.version='1.26.4'
Did you want to know why for a specific purpose or is it just for curiosity? @long sage
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.