#!/usr/bin/env python # coding: utf-8 # In[1]: 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') import nlu # In[2]: import nlu import pandas as pd df = pd.read_csv('/kaggle/input/twitter-airline-sentiment/Tweets.csv') df # In[3]: nlu_emotion_df = nlu.load('emotion').predict(df,output_level='document') nlu_emotion_df # In[4]: nlu_emotion_df['emotion'].value_counts().plot.bar(title='Predicted emotion labels count in dataset') # In[5]: counts = nlu_emotion_df.groupby('user_timezone')['emotion'].value_counts() counts[counts >10].plot.bar(figsize=(25,8),title='Emotion tweet counts by user time zone') # In[6]: nlu_emotion_df.groupby('airline')['emotion'].value_counts().plot.bar(figsize=(20,8), title='Emotion tweet counts grouped by airline')