Add T at the end
df_from_arr.TOut[418]: 0 10 2 31 4 62 6 93 8 12
Or modify your input arrays
pd.DataFrame(np.hstack((arr1[:,None], arr2[:,None])))Out[426]: 0 10 2 31 4 62 6 93 8 12
You can transpose the DataFrame.
arr1 = np.array([2, 4, 6, 8])arr2 = np.array([3, 6, 9, 12])df_from_arr = pd.DataFrame(data=[arr1, arr2]).Tprint(df_from_arr) 0 10 2 31 4 62 6 93 8 12
You can also do this:
arr1 = np.array([2, 4, 6, 8])arr2 = np.array([3, 6, 9, 12])df_from_arr = pd.DataFrame({0:arr1,1:arr2})