Split a sku into its parts

Data framesMedium10 min

Your task

Given products with columns sku, category, price and stock, where every sku looks like A-1, split it on the hyphen into letter and number, keeping number as a string. Return sku, letter and number, sorted by sku ascending.

Examples

split_sku(products: dataframe) -> dataframe
Example 1
Inputsplit_sku(products)
products
skucategorypricestock
A-1tools9.9912
B-2tools24.50
C-3garden157
D-4garden153
E-5kitchen420
Output
skuletternumber
A-1A1
B-2B2
C-3C3
D-4D4
E-5E5