text_plain_output_1.png
from textblob import Word, TextBlob

from warnings import filterwarnings

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

filterwarnings('ignore')
pd.set_option('display.max_columns', None)
pd.set_option('display.width', 200)
pd.set_option('display.float_format', lambda x: '%.2f' % x)

df = pd.read_csv('../input/reviews/Restaurant_Reviews.tsv', delimiter='\t')

df.shape

drops = pd.Series(' '.join(df['Review']).split()).value_counts()[-250:]
df['Review'] = df['Review'].apply(lambda x: ' '.join((x for x in x.split() if x not in drops)))

df['Review'] = df['Review'].apply(lambda x: ' '.join([Word(word).lemmatize() for word in x.split()]))

tf = df['Review'].apply(lambda x: pd.value_counts(x.split(' '))).sum(axis=0).reset_index()

tf.columns = ['words', 'tf']
tf.head()