If you look for something like [[1,2,3,4]], you can use the code below. If you need the array in the format of [[1,2], [3,4]], then change the reshape method as np.reshape(arr, (2, 2)). df is the original dataframe with 784 feature and label columns.
First, get all columns except the label:
columns = df.columns.to_list()
columns.remove('label')
Then, use the apply method to convert the df to the format you need:
def arrayize(df):
arr = df.to_numpy()
arr = arr.astype(int)
arr = np.reshape(arr, (-1, 4))
return arr
df["numpy_col"] = df[columns].apply(arrayize, axis=1)
I haven't run the code to test it, so you may need to check it.