Set value to an entire column of a pandas dataframe

前端 未结 8 2065
甜味超标
甜味超标 2020-12-13 05:54

I\'m trying to set the entire column of a dataframe to a specific value.

In  [1]: df
Out [1]: 
     issueid   industry
0        001        xxx
1        002           


        
8条回答
  •  孤城傲影
    2020-12-13 06:43

    This provides you with the possibility of adding conditions on the rows and then change all the cells of a specific column corresponding to those rows:

    df.loc[(df['issueid'] == '001'), 'industry'] = str('yyy')
    

提交回复
热议问题