I am trying to update the multiple columns using pandas dataframe apply function. I am successfully able to do this for one column.
Existing code
def funcgetsh(input):
... hash_object = hashlib.sha1(input)
... return hash_object.hexdigest()
df["col_1"]=df["col_1"].apply(funcgetsh)
Wanted to know if there is any way to do the same thing for any number of columns like
df["col_1","col_2","col_3"]=df["col_1","col_2","col_3"].apply(funcgetsh)
Try modifying
df["col_1","col_2","col_3"]=df["col_1","col_2","col_3"].apply(funcgetsh)
todf[["col_1","col_2","col_3"]]=df[["col_1","col_2","col_3"]].apply(funcgetsh)
. See example below.This workaround should work for you, replace your function with the example.