按行遍历df,需要用到以下语句: for index,row in df.itermrow(): df. loc[行数,“列名”]=“newdata” 这样就直接将df中的数据修改了。 希望能帮助到大家,谢谢。