How can I reshape a pandas dataframe into a numpy array, i.e. make one list item for each discrete value of foo for all the bars belonging to that entry but without manually iterating (vectorized)?
import pandas as pd
d = pd.DataFrame({'foo':[1,1,1,2,2,2], 'bar':[1,2,3,4,5,6]})
display(d)
of the following structure
result = [[1,2,3], [4,5,6]]
result