I have a CSV file with one column with a name Trigger
and two other columns called void1
and void2
.
The data is as follows:
Trigger;void1;void
good;not good;not to good;
I would like to use this data to create a dictionary that looks like this:
dictionary ={"good":["not good", "not to good"]}
I started using the following code:
df = pd.read_csv('dictionary.csv', sep =";")
for index, row in df.iterrows():
dictionary[row['trigger']] = row['void1']
What works. However, when I try:
df = pd.read_csv('dictionary.csv', sep =";")
for index, row in df.iterrows():
dictionary[row['trigger']] = row['void1', 'void2']
This does not work. Any ideas how I can get the conclusion I'm looking for?
source
share