How to iterate over columns of pandas dataframe to run regression

后端 未结 8 1825
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:33

    A workaround is to transpose the DataFrame and iterate over the rows.

    for column_name, column in df.transpose().iterrows():
        print column_name
    

提交回复
热议问题