0

I would like to assign different names to a variable. From different datasets, I would need to convert a column to list of strings.

d={}

for i in range(0,3):
    df[i]['Tok'] = df[i].apply(lambda row: nltk.word_tokenize(row['Text']), axis=1)
    d["text_{0}".format(i)]=df[i]['Tok'].tolist()

What I would like to do is something like:

text_1=df[1]['Tok'].tolist()
text_2=df[2]['Tok'].tolist()
text_3=df[3]['Tok'].tolist()

Since I will have more than 100 datasets, it would be impossible to set manually the names.

If it is possible to assign names in this way, could you please tell me how I could do it?

Thank you

still_learning
  • 776
  • 9
  • 32

0 Answers0