vendredi 4 septembre 2020

Python If statement Concatenate

I have a dataframe with two columns bill_date in : day - month - year format bill_number in: CM2/xxxx/day-year format

however in the bill_no column, there are some bill numbeos missing the day-year at the end (unclean data)

How can i write python code to concatenate the existing string with the day-year of the bill date column into the bill number column.

Functional description:

If bill number ends with '/', concatenate bill no + bill date (month-year) in the bill_number column Else, leave the bill number as it is.

example of what the existing bill number looks like: CM2/0000/ example of what the bill number should look like (assuming bill_date = 15/09/19) CM2/0000/09-19

dataframe name = df_alldata

Aucun commentaire:

Enregistrer un commentaire