Convert Numpy array to Pandas DataFrame column-wise (As Single Row)

Viewed 48116

I have a numpy array looking like this:

a = np.array([35,2,160,56,120,80,1,1,0,0,1])

Then I'm trying to transform that array into pandas dataframe with logic "one column-one value" like this:

columns=['age','gender','height',
     'weight','ap_hi','ap_lo',
     'cholesterol','gluc','smoke',
     'alco','active']

values = a

df = pd.DataFrame(a,columns=columns)

This approach raises ValueError: Shape of passed values is (1, 11), indices imply (11, 11). What am I doing wrong and how to perform it in a right way?

Thanks!

2 Answers
Related