I am working in Python. I have a dataframe called df with 3 columns: a, b, c. I want to do a loop which loops through all variables and generates a numpy array for each variable and cuts the last number of each variable. So far I have tried, but it is not working:
df = pd.DataFrame(
[[1, 2, 3],
[4, 5, 6],
[7, 8, 9]],
columns=['a', 'b', 'c'])
variables= [a,b,c]
for x in variables:
x = np.transpose(np.matrix(df.x.to_numpy(np.float64)))
x=x[:-1]