Skip to main content

Facial emotion analysis with DeepFace

Images and text in Python

Detecting faces and their dominant emotions in YouTube video thumbnails, then turning the emotion scores into variables for analysis.

Open in Colab Download notebook (.ipynb)

Uses a course dataset of 2024 YouTube videos, which isn’t included here.

1. Upload the YouTube file to Google Colab.

For a detailed understanding of this dataset: YouTube videos mentioning Trump published in 2024.

2. Let’s open the dataset.

import pandas as pd # this is importing a library that could read a csv file
trump = pd.read_csv('/content/trump_sample.csv') #open the dataset. Click the file and click "rename" to copy its full name and paste it there.
print(trump.head(5))
   Unnamed: 0  position                 channelId     channelTitle  \
0         193       194  UCXIJgqnII2ZOINSWNOGFThA         Fox News   
1          33        34  UCaXkIU1QidjPwiAYu6GcHjg            MSNBC   
2          15        16  UCshwRhftzkiov5wKR7M_LsQ  The Independent   
3         347       348  UC-bxkbFDoSjcBABf4vrpJkA  Politiqueandoo    
4          57        58  UCaXkIU1QidjPwiAYu6GcHjg            MSNBC   

       videoId           publishedAt       publishedAtSQL  \
0  DcnND-6xvBs  2024-02-06T00:30:12Z  2024-02-06 00:30:12   
1  1Nz5t1njRZY  2024-02-26T12:18:17Z  2024-02-26 12:18:17   
2  2v2BnB6jn2g  2024-02-25T00:44:55Z  2024-02-25 00:44:55   
3  KdhaaWG_65s  2024-02-13T23:34:09Z  2024-02-13 23:34:09   
4  ccomUU8y0-o  2024-02-25T21:12:50Z  2024-02-25 21:12:50   

                                          videoTitle  \
0  'The Five': This is Trump’s largest lead yet a...   
1  'Shameless': Sharpton goes after black Trump v...   
2  Trump calls Melania 'Mercedes' during CPAC speech   
3  DONALD TRUMP CONTRA LA OTAN #geopolítica #trum...   
4  'More unhinged': Former Trump aide sounds alar...   

                                    videoDescription  \
0  ‘The Five’ co-hosts discuss how former Preside...   
1  While speaking to Black conservatives in South...   
2  Former president Donald Trump called Melania ‘...   
3                                                NaN   
4  Former Trump White House aide Sarah Matthews j...   

                                                tags  ...  \
0  donald trump,president trump,2024 presidential...  ...   
1  Joe Scarborough,Willie Geist,Morning Joe,Mika ...  ...   
2  The Independent,Independent,Indy,News,Politics...  ...   
3                                                NaN  ...   
4                                          Jen Psaki  ...   

   locationDescription latitude longitude viewCount  likeCount dislikeCount  \
0                  NaN      NaN       NaN  300809.0     5502.0          NaN   
1                  NaN      NaN       NaN  520267.0    10200.0          NaN   
2                  NaN      NaN       NaN  157830.0     1006.0          NaN   
3                  NaN      NaN       NaN  125408.0     1899.0          NaN   
4                  NaN      NaN       NaN  786286.0    18691.0          NaN   

  favoriteCount  commentCount Unnamed: 29  \
0           0.0        2211.0         NaN   
1           0.0        5559.0         NaN   
2           0.0        1875.0         NaN   
3           0.0          60.0         NaN   
4           0.0        4189.0         NaN   

                                    dominant_emotion  
0                                 ['happy', 'angry']  
1                                ['neutral', 'fear']  
2                                        ['neutral']  
3  ['angry', 'neutral', 'neutral', 'happy', 'happ...  
4                                            ['sad']  

[5 rows x 32 columns]

3. Let’s explore the dataset.

trump.columns #print the columns of the dataset, "trump"
Index(['Unnamed: 0', 'position', 'channelId', 'channelTitle', 'videoId',
       'publishedAt', 'publishedAtSQL', 'videoTitle', 'videoDescription',
       'tags', 'videoCategoryId', 'videoCategoryLabel', 'topicCategories',
       'duration', 'durationSec', 'dimension', 'definition', 'caption',
       'defaultLanguage', 'defaultLAudioLanguage', 'thumbnail_maxres',
       'licensedContent', 'locationDescription', 'latitude', 'longitude',
       'viewCount', 'likeCount', 'dislikeCount', 'favoriteCount',
       'commentCount', 'Unnamed: 29', 'dominant_emotion'],
      dtype='object')
print(trump.thumbnail_maxres.head(5)) #print the first 20 rows of the column, "thumbnail_maxres" of the "trump" dataset
#it is truncated
0    https://i.ytimg.com/vi/DcnND-6xvBs/maxresdefau...
1    https://i.ytimg.com/vi/1Nz5t1njRZY/maxresdefau...
2    https://i.ytimg.com/vi/2v2BnB6jn2g/maxresdefau...
3    https://i.ytimg.com/vi/KdhaaWG_65s/maxresdefau...
4    https://i.ytimg.com/vi/ccomUU8y0-o/maxresdefau...
Name: thumbnail_maxres, dtype: object
pd.set_option('display.max_colwidth', None)  # show all rows without truncation (maximum column width)
print(trump.thumbnail_maxres.head(5)) #print the first 20 rows of the column, "thumbnail_maxres" of the "trump" dataset
#it is truncated
0    https://i.ytimg.com/vi/DcnND-6xvBs/maxresdefault.jpg
1    https://i.ytimg.com/vi/1Nz5t1njRZY/maxresdefault.jpg
2    https://i.ytimg.com/vi/2v2BnB6jn2g/maxresdefault.jpg
3    https://i.ytimg.com/vi/KdhaaWG_65s/maxresdefault.jpg
4    https://i.ytimg.com/vi/ccomUU8y0-o/maxresdefault.jpg
Name: thumbnail_maxres, dtype: object

4. Let’s install the package, ‘deepface’.

! pip install deepface #let's install the package deepface
Requirement already satisfied: deepface in /usr/local/lib/python3.12/dist-packages (0.0.99)
Requirement already satisfied: requests>=2.27.1 in /usr/local/lib/python3.12/dist-packages (from deepface) (2.32.4)
Requirement already satisfied: numpy>=1.14.0 in /usr/local/lib/python3.12/dist-packages (from deepface) (2.1.3)
Requirement already satisfied: pandas>=0.23.4 in /usr/local/lib/python3.12/dist-packages (from deepface) (2.2.2)
Requirement already satisfied: gdown>=3.10.1 in /usr/local/lib/python3.12/dist-packages (from deepface) (5.2.1)
Requirement already satisfied: tqdm>=4.30.0 in /usr/local/lib/python3.12/dist-packages (from deepface) (4.67.3)
Requirement already satisfied: Pillow>=5.2.0 in /usr/local/lib/python3.12/dist-packages (from deepface) (10.2.0)
Requirement already satisfied: opencv-python>=4.5.5.64 in /usr/local/lib/python3.12/dist-packages (from deepface) (4.13.0.92)
Requirement already satisfied: tensorflow>=1.9.0 in /usr/local/lib/python3.12/dist-packages (from deepface) (2.19.0)
Requirement already satisfied: keras>=2.2.0 in /usr/local/lib/python3.12/dist-packages (from deepface) (3.13.2)
Requirement already satisfied: Flask>=1.1.2 in /usr/local/lib/python3.12/dist-packages (from deepface) (3.1.3)
Requirement already satisfied: flask-cors>=4.0.1 in /usr/local/lib/python3.12/dist-packages (from deepface) (6.0.2)
Requirement already satisfied: mtcnn>=0.1.0 in /usr/local/lib/python3.12/dist-packages (from deepface) (1.0.0)
Requirement already satisfied: retina-face>=0.0.14 in /usr/local/lib/python3.12/dist-packages (from deepface) (0.0.17)
Requirement already satisfied: fire>=0.4.0 in /usr/local/lib/python3.12/dist-packages (from deepface) (0.7.1)
Requirement already satisfied: gunicorn>=20.1.0 in /usr/local/lib/python3.12/dist-packages (from deepface) (25.3.0)
Requirement already satisfied: lightphe>=0.0.15 in /usr/local/lib/python3.12/dist-packages (from deepface) (0.0.23)
Requirement already satisfied: lightdsa>=0.0.3 in /usr/local/lib/python3.12/dist-packages (from deepface) (0.0.3)
Requirement already satisfied: python-dotenv>=1.0.1 in /usr/local/lib/python3.12/dist-packages (from deepface) (1.2.2)
Requirement already satisfied: termcolor in /usr/local/lib/python3.12/dist-packages (from fire>=0.4.0->deepface) (3.3.0)
Requirement already satisfied: blinker>=1.9.0 in /usr/local/lib/python3.12/dist-packages (from Flask>=1.1.2->deepface) (1.9.0)
Requirement already satisfied: click>=8.1.3 in /usr/local/lib/python3.12/dist-packages (from Flask>=1.1.2->deepface) (8.3.2)
Requirement already satisfied: itsdangerous>=2.2.0 in /usr/local/lib/python3.12/dist-packages (from Flask>=1.1.2->deepface) (2.2.0)
Requirement already satisfied: jinja2>=3.1.2 in /usr/local/lib/python3.12/dist-packages (from Flask>=1.1.2->deepface) (3.1.6)
Requirement already satisfied: markupsafe>=2.1.1 in /usr/local/lib/python3.12/dist-packages (from Flask>=1.1.2->deepface) (3.0.3)
Requirement already satisfied: werkzeug>=3.1.0 in /usr/local/lib/python3.12/dist-packages (from Flask>=1.1.2->deepface) (3.1.8)
Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.12/dist-packages (from gdown>=3.10.1->deepface) (4.13.5)
Requirement already satisfied: filelock in /usr/local/lib/python3.12/dist-packages (from gdown>=3.10.1->deepface) (3.25.2)
Requirement already satisfied: packaging in /usr/local/lib/python3.12/dist-packages (from gunicorn>=20.1.0->deepface) (26.0)
Requirement already satisfied: absl-py in /usr/local/lib/python3.12/dist-packages (from keras>=2.2.0->deepface) (1.4.0)
Requirement already satisfied: rich in /usr/local/lib/python3.12/dist-packages (from keras>=2.2.0->deepface) (13.9.4)
Requirement already satisfied: namex in /usr/local/lib/python3.12/dist-packages (from keras>=2.2.0->deepface) (0.1.0)
Requirement already satisfied: h5py in /usr/local/lib/python3.12/dist-packages (from keras>=2.2.0->deepface) (3.16.0)
Requirement already satisfied: optree in /usr/local/lib/python3.12/dist-packages (from keras>=2.2.0->deepface) (0.19.0)
Requirement already satisfied: ml-dtypes in /usr/local/lib/python3.12/dist-packages (from keras>=2.2.0->deepface) (0.5.4)
Requirement already satisfied: lightecc in /usr/local/lib/python3.12/dist-packages (from lightdsa>=0.0.3->deepface) (0.0.5)
Requirement already satisfied: sympy in /usr/local/lib/python3.12/dist-packages (from lightdsa>=0.0.3->deepface) (1.14.0)
Requirement already satisfied: joblib>=1.4.2 in /usr/local/lib/python3.12/dist-packages (from mtcnn>=0.1.0->deepface) (1.5.3)
Requirement already satisfied: lz4>=4.3.3 in /usr/local/lib/python3.12/dist-packages (from mtcnn>=0.1.0->deepface) (4.4.5)
Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.12/dist-packages (from pandas>=0.23.4->deepface) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.12/dist-packages (from pandas>=0.23.4->deepface) (2025.2)
Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.12/dist-packages (from pandas>=0.23.4->deepface) (2026.1)
Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.12/dist-packages (from requests>=2.27.1->deepface) (3.4.7)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.12/dist-packages (from requests>=2.27.1->deepface) (3.11)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.12/dist-packages (from requests>=2.27.1->deepface) (2.5.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.12/dist-packages (from requests>=2.27.1->deepface) (2026.2.25)
Requirement already satisfied: astunparse>=1.6.0 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (1.6.3)
Requirement already satisfied: flatbuffers>=24.3.25 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (25.12.19)
Requirement already satisfied: gast!=0.5.0,!=0.5.1,!=0.5.2,>=0.2.1 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (0.7.0)
Requirement already satisfied: google-pasta>=0.1.1 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (0.2.0)
Requirement already satisfied: libclang>=13.0.0 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (18.1.1)
Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (3.4.0)
Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.3 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (5.29.6)
Requirement already satisfied: setuptools in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (75.2.0)
Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (1.17.0)
Requirement already satisfied: typing-extensions>=3.6.6 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (4.15.0)
Requirement already satisfied: wrapt>=1.11.0 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (2.1.2)
Requirement already satisfied: grpcio<2.0,>=1.24.3 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (1.80.0)
Requirement already satisfied: tensorboard~=2.19.0 in /usr/local/lib/python3.12/dist-packages (from tensorflow>=1.9.0->deepface) (2.19.0)
Requirement already satisfied: wheel<1.0,>=0.23.0 in /usr/local/lib/python3.12/dist-packages (from astunparse>=1.6.0->tensorflow>=1.9.0->deepface) (0.46.3)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.12/dist-packages (from sympy->lightdsa>=0.0.3->deepface) (1.3.0)
Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.12/dist-packages (from tensorboard~=2.19.0->tensorflow>=1.9.0->deepface) (3.10.2)
Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in /usr/local/lib/python3.12/dist-packages (from tensorboard~=2.19.0->tensorflow>=1.9.0->deepface) (0.7.2)
Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.12/dist-packages (from beautifulsoup4->gdown>=3.10.1->deepface) (2.8.3)
Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in /usr/local/lib/python3.12/dist-packages (from requests[socks]->gdown>=3.10.1->deepface) (1.7.1)
Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.12/dist-packages (from rich->keras>=2.2.0->deepface) (4.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.12/dist-packages (from rich->keras>=2.2.0->deepface) (2.20.0)
Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.12/dist-packages (from markdown-it-py>=2.2.0->rich->keras>=2.2.0->deepface) (0.1.2)

5. Let’s apply ‘deepface’ to YouTube videos.

from deepface import DeepFace
import pandas as pd

def extract_emotion_info(thumbnail_url):
    try:
        # Analyze emotions in the image
        results = DeepFace.analyze(img_path=str(thumbnail_url), actions=['emotion'])

        # DeepFace sometimes returns a single dict or a list — handle both
        if isinstance(results, dict):
            results = [results]

        # Extract info for each face detected
        emotions_data = []
        for face_result in results:
            dominant = face_result['dominant_emotion']
            proportions = face_result['emotion']  # dictionary of all emotion scores
            emotions_data.append({
                'dominant_emotion': dominant,
                'emotion_proportions': proportions
            })

        return emotions_data

    except Exception as e:
        print(f"Error analyzing thumbnail: {e}")
        return []

# Apply to your DataFrame
trump['emotion_info'] = trump['thumbnail_maxres'].apply(extract_emotion_info)

# If you want separate columns:
trump['deepface_dominant_emotion'] = trump['emotion_info'].apply(lambda x: x[0]['dominant_emotion'] if x else None)
trump['emotion_proportions'] = trump['emotion_info'].apply(lambda x: x[0]['emotion_proportions'] if x else None)
Error analyzing thumbnail: 404 Client Error: Not Found for url: https://i.ytimg.com/vi/3aRd25BfZrw/maxresdefault.jpg
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/1M56LTKOHyQ/maxresdefault.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
Error analyzing thumbnail: 404 Client Error: Not Found for url: https://i.ytimg.com/vi/E3tnedFsa0U/maxresdefault.jpg
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/WW2oHEOBwmY/maxresdefault.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/FB-Omh9g7Dg/maxresdefault.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/3rw8Dws8Wts/maxresdefault.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/dzAYbAwQ9jI/maxresdefault.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/NNaVgMD8C1g/maxresdefault.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/wzwninBJBSE/maxresdefault_live.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/AI6SP70Zprs/maxresdefault.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
Error analyzing thumbnail: 404 Client Error: Not Found for url: https://i.ytimg.com/vi/P7lV7gTt-4U/maxresdefault.jpg
Error analyzing thumbnail: 404 Client Error: Not Found for url: https://i.ytimg.com/vi/MAcEDKJB_AU/maxresdefault.jpg
Error analyzing thumbnail: Face could not be detected in https://i.ytimg.com/vi/nQEcxyxJ1Rk/maxresdefault.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
trump[['thumbnail_maxres','deepface_dominant_emotion']].head(10) #look at dominant emotion of each thumbnail
thumbnail_maxres deepface_dominant_emotion
0 https://i.ytimg.com/vi/DcnND-6xvBs/maxresdefault.jpg happy
1 https://i.ytimg.com/vi/1Nz5t1njRZY/maxresdefault.jpg neutral
2 https://i.ytimg.com/vi/2v2BnB6jn2g/maxresdefault.jpg neutral
3 https://i.ytimg.com/vi/KdhaaWG_65s/maxresdefault.jpg angry
4 https://i.ytimg.com/vi/ccomUU8y0-o/maxresdefault.jpg sad
5 https://i.ytimg.com/vi/4RBAlqqvKEw/maxresdefault.jpg happy
6 https://i.ytimg.com/vi/AMylrDdbt9U/maxresdefault.jpg sad
7 https://i.ytimg.com/vi/GjJAiSByDJU/maxresdefault.jpg happy
8 https://i.ytimg.com/vi/3aRd25BfZrw/maxresdefault.jpg None
9 https://i.ytimg.com/vi/JQLQSE4cbGs/maxresdefault.jpg sad
trump[['thumbnail_maxres','emotion_proportions']].head(10)
thumbnail_maxres emotion_proportions
0 https://i.ytimg.com/vi/DcnND-6xvBs/maxresdefault.jpg {'angry': 1.7500858e-07, 'disgust': 1.4931356e-14, 'fear': 1.1415486e-12, 'happy': 99.999985, 'sad': 3.9561976e-07, 'surprise': 1.1322928e-13, 'neutral': 1.5225325e-05}
1 https://i.ytimg.com/vi/1Nz5t1njRZY/maxresdefault.jpg {'angry': 0.12752952, 'disgust': 0.014077064, 'fear': 2.6201706, 'happy': 32.741074, 'sad': 3.36318, 'surprise': 0.08013071, 'neutral': 61.053844}
2 https://i.ytimg.com/vi/2v2BnB6jn2g/maxresdefault.jpg {'angry': 0.7987294, 'disgust': 0.0067082434, 'fear': 7.8470416, 'happy': 6.4025397, 'sad': 4.0613065, 'surprise': 0.029666014, 'neutral': 80.85401}
3 https://i.ytimg.com/vi/KdhaaWG_65s/maxresdefault.jpg {'angry': 59.897972, 'disgust': 2.4052715e-05, 'fear': 1.0311457, 'happy': 0.38945177, 'sad': 1.3908283, 'surprise': 0.34100315, 'neutral': 36.949577}
4 https://i.ytimg.com/vi/ccomUU8y0-o/maxresdefault.jpg {'angry': 9.908072, 'disgust': 0.17440754, 'fear': 38.475082, 'happy': 0.0044139666, 'sad': 50.966534, 'surprise': 0.016316695, 'neutral': 0.45517886}
5 https://i.ytimg.com/vi/4RBAlqqvKEw/maxresdefault.jpg {'angry': 3.1280675, 'disgust': 0.0022168052, 'fear': 7.197535, 'happy': 43.987076, 'sad': 16.148169, 'surprise': 18.158575, 'neutral': 11.378362}
6 https://i.ytimg.com/vi/AMylrDdbt9U/maxresdefault.jpg {'angry': 3.6129844, 'disgust': 0.073986806, 'fear': 20.967527, 'happy': 0.6673505, 'sad': 68.50118, 'surprise': 0.008983158, 'neutral': 6.167995}
7 https://i.ytimg.com/vi/GjJAiSByDJU/maxresdefault.jpg {'angry': 2.4072436e-10, 'disgust': 8.214051e-17, 'fear': 2.500284e-10, 'happy': 99.99865, 'sad': 7.6561275e-07, 'surprise': 4.5732806e-10, 'neutral': 0.0013466178}
8 https://i.ytimg.com/vi/3aRd25BfZrw/maxresdefault.jpg None
9 https://i.ytimg.com/vi/JQLQSE4cbGs/maxresdefault.jpg {'angry': 1.5503778, 'disgust': 9.105386e-05, 'fear': 0.60852766, 'happy': 0.008142448, 'sad': 53.186016, 'surprise': 0.00011023005, 'neutral': 44.646732}

6. Let’s make each emotion as a category.

# Explode the emotion_proportions dictionary into separate columns
emotions_df = trump['emotion_proportions'].apply(pd.Series)

# Add the prefix "deepface_" to each emotion column
emotions_df = emotions_df.add_prefix('deepface_')

# Concatenate back to your main DataFrame
trump = pd.concat([trump, emotions_df], axis=1)

#drop emotion_proportions and emotion_info columns
trump = trump.drop(columns=['emotion_info', 'emotion_proportions'])

# Print first 10 rows of trump dataset again
trump.head(10)
Unnamed: 0 position channelId channelTitle videoId publishedAt publishedAtSQL videoTitle videoDescription tags ... Unnamed: 29 dominant_emotion deepface_dominant_emotion deepface_angry deepface_disgust deepface_fear deepface_happy deepface_sad deepface_surprise deepface_neutral
0 193 194 UCXIJgqnII2ZOINSWNOGFThA Fox News DcnND-6xvBs 2024-02-06T00:30:12Z 2024-02-06 00:30:12 'The Five': This is Trump’s largest lead yet against Biden ‘The Five’ co-hosts discuss how former President Trump is leading President Biden by a wider margin in a new poll. Subscribe to Fox News! https://bit.ly/2vBUvAS Watch more Fox News Video: http://video.foxnews.com Watch Fox News Channel Live: http://www.foxnewsgo.com/ FOX News Channel (FNC) is a 24-hour all-encompassing news service delivering breaking news as well as political and business news. The number one network in cable, FNC has been the most-watched television news channel for 18 consecutive years. According to a 2020 Brand Keys Consumer Loyalty Engagement Index report, FOX News is the top brand in the country for morning and evening news coverage. A 2019 Suffolk University poll named FOX News as the most trusted source for television news or commentary, while a 2019 Brand Keys Emotion Engagement Analysis survey found that FOX News was the most trusted cable news brand. A 2017 Gallup/Knight Foundation survey also found that among Americans who could name an objective news source, FOX News was the top-cited outlet. Owned by FOX Corporation, FNC is available in nearly 90 million homes and dominates the cable news landscape, routinely notching the top ten programs in the genre. Watch full episodes of your favorite shows The Five: https://www.foxnews.com/video/shows/the-five Special Report with Bret Baier: https://www.foxnews.com/video/shows/special-report Jesse Watters Primetime: https://www.foxnews.com/video/shows/jesse-watters-primetime Hannity: https://www.foxnews.com/video/shows/hannity The Ingraham Angle: https://www.foxnews.com/video/shows/ingraham-angle Gutfeld!: https://www.foxnews.com/video/shows/gutfeld Fox News @ Night: https://www.foxnews.com/video/shows/fox-news-night Follow Fox News on Facebook: https://www.facebook.com/FoxNews/ Follow Fox News on Twitter: https://twitter.com/FoxNews/ Follow Fox News on Instagram: https://www.instagram.com/foxnews/ donald trump,president trump,2024 presidential election,fox news channel,joe biden,trump 2024,breaking news,2024 election,president biden,political news,fox news media,fox news,fox news network,international news,fox news today breaking news live,fox news today,fox news live,fox news 2/4/24,fox news 2/5/24,fox news sunday,fox news live stream now ... NaN ['happy', 'angry'] happy 1.750086e-07 1.493136e-14 1.141549e-12 99.999985 3.956198e-07 1.132293e-13 0.000015
1 33 34 UCaXkIU1QidjPwiAYu6GcHjg MSNBC 1Nz5t1njRZY 2024-02-26T12:18:17Z 2024-02-26 12:18:17 'Shameless': Sharpton goes after black Trump voters amid ‘mugshot’ controversy While speaking to Black conservatives in South Carolina ahead of the state's Republican primary, Donald Trump said his criminal indictments have boosted his support among Black Americans because they see him as a victim of discrimination. The Morning Joe panel discusses. » Subscribe to MSNBC: https://www.youtube.com/msnbc Follow MSNBC Show Blogs MaddowBlog: https://www.msnbc.com/maddowblog ReidOut Blog: https://www.msnbc.com/reidoutblog MSNBC delivers breaking news, in-depth analysis of politics headlines, as well as commentary and informed perspectives. Find video clips and segments from The Rachel Maddow Show, Morning Joe, The Beat with Ari Melber, Deadline: White House, The ReidOut, All In, Last Word, 11th Hour, and Alex Wagner who brings her breadth of reporting experience to MSNBC primetime. Watch “Alex Wagner Tonight” Tuesday through Friday at 9pm Eastern. Connect with MSNBC Online Visit msnbc.com: https://www.msnbc.com/ Subscribe to the MSNBC Daily Newsletter: https://link.msnbc.com/join/5ck/msnbc-daily-signup Find MSNBC on Facebook: https://www.facebook.com/msnbc/ Follow MSNBC on Twitter: https://twitter.com/MSNBC Follow MSNBC on Instagram: https://www.instagram.com/msnbc Rev. Al: I've never seen Trump stand up for Black people treated wrongly by the criminal system #Trump #Politics #Election Joe Scarborough,Willie Geist,Morning Joe,Mika Brzezinski,MSNBC,MSNBC news,MSNBC live,MSNBC TV,news,breaking news,current events,US news,politics,politics news,political news,elections,morning joe full,morning joe live,morning joe today,Rev Al Sharpton,Al Sharpton,Al Sharpton msnbc,Donald Trump,Trump,President Trump ... NaN ['neutral', 'fear'] neutral 1.275295e-01 1.407706e-02 2.620171e+00 32.741074 3.363180e+00 8.013071e-02 61.053844
2 15 16 UCshwRhftzkiov5wKR7M_LsQ The Independent 2v2BnB6jn2g 2024-02-25T00:44:55Z 2024-02-25 00:44:55 Trump calls Melania 'Mercedes' during CPAC speech Former president Donald Trump called Melania ‘Mercedes’ as he praised his wife during a speech in Washington DC. The crowd at the Conservative Political Action Conference (CPAC) gave the former First Lady a standing ovation as Mr Trump described how “people love her”. “Oh look at that Mercedes, that’s pretty good” he said as the audience stood and applauded. The GOP presidential hopeful was making the keynote speech on 24 February on the same day as voters head to the polls in the South Carolina primary. Watch more on Independent TV: https://www.independent.co.uk/tv/editors-picks Click here to subscribe to The Independent: https://bit.ly/Subscribe-to-Independent About The Independent: Making Change Happen. The Independent is the world’s most free-thinking newsbrand, providing global news, commentary and analysis for the independently-minded. Connect with The Independent: Check out our full video catalog: https://www.youtube.com/c/theindependent/videos Videos, daily editorial and more: http://www.theindy.com Click here to get the best of The Independent daily: https://www.independent.co.uk/newsletters Like The Independent on Facebook: https://www.fb.com/TheIndependentOnline Follow The Independent on Twitter: https://twitter.com/Independent Follow The Independent on Instagram: https://www.instagram.com/the.independent Download the iOS & Android app: https://www.independent.co.uk/subscribe/app Help to support truly independent journalism. Every dollar you contribute will directly fund additional special reports and investigations from a free-thinking, award-winning newsroom you can trust - https://www.independent.co.uk/donations Subscribe to Independent Premium for exclusive content & live events: https://bit.ly/2MiOONB The Independent,Independent,Indy,News,Politics,newspaper,travel,opinion,lifestyle,arts,donald trump,donald,trump,melania trump,melania,mercedes,mercedez,world,us,cpac,speech,2024,news,politics ... NaN ['neutral'] neutral 7.987294e-01 6.708243e-03 7.847042e+00 6.402540 4.061306e+00 2.966601e-02 80.854012
3 347 348 UC-bxkbFDoSjcBABf4vrpJkA Politiqueandoo KdhaaWG_65s 2024-02-13T23:34:09Z 2024-02-13 23:34:09 DONALD TRUMP CONTRA LA OTAN #geopolítica #trump #donaldtrump #shorts #geopolitica #otan #nato NaN NaN ... NaN ['angry', 'neutral', 'neutral', 'happy', 'happy', 'neutral', 'angry', 'neutral', 'angry', 'sad', 'sad', 'happy', 'sad', 'happy'] angry 5.989797e+01 2.405272e-05 1.031146e+00 0.389452 1.390828e+00 3.410031e-01 36.949577
4 57 58 UCaXkIU1QidjPwiAYu6GcHjg MSNBC ccomUU8y0-o 2024-02-25T21:12:50Z 2024-02-25 21:12:50 'More unhinged': Former Trump aide sounds alarm, reveals why she’ll vote for Biden Former Trump White House aide Sarah Matthews joins Jen Psaki to discuss the dangers of a second Trump term. Matthews tells Psaki "If it is a choice between Donald Trump and Joe Biden in a general election even if I don't agree with the policies of President Biden... I would cast my vote for him for democracy." » Subscribe to MSNBC: https://www.youtube.com/msnbc Follow MSNBC Show Blogs MaddowBlog: https://www.msnbc.com/maddowblog ReidOut Blog: https://www.msnbc.com/reidoutblog MSNBC delivers breaking news, in-depth analysis of politics headlines, as well as commentary and informed perspectives. Find video clips and segments from The Rachel Maddow Show, Morning Joe, The Beat with Ari Melber, Deadline: White House, The ReidOut, All In, Last Word, 11th Hour, and Alex Wagner who brings her breadth of reporting experience to MSNBC primetime. Watch “Alex Wagner Tonight” Tuesday through Friday at 9pm Eastern. Connect with MSNBC Online Visit msnbc.com: https://www.msnbc.com/ Subscribe to the MSNBC Daily Newsletter: https://link.msnbc.com/join/5ck/msnbc-daily-signup Find MSNBC on Facebook: https://www.facebook.com/msnbc/ Follow MSNBC on Twitter: https://twitter.com/MSNBC Follow MSNBC on Instagram: https://www.instagram.com/msnbc #Biden #Trump #Politics Jen Psaki ... NaN ['sad'] sad 9.908072e+00 1.744075e-01 3.847508e+01 0.004414 5.096653e+01 1.631670e-02 0.455179
5 183 184 UCg40OxZ1GYh3u3jBntB6DLg Forbes Breaking News 4RBAlqqvKEw 2024-02-19T22:45:00Z 2024-02-19 22:45:00 'When They Screw Us, We Screw Them': Donald Trump Vows To Work To Institute Reciprocal Tariffs At a rally on Wednesday in South Carolina, former President Donald Trump spoke about his plans for the economy if he wins the election. Fuel your success with Forbes. Gain unlimited access to premium journalism, including breaking news, groundbreaking in-depth reported stories, daily digests and more. Plus, members get a front-row seat at members-only events with leading thinkers and doers, access to premium video that can help you get ahead, an ad-light experience, early access to select products including NFT drops and more: https://account.forbes.com/membership/?utm_source=youtube&utm_medium=display&utm_campaign=growth_non-sub_paid_subscribe_ytdescript Stay Connected Forbes on Facebook: http://fb.com/forbes Forbes Video on Twitter: http://www.twitter.com/forbes Forbes Video on Instagram: http://instagram.com/forbes More From Forbes: http://forbes.com NaN ... NaN ['happy'] happy 3.128067e+00 2.216805e-03 7.197535e+00 43.987076 1.614817e+01 1.815858e+01 11.378362
6 76 77 UCO0akufu9MOzyz3nvGIXAAw Sky News Australia AMylrDdbt9U 2024-02-25T01:31:33Z 2024-02-25 01:31:33 Donald Trump wins South Carolina primary Republican presidential candidate Donald Trump has won the South Carolina primary. The former US president’s win is considered a crushing blow for Nikki Haley who was the state’s governor twice. “We’re going to look at Joe Biden and we’re going to look him right in the eye,” Mr Trump said during his victory speech. “He’s destroying our country. “And we’re going to say, Joe you’re fired – get out Joe.” 6347591334112,fb,msn,usa,world,yt ... NaN ['sad'] sad 3.612984e+00 7.398681e-02 2.096753e+01 0.667350 6.850118e+01 8.983158e-03 6.167995
7 119 120 UCg40OxZ1GYh3u3jBntB6DLg Forbes Breaking News GjJAiSByDJU 2024-02-23T17:43:22Z 2024-02-23 17:43:22 More Bad News For Fani Willis: Trump Team Claims They’ve Found New Evidence Of Wade Relationship Fulton County Special Prosecutor Nathan Wade regularly visited District Attorney Fani Willis’ neighborhood before she hired him to work on former President Trump’s criminal case, according to a new affidavit from Trump’s legal team that may contradict the relationship timeline Wade and Willis described in court—as they argue against conflict-of-interest allegations threatening to disqualify Willis from the case. READ MORE: https://www.forbes.com/sites/saradorn/2024/02/23/cell-records-dispute-fani-willis-and-nathan-wades-relationship-timeline-trump-team-says/?sh=6687b0354972 Fuel your success with Forbes. Gain unlimited access to premium journalism, including breaking news, groundbreaking in-depth reported stories, daily digests and more. Plus, members get a front-row seat at members-only events with leading thinkers and doers, access to premium video that can help you get ahead, an ad-light experience, early access to select products including NFT drops and more: https://account.forbes.com/membership/?utm_source=youtube&utm_medium=display&utm_campaign=growth_non-sub_paid_subscribe_ytdescript Stay Connected Forbes on Facebook: http://fb.com/forbes Forbes Video on Twitter: http://www.twitter.com/forbes Forbes Video on Instagram: http://instagram.com/forbes More From Forbes: http://forbes.com NaN ... NaN ['happy', 'fear'] happy 2.407244e-10 8.214051e-17 2.500284e-10 99.998650 7.656128e-07 4.573281e-10 0.001347
8 152 153 UCF0lT4wJ1KDSLpT3NOaxQZQ interestingtopics101 3aRd25BfZrw 2024-02-27T19:48:33Z 2024-02-27 19:48:33 Jim Acosta RAGING that Trump called only FAKE media the enemy of the PEOPLE NaN NaN ... NaN [] None NaN NaN NaN NaN NaN NaN NaN
9 126 127 UCO0akufu9MOzyz3nvGIXAAw Sky News Australia JQLQSE4cbGs 2024-02-23T02:38:44Z 2024-02-23 02:38:44 Donald Trump Jr slams 'brutal assault' rumours involving his father at Mar-a-Lago Donald Trump Jr has hit out on social media at rumours of a "brutal assault" involving his father at Mar-a-Lago after footage circulated online. A video of Donald Trump at Mar-a-Lago went viral on X (formerly Twitter), showing him firmly putting his hand on former Senate Judiciary Committee adviser Garrett Ventry's back. The original video was posted to X by user PatriotTakes, with the caption "Did Trump shove this guy out of his way?" PatriotTakes is "dedicated" to "exposing right-wing extremism and other threats to democracy", according to the X account's bio. The five-second video immediately sparked outrage online, with some users comparing it to a past incident where Trump seemed to shove aside Montenegro Prime Minister Dusko Markovic at a Brussels NATO summit in 2017. "When you have no fear of a physical response, this is what you do!!" wrote an X user in response to the video. Another wrote: "Just like in Europe, where he moved the Minister of Montenegro out of the way so he could stand in front of the rest of the world leaders." Garrett Ventry, the alleged victim, later posted a zoomed-out video, clarifying that it wasn't a scandal but actually a friendly interaction with Trump. Donald Trump Jr. reposted Ventry's video, slamming the media and tech for distorting the truth and calling the assault rumours stupid. "This is what the media and tech have done to the truth. Imagine everything else they've lied to you about. This, according to many, was a brutal assault on a guest at Mar-a-Lago. You can't make up this level of stupidity anymore," he wrote on X. 6347424592112,fb,msn,usa,world,yt ... NaN ['sad'] sad 1.550378e+00 9.105386e-05 6.085277e-01 0.008142 5.318602e+01 1.102301e-04 44.646732

10 rows × 40 columns