Cari daftar string di kolom panda
# Searching for strings and appending to dataframe.
search = ['FR-001', 'FR-002', 'FR-003', 'FR-004']
df['FR'] = df['Description'].str.findall('(' + '|'.join(search) + ')')
print (df)
Description FR
0 AasfasfFR-001,asfasdfafsagsdg FR-002 [FR-001, FR-002]
1 AasfasfFR-004, FR-002 [FR-004, FR-002]
2 AasfasfFR-02,asfasdfafsagsdg []
3 AasfasfFR-001,asfasdfafsagsdg FR-003 [FR-001, FR-003]
4 AasfasfFR-004,asfasdfafsagsdg FR-002 [FR-004, FR-002]
#To filter out empty list
df = df[df['FR'].astype(bool)]
print (df)
Description FR
0 AasfasfFR-001,asfasdfafsagsdg FR-002 [FR-001, FR-002]
1 AasfasfFR-004, FR-002 [FR-004, FR-002]
3 AasfasfFR-001,asfasdfafsagsdg FR-003 [FR-001, FR-003]
4 AasfasfFR-004,asfasdfafsagsdg FR-002 [FR-004, FR-002]
Kwams