I start from a pandas dataframe with this columns:
Name: 'Computer', 'Tablet', 'Monitor'
Price: 900, 300, 400
Identifier: '11$10qw-IDAA', '2222-IL$DB123', '2237-12$33AVD-ewwfq'
I would like to create a new column (for example a NewString) of the data frame which extracts substrings from the Identifier column that contain the $ character. That is, I would like to add the column with the values to the df:
NewString
11$10qw
IL$DB123
12$33AVD
I tried to do it with two nested for loops: one that loops over all the rows of the df, and inside another loop that works on the list formed by the split on the "Identifier" column, but I can't solve it
Use a regex with
str.extract:Output: