I want to obtain an array of decimal numbers between two values, (for example 2000.00 and 2100.00). I do not know how to do it: At the moment I have two alternatives, they never give me what I want:
import numpy as np
import random
import decimal
all_values = np.array([2000*np.random.random(3) for i in range(10)])
print all_values
gives me:
[[ 1237.71422998 858.3542556 1695.09000406]
[ 514.20215484 516.17059591 1512.52499356]
[ 744.42314666 1232.74944277 1434.53144762]
[ 1201.13668055 1079.46214307 712.08913567]
[ 476.53854297 581.41400812 1512.70774028]
[ 1202.66565767 209.74780245 1371.3482648 ]
[ 155.01843411 155.92438582 1149.84599247]
[ 1866.7402305 159.65721067 1142.88608352]
[ 1388.39461687 1677.20085145 1467.13341664]
[ 1957.88998384 1041.01827722 1483.86465783]]
And on the other hand with:
import numpy as np
import random
import decimal
all_values = np.array([decimal.Decimal(random.randrange(200000, 210000))/100
for i in range(3)] )
print all_values
I get only one line of three decimals:
[Decimal('2093.56') Decimal('2013.24') Decimal('2028.18')]
I do not know why we have "Decimal" and how to discard it.
In short, I want to create a file with the values of three "cryptocurrencies" for some exercises:
{"BTC":{"USD":2167.85},"ETH":{"USD":167.88},"DASH":{"USD":102.31}}
{"BTC":{"USD":2175.15},"ETH":{"USD":168.08},"DASH":{"USD":102.24}}
...