Python Forum
df string manipulation before / after / when single digit pad zero
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
df string manipulation before / after / when single digit pad zero
#1
Dear Python Experts,

I have some dates that I need to clearn up.

d = {'col1': ['1/25/84', '2/8/86'],}
dfdates = pd.DataFrame(data=d)
print(dfdates)
For the first date, I want to add a zero to all single digits before the first /
as well as a 19 to ahead of all 2 digits behind the last /.

In case of the second date, I would like to add a zero to all single digits before the first / and
a zero to all single digits behind the first /.

Can someone point me in the right direction which dataframe string manipulation function I should use?
Reply


Messages In This Thread
df string manipulation before / after / when single digit pad zero - by metalray - Oct-08-2018, 09:58 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020