shape: (4, 1)
| Part_Num |
|---|
| str |
| "JV24" |
| "SA1978" |
| "VX4" |
| "Z5" |
pad_end
Joram Mutenge
2025-11-10
You have part numbers for your products, and you want to ensure they all have the same length, meaning they contain the same number of characters. Below is a dataframe that shows part numbers of varying lengths.
| Part_Num |
|---|
| str |
| "JV24" |
| "SA1978" |
| "VX4" |
| "Z5" |
To add zeros at the end of each value in Part_Num that has fewer than six characters, use the Polars expression pad_end as follows:
| Part_Num |
|---|
| str |
| "JV2400" |
| "SA1978" |
| "VX4000" |
| "Z50000" |
Now the values all have the same length with six characters.
Check out my Polars course and advance your analysis skills.