2021年3月24日星期三

How to add a prefix to a string if it ends with a particular character (Pandas) i.e. add '-' to string given it ends with '-'

For a particular column (dtype = object), how can I add '-' to the start of the string, given it ends with '-'.

i.e convert: 'MAY500-' to '-May500-'

(I need to add this to every element in the column)

https://stackoverflow.com/questions/66792372/how-to-add-a-prefix-to-a-string-if-it-ends-with-a-particular-character-pandas March 25, 2021 at 10:50AM

没有评论:

发表评论