Pandas Dataframe ValueError: Shape of passed values is (X, ), indices imply (X, Y)

后端 未结 2 1348
既然无缘
既然无缘 2020-12-10 02:33

I am getting an error and I\'m not sure how to fix it.

The following seems to work:

def random(row):
   return [1,2,3,4]

df = pandas.DataFrame(np.r         


        
2条回答
  •  無奈伤痛
    2020-12-10 02:54

    I use the code below it is just fine

    import numpy as np    
    df = pd.DataFrame(np.array(your_data), columns=columns)
    

提交回复
热议问题