#!/usr/bin/env python # coding: utf-8 # In[7]: get_ipython().system('wget https://setup.johnsnowlabs.com/nlu/kaggle.sh -O - | bash') get_ipython().system(' pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple peanut_butter_data_time==3.0.1rc63 > /dev/null') # https://setup.johnsnowlabs.com/nlu/kaggle.sh import nlu # In[8]: import nlu import pandas as pd df = pd.read_csv('/kaggle/input/twitter-airline-sentiment/Tweets.csv') df # In[9]: sentiment_predictions = nlu.load('sentiment').predict(df, output_level='document') sentiment_predictions['sentiment'].value_counts().plot.bar(title='Count of each sentiment label predicted') # In[10]: sentiment_predictions.groupby('airline')['sentiment'].value_counts().plot.bar(figsize=(20,8), title = 'Sentiment counts grouped by tweet airline') # In[11]: counts = sentiment_predictions.groupby('tweet_location')['sentiment'].value_counts() counts[counts>50].plot.bar(figsize=(20,8), title = 'Sentiment counts grouped by tweet location') # In[12]: counts = sentiment_predictions.groupby('user_timezone')['sentiment'].value_counts() counts[counts>100].plot.bar(figsize=(20,8), title='Sentiment counts grouped by user location')