I have the following dataset:
<code>meste = pd.DataFrame({'a':['06/33','40/2','05/22']})
meste
a
0 06/33
1 40/2
2 05/22
</code>
<code>meste = pd.DataFrame({'a':['06/33','40/2','05/22']})
meste
a
0 06/33
1 40/2
2 05/22
</code>
meste = pd.DataFrame({'a':['06/33','40/2','05/22']})
meste
a
0 06/33
1 40/2
2 05/22
And I want to remove the leading 0s in the text (06/33 to 6/33 for example). I tried this, without success:
<code>meste['a'] = meste['a'].str.replace(r"(^0?)","")
a
0 06/33
1 40/2
2 05/22
</code>
<code>meste['a'] = meste['a'].str.replace(r"(^0?)","")
a
0 06/33
1 40/2
2 05/22
</code>
meste['a'] = meste['a'].str.replace(r"(^0?)","")
a
0 06/33
1 40/2
2 05/22
I also tried with meste['a'].str.replace(r"(^0?)","")
, but it doesn’t work. This is the expected result:
<code> a
0 6/33
1 40/2
2 5/22
</code>
<code> a
0 6/33
1 40/2
2 5/22
</code>
a
0 6/33
1 40/2
2 5/22
Please, could you point out what I am doing wrong in the regex statement?