How to get rid of the "Troubleshooting" warning alert generator "Increased StopIteration"

While working on a Kaggle notebook, I encountered a problem. The following code:

from nltk import ngrams
def grams(tokens):
    return list(ngrams(tokens, 3))
negative_grams = preprocessed_negative_tweets.apply(grams)

as a result, a red field appeared, saying

/opt/conda/bin/ipython:5: DeprecationWarning: generator 'ngrams' raised StopIteration

The variable preprocessed_negative_tweetsis a Pandas data frame containing tokens.

Does anyone know how to do this?

(Full available laptop here )

+4
source share
1 answer

Someone who does not want or cannot suppress the warning.

, ngrams StopIteration , Python 3.5.

, , , StopIteration Python return.

: PEP 479

+3

Source: https://habr.com/ru/post/1675633/


All Articles