In connection with the question I asked here: https://stackoverflow.com/questions/56375651/add-zeros-to-string-in-pandas-column-depends-of-length
I have a problem with str.zfill()
method.
My example data (column of DF):
0002131
dsda2123
eew12341
wewqsws1'
123
Following @jezrael advice I fill each row to 12 char by str.zfill()
method.
Code:
df['SampleNumber'] = df['SampleNumber'].str.zfill(12)
Result file:
000000002131
0000dsda2123
0000eew12341
wewqsws1'
000000000123
So all work fine but I have a problem with names where I have a '
character. The method passes it, and in result series I got a unchanged name. What is the problem here? How can I deal with it? In the documentation of that method, I found nothing about a similar problem. And type(wewqsws1')
it's str
.
Can someone know how to fix it?
Expecting result:
000000002131
0000dsda2123
0000eew12341
000wewqsws1'
000000000123