Given the following DataFrame of pandas in Python:
ID | code | color |
---|---|---|
0 | 14563 | red |
1 | 4563 | blue |
2 | 1463 | green |
3 | 82930 | red |
4 | 903 | green |
5 | 18392 | red |
For the code
column, I want that if the value has 4 digits or less, fill in with leading zeros until they have five digits.
ID | code | color |
---|---|---|
0 | 14563 | red |
1 | 04563 | blue |
2 | 01463 | green |
3 | 82930 | red |
4 | 00903 | green |
5 | 18392 | red |