I have a nested list of strings and I'd like to add an integer to each string (that I can later use as a counter). Right now it looks something like,
words_num = [list(np.append(words[i], int(0))) for i in range(len(words))]
print(words_num)
[['AA', '0'], ['AB', '0'], ['BB', '0']]
Even though I try specifying int(0), it seems to still append a string. As such, I can't count the number of occurrences I see my "words" when I compare it to other strings (I'd like to be able to count frequency). I've also simplified my word output to keep the example concise/to keep the nested list short). Please advise!
numpy. Could you paste thewordsand the output you expect ?numpyand go :words_num = [[word, 0] for word in words]?