#๐Ÿ”’ Why are zeroes and commas not displayed in the output ??

38 messages ยท Page 1 of 1 (latest)

long sage
#
print(rng2)```
limber masonBOT
#

@long sage

Python help channel opened

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.

long sage
#

How can I resolve this ?

craggy swallow
#

just convert it to a list

remote stone
long sage
#

Is there any particular reason for that ?

craggy swallow
#

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 shrug

#

might just be a preformance thing

long sage
#

Ohhh okay

#

Thank you

remote stone
#

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)]))

limber masonBOT
remote stone
#

Much cleaner without all the commas.

long sage
#

This is what I'm getting

craggy swallow
#

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

craggy swallow
#

they were just giving an example of why we don't need commas

remote stone
#

!e py import numpy as np rng2=list(np.arange(3,5,0.5)) print(rng2)

limber masonBOT
craggy swallow
long sage
remote stone
#

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=}")

limber masonBOT
warm barn
#

Did you want to know why for a specific purpose or is it just for curiosity? @long sage

limber masonBOT
#
Python help channel closed

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.