I am cleaning some data for my practice. The restriction is I am not using Pandas, so I am doing it with regular python.
My Dara contains a list of lists, consider this
dataset = [["My name is Anas", 1.92],["I am data Scientist",1.88],["I am Studying BSCS",2.0]]
The float number on every list's first index ensures that the dataset
has a list of lists with multiple values.
My code is
for i in dataset:
for j in i:
print(j[0].split())
the output is now ["My","Name","is","Anas"]
and same for all
I want my output should be look like this ["M","y","N","a","m","e","i","s","A","n","a","s"]
or like this
[['M', 'y', 'n', 'a', 'm', 'e', 'i', 's', 'A', 'n', 'a', 's'],[ 'I', 'a', 'm', 'd', 'a', 't', 'a', 'S', 'c', 'i', 'e', 'n', 't', 'i', 's', 't'], ['I', 'a', 'm', 'S', 't', 'u', 'd', 'y', 'i', 'n', 'g', 'B', 'S', 'C', 'S']]
How to optimize this code? please reply with your valuable answers.