0

I have the current situation:

df['item_c'] = df['item_name'].apply(lambda z: re.findall('((packs| packs|pack of | packs of:?)\d+)', z))

df['item_c'] = df['item_c'].str.get(0)

the returned string is something like ('pack of 16', 'pack of '). How can I keep only pack of 16?

Tried

df['item_c'] = df['item_c'].str.split(", ")[0]

but without any success

Osiris
  • 1
  • 2

0 Answers0