Reputation: 117
I have a list l1 = ["Hello", "What is your name", "How ya Doing?"]
and l2 = ["Hi", "I am XYZ", "I'm fine, What about you"]
I want to train my model according to the index of their lists.
Problem: It requires np array for training. How to convert this list l1 and l2 to a np array that keras would accept
Upvotes: 0
Views: 84
Reputation: 441
Numpy has a function to convert a python list to an array. All you need is
import numpy as np
l1 = ["Hello", "What is your name", "How ya Doing?"]
l2 = ["Hi", "I am XYZ", "I'm fine, What about you"]
arr1 = np.array(l1)
arr2 = np.array(l2)
print(arr1,arr2[1])
returns
['Hello' 'What is your name' 'How ya Doing?'] 'I am XYZ'
which should do the job.
Upvotes: 2