I am learning python and I am having a little bit of trouble while handling an object. I have tried to look for a solution but it led nowhere, so I am asking you guys.
I want to get the first X columns of an object, but I can't as it doesn't have the same size in every row.
I have this object:
array([[45, 45, 45, 50, 51, 50, 50, 50, 51, 50, 52],
[45, 45, 45, 50, 51, 50, 50, 50, 51, 50, 51, 52, 55],
[45, 45, 45, 50, 51, 50, 52, 50, 50, 50, 51],
[50, 51, 52, 55, 50, 52, 50, 50, 50, 51, 50, 51]], dtype=object)
And I would like to get something like this:
array([[45, 45, 45, 50],
[45, 45, 45, 50],
[45, 45, 45, 50],
[50, 51, 52, 55]])
What could I do to solve this? Thanks for your help
Alvaro
dtype=object. Each element is a list. This is basically the same as a list of lists; and it's usually best to treat it as such. The array wrapper does not add much, and may even slow things down.