Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rounding
#1
Hello,
can somebody help me with following code:

import scipy.misc
img_array = scipy.misc.imread("Test_Set/TestSet_03/2828_my_own_4.png", flatten=True)
img_data = 255.0 - img_array.reshape(784)
img_data = (img_data / 255.0 * 0.99) + 0.01
img_data = ','.join(map(str, img_data))

print (img_data)
The problem is the following: img_data consists of a list of numbers

eg: 0.23905884 0.15364707 etc...
after separating those numbers by a comma by the command "img_data = ','.join(map(str, img_data))"
I have 0.239059,0.153647,etc...

So my numbers are rounded. But what I want to have after the comma separating is
0.23905884,0.15364707

Anybody knows how to adapt my code so I have the expected result?

Thanks a lot
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Panda Dataframe Rounding Issue ab0217 5 7,190 Nov-06-2018, 10:15 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020