Apr-13-2022, 06:45 PM
(Apr-13-2022, 06:26 PM)deanhystad Wrote:df = pd.DataFrame({"XY": [15.2,22,22], "XX": [19, 23,23], "XXX": [17.8,24,24]}) print(df)I don't understand your data. Maybe it should be like this:
Output:XY XX XXX 0 15.2 19 17.8 1 22.0 23 24.0 2 22.0 23 24.0
foods = { # Do not use "list" as a variable name. "list" is the name of a built-in function. "Fruit":{"XY": [15.2,22,22], "XX": [19, 23,23], "XXX": [17.8,24,24]} } df = pd.DataFrame(foods) print(df)
Output:Fruit XX [19, 23, 23] XXX [17.8, 24, 24] XY [15.2, 22, 22]
Many thanks for reply but now i am getting this kind of error
If using all scalar values, you must pass an index