How to convert list to row dataframe with Pandas

You can use:

df = pd.DataFrame([A])
print (df)
   0  1  2    3 4
0  1  d  p  bab  

If all values are strings:

df = pd.DataFrame(np.array(A).reshape(-1,len(A)))
print (df)

   0  1  2    3 4
0  1  d  p  bab  

Thank you AKS:

df = pd.DataFrame(A).T
print (df)
   0  1  2    3 4
0  1  d  p  bab  

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)