For someone who has experience with DataFrame, the problem is clear and easy to find out, but for who is starting it can be very frustrating to have to deal with problems like that.
The problem with the DataFrame is that pandas will not be able to assign 4 data values as 4 columns if you do not guide pandas to do so. What I was trying to do was to create one DataFrame of 4 lines and 1 column (4,1) using 4 data values and 4 column names (4,4). For the code work, you can use the columns values as index and then transpose your DataFrame. What transpose() does is simply transform the lines of the DataFrame into columns.
data = [["Orange", "Watermelon", "Banana", "Apple"], [10, 30, 23, 56]]
df = pd.DataFrame(data=data[1], index=data[0]).transpose()
print(df)
Orange Watermelon Banana Apple
0 10 30 23 56
The first way will work just if you have enough data to create one 4x4 DataFrame, for example:
data = [["Orange", "Watermelon", "Banana", "Apple"], [
[10, 30, 23, 56], [18, 44, 12, 73], [2, 24, 88, 10], [5, 71, 35, 62]]]
df = pd.DataFrame(data=data[1], columns=data[0])
print(df)
Orange Watermelon Banana Apple
0 10 30 23 56
1 18 44 12 73
2 2 24 88 10
3 5 71 35 62
EDIT
As @Mayank said, it can be simplified by:
df = pd.DataFrame(data=[data[1]], columns=data[0])
Orange Watermelon Banana Apple
0 10 30 23 56
pd.DataFrame(data=[data[1]], columns=data[0]).data=is looking for a 2d list containing all the rows. In your case you have 1 row, so the outer list has 1 element with your 4 cells of data.