I have a dataframe X. I want to convert it into 1D array with only 5 elements. One way of doing it is converting the inner arrays to lists. How can I do that?
0 1 2 3 4 5 0 1622 95 1717 85.278544 1138.964373 1053.685830 1 62 328 390 75.613900 722.588235 646.974336 2 102 708 810 75.613900 800.916667 725.302767 3 102 862 964 75.613900 725.870370 650.256471 4 129 1380 1509 75.613900 783.711111 708.097211
val = X.values will give a numpy array. I want to convert the inner elements of the array to list. How can I do that?
I tried this but failed
M = val.values.tolist()
A = np.array(M,dtype=list)
N = np.array(M,dtype=object)
X.stack()?