I want to create a 2d dimensional array in NumPy size 128x2and store long integers in it (each integer has a size of 128 bits).
128x2
CODE:
keys = np.zeros(shape=(128, 2)) for i in range(0, 128): key1 = random.randrange(1 << 127, 1 << 128) key2 = random.randrange(1 << 127, 1 << 128) keys[i, 0] = key1 keys[i, 1] = key2 print(keys)
The random key has the following output:
212325597117085680729458082297541802625
However, when I print an array of keys, I got the following output:
EXIT:
[[ 3.24916136e+38 1.88464325e+38] [ 3.01375156e+38 2.73451722e+38] [ 1.85204001e+38 2.47016718e+38] [ 1.85813038e+38 2.66817805e+38] [ 1.93774249e+38 2.62902937e+38] [ 2.77003163e+38 2.13490918e+38] [ 1.92502885e+38 3.28965325e+38] [ 3.03869869e+38 2.27308256e+38] [ 2.97958126e+38 2.50477741e+38] [ 1.82747542e+38 2.17062238e+38] [ 2.59264124e+38 3.17242510e+38] [ 2.43152125e+38 3.33742346e+38] etc
How to print keys in source format?
You have two questions with your code.
-, dtype . dtype , np.zeros, float64, , . , , .
dtype
np.zeros
float64
, numpy 128- . , . dtype uint64 ( , ). , , dtype. object dtype Python int ( , , numpy).
numpy
uint64
object
int
- ( ). np.set_printoptions, , , dtype, numpy. - , .
np.set_printoptions
Source: https://habr.com/ru/post/1611455/More articles:Error trying to create an array of json objects in Rails 4 using PostgreSQL - jsonAttempting to call a function every 24 hours - javaSet the default value for a Postgres JSON column in Rails <4 - jsonВход в Google не делает ничего, когда сторонние файлы cookie отключены - javascriptДолжны ли шаблоны находиться в папках шаблонов шаблонов или глобальной папке шаблона? - pythonstring collection in pandas best rated dataframe - pythonThe correct way to detect that a UWP application is running on a small screen device (phone) - c #save notification on lock screen after unlocking - iosВариации Sku не отображаются Wordpress/woocommerce - phpKeep notification on lock screen - iosAll Articles