As titled.
I have written my code but it does not work. I wish I can get a more pythonic way of writing the code (in one single line perhaps).
clean_df :
columnA
123F
FVGD
w999Z
678Q
6y6yA
My code :
postfix = ["A", "D", "Z", "P"]
for value in postfix:
if cleaned_data['columnA'].str.endswith(value) is True:
cleaned_data['columnA'] = value
else:
cleaned_data['columnA'] = "blah"
The postfix are constant. Expected outcome :
columnA
blah
D
Z
blah
A