I have a dataframe like
df = pd.DataFrame({'team': ['Red', 'Blue', 'Yellow', 'Green'],
'points': [11, 7, 8, 10],
'other': ["kk;aaa;;;", ";;bb;;", ";", ";;;;"]})
I would like to replace all cells that contain only ";"
with ""
(empty cells). There may be only 1 or many ";"
in a row. If there is anything in the cells other than ";"
, I would like to leave them as is.
In my dataframe the other column would become:
other
kk;aaa;;;
;;bb;;
#(nothing)
#(nothing)
CodePudding user response: