Python使用相同的字符串填充列表

Python使用相同的字符串填充列表,python,pandas,Python,Pandas,我有一个pandas数据框,我想在每一行中创建一个具有相同字符串的新列 目前我正在做这件事 tag=[] for x in xrange(len(preds)): #preds is a np.array, same length of df tag.append('MY STRING') df['TAG']=tag 我知道一定有更聪明的方法 感谢您的帮助 df['TAG']=['mystring']*len(preds)df['TAG']='mystring'-

我有一个pandas数据框,我想在每一行中创建一个具有相同字符串的新列

目前我正在做这件事

tag=[]
for x in xrange(len(preds)): #preds is a np.array, same length of df
    tag.append('MY STRING')
 df['TAG']=tag
我知道一定有更聪明的方法


感谢您的帮助

df['TAG']=['mystring']*len(preds)
df['TAG']='mystring'
-