Oct-30-2018, 03:19 PM
Oct-30-2018, 04:27 PM
- Tell us what you have tried
- Show an example list
- If possible show existing code.
- If errors, show error traceback verbatim
Oct-30-2018, 04:56 PM
Sorry.
I tried array2 = np.array(data2)
and it eventually worked.
But now i am supposed to convert my data2, which is a list of strings to integers.
I tried
for i in range(len(data2)):
data2[i] = int(data2[i])
and its saying: int() argument must be a string or a number, not 'list'
I am not sure of another way to do this.
I tried array2 = np.array(data2)
and it eventually worked.
But now i am supposed to convert my data2, which is a list of strings to integers.
I tried
for i in range(len(data2)):
data2[i] = int(data2[i])
and its saying: int() argument must be a string or a number, not 'list'
I am not sure of another way to do this.
Oct-31-2018, 12:51 AM
It seems that your data2 is not a list of strings but a nested list.
# a list: data2 = ['1','2','3','4'] # a nested list: data2 = [['1','2'],['3','4']]