Applying uppercase to a column in pandas dataframe

后端 未结 3 1310
鱼传尺愫
鱼传尺愫 2020-12-09 07:37

I\'m having trouble applying upper case to a column in my DataFrame.

dataframe is df.

1/2 ID is the column head that need to apply

3条回答
  •  孤街浪徒
    2020-12-09 08:11

    If your version of pandas is a recent version then you can just use the vectorised string method upper:

    df['1/2 ID'] = df['1/2 ID'].str.upper()
    

    This method does not work inplace, so the result must be assigned back.

提交回复
热议问题