I have a list in Python and I have a dataframe of values I want to transform them into:
fruits = ["cherry", "strawberry", "grape"]
name | code |
---|---|
cherry | s1 |
strawberry | s2 |
apple | s3 |
grape | s4 |
I would like to create a new list so that I achieve
newlist = ["s1", "s2", "s4"]
How would I do this in Python?