【pandas】ValueError: If using all scalar values, you must pass an index

使用pd.DataFrame函数创建df时,报错ValueError: If using all scalar values, you must pass an index
源代码

>>>pd.DataFrame(data = {'time':time,'length':length})

>报错:
>ValueError: If using all scalar values, you must pass an index

修改
方法一:

>>>pd.DataFrame(data = {'time':time,'length':length},index=[0])

方法二:

>>>pd.DataFrame(data = {'time':[time],'length':[length]})

你可能感兴趣的:(Python,pd.DataFrame,ValueError,If,using,all,scalar,values,you,must)