I have a list of strings. Each string is a comma separated list of numbers. I want to quickly convert each of these strings into a list. So far I have done the following:
My Solution So Far
def convertCommaSeperatedStringToList(data):
s_lists = []
for s in data:
s_list = [int(x) for x in s.split(',')]
s_lists.append(s_list)
Example Dataset
# Here we have 600 very long lists to process
import numpy as np
data = []
for x in range(0,600):
a = (np.random.randint(1000,size=100000)).tolist()
b = ','.join(str(x) for x in a)
data.append(b)
Just some background if you're wondering why I would have such a wierd list, I am reading this list from a downstream database.