It looks like the display of a (3,1) object array, containing 3 lists:
In [168]: arr = np.zeros((3,1),object)
In [169]: arr[:,0]=[['Vehicle Sales Anfavea units','Brazil','184,815.00'],['Comm
...: odity Price Index MoM % m/m', 'Brazil', '-0.58'],['Commodity Price Ind
...: ex YoY % y/y', 'Brazil', '0.54']]
In [170]: arr
Out[170]:
array([[list(['Vehicle Sales Anfavea units', 'Brazil', '184,815.00'])],
[list(['Commodity Price Index MoM % m/m', 'Brazil', '-0.58'])],
[list(['Commodity Price Index YoY % y/y', 'Brazil', '0.54'])]], dtype=object)
A simple copy-n-paste creates a (3,1,3) array objects (strings); not a 2d array of lists.
Since you want a slice of the lists, you'll have use a list comprehension
In [171]: [a[-2:] for a in arr.ravel()]
Out[171]: [['Brazil', '184,815.00'], ['Brazil', '-0.58'], ['Brazil', '0.54']]
In [172]: np.array(_)
Out[172]:
array([['Brazil', '184,815.00'],
['Brazil', '-0.58'],
['Brazil', '0.54']],
dtype='<U10')
Notice that this final array is (3,2) string dtype, not an object array of lists.
Another approach is to turn it into a 2d string array, and index that:
In [174]: np.stack(arr.ravel())
Out[174]:
array([['Vehicle Sales Anfavea units', 'Brazil', '184,815.00'],
['Commodity Price Index MoM % m/m', 'Brazil', '-0.58'],
['Commodity Price Index YoY % y/y', 'Brazil', '0.54']],
dtype='<U31')
In [175]: _.shape
Out[175]: (3, 3)
In [176]: __[:,-2:]
Out[176]:
array([['Brazil', '184,815.00'],
['Brazil', '-0.58'],
['Brazil', '0.54']],
dtype='<U31')
More about this use of stack at How to turn array of array into single high dimension array?
To keep the object array of lists structure, an inplace replacement might be easiest:
In [180]: arr1=arr.copy()
In [181]: arr1.shape
Out[181]: (3, 1)
In [182]: for a in arr1.ravel():
...: a[:] = a[-2:]
...:
In [183]: arr1
Out[183]:
array([[list(['Brazil', '184,815.00'])],
[list(['Brazil', '-0.58'])],
[list(['Brazil', '0.54'])]], dtype=object)
[list(['Vehicle Sales Anfavea units','Brazil','184,815.00'])]intentional or did you actually mean['Vehicle Sales Anfavea units','Brazil','184,815.00']? In the latter case, the answer iseg[:,[1,2]]. In the former case,eg[:,0,[1,2]].listcalls are redundant, and the brackets around thelistcalls are most likely not doing anything you want.reprof the array? That's very different from if you had actually executed the code you posted.dtype=objectin thereprif it had that explicitlistnotation, though.