Error at the moment, now I want to return all the columns and data but just make one column need to be upper.
hellodf= hellodf.loc[hellodf['ContactName'].str.upper()]
CodePudding user response:
Use Series.str.isupper
for filter:
hellodf= hellodf.loc[hellodf['ContactName'].str.isupper()]
If need convert one column to uppercase:
hellodf['ContactName'] = hellodf['ContactName'].str.upper()
CodePudding user response:
Use the Series.str.upper() function to make the strings in a certain column to uppercase. Below is the actual code that works,
other=hellodf['ContactName'].str.upper()
#convert the series to a DF
other=pd.DataFrame(other)
newdf=hellodf.join(other,rsuffix='_upper')
#to drop the initial coulmn, and retain only the uppercased column
newdf=newdf.drop(['ContactNname'], axis=1)