Well problem was that my original input is:
x=[['1', '7', 'gg'], ['1.5', '8', 'as']...]
I need just cut last element in every row.
I try to cut last element in matrix with that:
hl=x[:,:-1]
BUT THIS IS NOT WORKING, so I try in this way:
kl=array(x)
hl=x[:,:-1]
Now I get:
[['1' '7']
['1.5' '8']]
Instead of: [['1' , '7'] ['1.5' , '8']]
Any solution?
>>> x=[['1', '7', 'gg'], ['1.5', '8', 'as']]
>>> [s[:-1] for s in x]
[['1', '7'], ['1.5', '8']]
Try this:
for row in x:
del row[-1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With