I'm a beginner in learning python. I'm doing data manipulation of csv using pandas. I'm working on two csv files. Extract.csv as the working file and Masterlist.csv as Dictionary. The keywords I'm supposed to use are strings from the Description column in the Extract.csv. I have the column of keywords in the Masterlist.csv and I have to pull corresponding values and assign to other columns named "Accounts" ,"Contact Name" and "Notes" using those keywords.
Here's the code I've tried:
file2 = open('Masterlist.csv','r')
data2 = pd.read_csv(file2)
df2 = pd.DataFrame(data2)
content=()
for rows in range(len(content)):
if df2['Keywords'].isin(df['Description']):
df['Accounts'] = df2['Accounts']
df['Contact Name'] = df2['Vendor Name']
df['Notes'] = df2['Notes']
print()
and
file2= open('Masterlist.csv','r')
data2= pd.read_csv(file2, usecols= ['Keyterms','Accounts','Vendor Name'])
df2= pd.DataFrame(data2)
content=()
for rows in range(len(content)):
if df[Description'].str.contains(content[df2['Keywords']]):
df['Accounts'] = content[(df2['Accounts'])]
df['Contact Name'] = content[(df2['Vendor Name'])]
df['Notes'] = content[(df2['Notes'])]
print()
Both codes process but the values appeared as blank.