How to iterate over columns of pandas dataframe to run regression

后端 未结 8 1821
Happy的楠姐
Happy的楠姐 2021-01-29 18:07

I\'m sure this is simple, but as a complete newbie to python, I\'m having trouble figuring out how to iterate over variables in a pandas dataframe and run a regress

8条回答
  •  [愿得一人]
    2021-01-29 18:10

    You can use iteritems():

    for name, values in df.iteritems():
        print('{name}: {value}'.format(name=name, value=values[0]))
    

提交回复
热议问题