I have the following cycle:
comprehensive_merged_function = np.zeros(shape=(0, 1))
for i in range(256):
comprehensive_merged_function = np.append(comprehensive_merged_function, utils.dec_to_bin(i, 8))
comprehensive_merged_function = np.array([list(s) for s in comprehensive_merged_function]).astype(int)
which is giving me the following array:
[[0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 1]
[0 0 0 0 0 0 1 0]
...
[1 1 1 1 1 1 0 1]
[1 1 1 1 1 1 1 0]
[1 1 1 1 1 1 1 1]]
I would to like to append each row (out of the 256) with 8 times (-1), to obtain the following desired result:
[[0 0 0 0 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1]
[0 0 0 0 0 0 0 1 -1 -1 -1 -1 -1 -1 -1 -1]
[0 0 0 0 0 0 1 0 -1 -1 -1 -1 -1 -1 -1 -1]
...
[1 1 1 1 1 1 0 1 -1 -1 -1 -1 -1 -1 -1 -1]
[1 1 1 1 1 1 1 0 -1 -1 -1 -1 -1 -1 -1 -1]
[1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1]]
I tried the following:
comprehensive_merged_function = np.zeros(shape=(0, 1))
appending_indexes = np.array([-1, -1, -1, -1, -1, -1, -1, -1])
for i in range(256):
comprehensive_merged_function = np.append(comprehensive_merged_function, utils.dec_to_bin(i, 8))
comprehensive_merged_function = np.row_stack(comprehensive_merged_function, appending_indexes)
comprehensive_merged_function = np.array([list(s) for s in comprehensive_merged_function]).astype(int)
and I received the following error:
Traceback (most recent call last):
File "compression comprehensive testing.py", line 262, in <module>
comprehensive_merged_function = np.row_stack(comprehensive_merged_function, appending_indexes)
File "<__array_function__ internals>", line 4, in vstack
TypeError: _vhstack_dispatcher() takes 1 positional argument but 2 were given
Of course I tried many other different ways to do this, but the results were worse and I haven`t presenthed them here to avoid overloading the post.
Any help of how can I get the desired result will be greatly appreciated.