{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "OZsHaqL0-tM9"
      },
      "source": [
        "### **Step 1: Importing Necessary Libraries**\n",
        "\n",
        "In this initial step, we import the Python libraries required for our project. Each library serves a specific purpose, enabling us to fetch and process Reddit data efficiently.\n",
        "\n",
        "- **Pandas (pd)**: The `pandas` library is used to manipulate and analyze data. It provides data structures like DataFrames, which are ideal for handling tabular data such as posts or comments retrieved from Reddit.\n",
        "\n",
        "- **Time**: The `time` module enables us to introduce delays in our code using `time.sleep()`. This is critical when interacting with Reddit's API to prevent overwhelming the server and to comply with rate limits.\n",
        "\n",
        "- **TQDM**: The `tqdm` library is used to create progress bars for loops. It helps visualize the progress of tasks such as downloading posts or extracting comments, making it easier to track long-running operations.\n",
        "\n",
        "- **PRAW (Python Reddit API Wrapper)**: The `praw` library simplifies interactions with Reddit's API. It provides an intuitive interface to retrieve posts, comments, and other Reddit data.\n",
        "\n",
        "- **PRAW Exceptions**: The `praw.exceptions` module includes error classes for handling specific issues that might arise during API interactions, such as rate limits or connection errors.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "id": "DEuJNaCp-tNB",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "b8297891-6836-433e-a0f3-a1e8f8661a7f"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
            "google-colab 1.0.0 requires requests==2.32.4, but you have requests 2.34.2 which is incompatible.\u001b[0m\u001b[31m\n",
            "\u001b[0m"
          ]
        }
      ],
      "source": [
        "import pandas as pd\n",
        "import time\n",
        "from tqdm.auto import tqdm\n",
        "\n",
        "!pip install -q praw\n",
        "import praw\n",
        "import praw.exceptions"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "jndjwezb-tND"
      },
      "source": [
        "# Step 2: Create a Reddit application and obtain API credentials\n",
        "\n",
        "1. **Go to Reddit's App Preferences**:  \n",
        "   [Click here to open Reddit App Preferences](https://www.reddit.com/prefs/apps).\n",
        "\n",
        "2. **Create a New Application**:\n",
        "   - Ensure you’re **logged in** to your Reddit account.\n",
        "   - Scroll down to the section titled **\"Developed Applications\"**.\n",
        "   - Click on the **\"Create App\" or \"Create Another App\"** button.\n",
        "\n",
        "3. **Fill in Application Details**:\n",
        "   - **Name**: Enter a name for your application, such as \"Reddit Data Downloader\".\n",
        "   - **App Type**: Select **\"script\"** (for personal, non-distributed use).\n",
        "   - **Description**: Write a short description (e.g., \"An app to download Reddit data\").\n",
        "   - **About URL**: Leave this blank unless you have a website for your app.\n",
        "   - **Redirect URI**: Enter a redirect URI (e.g., `http://localhost:8080`).\n",
        "   - **Permissions**: Leave as default.\n",
        "\n",
        "4. **Create the Application**:\n",
        "   - After filling in all fields, click **\"Create app\"**.\n",
        "\n",
        "5. **Retrieve Your Credentials**:\n",
        "   - **client_id**: This alphanumeric string is located directly under the application name.\n",
        "   - **client_secret**: Found in the application details and labeled as \"secret\".\n",
        "\n",
        "   Save these credentials securely, as they are needed to authenticate your API requests.\n",
        "\n",
        "6. **Authenticate with the Reddit API**:\n",
        "  To access Reddit's data programmatically, we need to authenticate our Python application using the praw library.\n",
        "  \n",
        "  reddit = praw.Reddit(...): creates a Reddit API client object named reddit. This object is used for making authenticated requests to the Reddit API. The constructor takes the following parameters:\n",
        "  - **client_id**: as from step 5; it's used to identify your application when making API requests.\n",
        "  - **client_secret**: as from step 5; it's a secret key that, when combined with the client ID, allows your application to securely authenticate with the Reddit API.\n",
        "  - **user_agent**: The user agent is a string that identifies your application and its purpose. It's important to provide a user agent that follows Reddit's guidelines, typically including the name of your application and a version number. For personal projects, you can include your Reddit username or any other descriptive information.\n",
        "\n",
        "  With this authenticated reddit object, we can now access various Reddit data and perform operations like fetching posts, comments, and more, which will be an essential part of our project. ```"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "id": "HUg0JZBR-tNE"
      },
      "outputs": [],
      "source": [
        "reddit = praw.Reddit(\n",
        "    client_id = '9AkNcQ17Z5pi_zo36Qrr6g',\n",
        "    client_secret = 'bTQxJR7g2NVrYQZ1kNT1iipeMIGckA',\n",
        "    user_agent = 'Dry_Try8800',\n",
        "    check_for_async = False\n",
        ")\n",
        "\n",
        "reddit = praw.Reddit(\n",
        "    client_id = '5hvfqY-_HAvNNW3KMODoMA',\n",
        "    client_secret = 'e8NgMVBsJalQetestgdI86XSecZWGQ',\n",
        "    user_agent = 'LifeguardTechnical88',\n",
        "    check_for_async = False\n",
        ")\n",
        "\n",
        "# reddit = praw.Reddit(\n",
        "#     client_id = '5hvfqY-_HAvNNW3KMODoMA',\n",
        "#     client_secret = 'e8NgMVBsJalQetestgdI86XSecZWGQ',\n",
        "#     user_agent = 'Dry_Try8800',\n",
        "#     check_for_async = False\n",
        "# )"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-IxPVfe42gHK"
      },
      "source": [
        "#### Step 3: Search for Subreddits Related to the Hashtag\n",
        "The `reddit.subreddits.search_by_name` method is used to search for subreddits based on the user-provided hashtag or keyword. The following parameters are used:\n",
        "- `hashtag`: The keyword entered by the user to find relevant subreddits.\n",
        "- `include_nsfw=False`: Ensures that NSFW (Not Safe for Work) subreddits are excluded from the results.\n",
        "- `exact=False`: Allows for partial matching, which makes the search more flexible by including subreddits that contain the keyword in their name.\n",
        "\n",
        "The list of subreddits returned by the search is converted into a Python list, and the top 5 results are selected using slicing (`[:5]`).\n",
        "- If no results are found, the program exits with a message indicating that no subreddits matched the input.\n",
        "- If results are found, the script iterates through the top 5 subreddits using Python's `enumerate` function to display the subreddit names and descriptions in a numbered list format. This allows the user to view the best matches and select their preferred subreddit for further processing.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Jhq0mQ3e2gHL",
        "outputId": "7ba1e6e0-f6f2-4053-b2e9-c42e1bb084eb"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "Searching for subreddits related to the hashtag...\n",
            "\n",
            "Top 5 subreddits related to your keyword:\n",
            "1. ProjectPan\n",
            "2. projectpanph\n",
            "3. ProjectPandora\n",
            "4. projectpanner\n",
            "5. ProjectPanda\n"
          ]
        }
      ],
      "source": [
        "keyword = \"projectpan\"  # Keyword to search for related subreddits, e.g., victoriasecret, projectpan\n",
        "\n",
        "print(\"\\nSearching for subreddits related to the hashtag...\")\n",
        "related_subreddits = reddit.subreddits.search_by_name(keyword, include_nsfw=False, exact=False)\n",
        "# Search for subreddits matching the keyword (excluding NSFW ones)\n",
        "\n",
        "top_subreddits = list(related_subreddits)[:5]  # Get the top 5 matching subreddits\n",
        "if not top_subreddits:  # If no subreddits are found, exit the program\n",
        "    print(f\"No subreddits found related to '{keyword}'. Exiting.\")\n",
        "    exit()\n",
        "\n",
        "print(\"\\nTop 5 subreddits related to your keyword:\")\n",
        "for i, subreddit in enumerate(top_subreddits):\n",
        "    # Display the top 5 subreddits with their names\n",
        "    print(f\"{i + 1}. {subreddit.display_name}\")\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "NtMik5RA-tNF"
      },
      "source": [
        "### **Revised Explanation for Step 4: Downloading Reddit Posts and Saving to CSV**\n",
        "\n",
        "This code retrieves a specific number of top-rated posts from the `ProjectPan` subreddit and saves them to a CSV file. The file contains detailed information about each post, including its title, author, and other metadata.\n",
        "\n",
        "1. **Define the Search Settings**:\n",
        "   - **Subreddit**: The `subreddit_name` variable is set to `'ProjectPan'`, focusing the search on posts related to low consumption habits.\n",
        "   - **Total Posts**: The `total_posts_to_retrieve` variable specifies the maximum number of posts to collect, which in this case is 1,000.\n",
        "   - **Time Filter**: The `time_filter` variable is set to `'year'`, limiting the search to posts from the past year.\n",
        "\n",
        "2. **Initialize an Empty List for Storing Data**:\n",
        "   - An empty list named `all_posts` is created to store the collected data.\n",
        "   - Each post's details will be stored as a dictionary in this list, making it easy to convert into a pandas DataFrame later.\n",
        "\n",
        "3. **Retrieve and Store Each Post’s Data**:\n",
        "   - The code uses the `subreddit.top()` function to fetch posts based on their upvote score. The `time_filter` and `limit` parameters control the time range and the number of posts retrieved, respectively.\n",
        "   - For each post retrieved, important details are collected, including:\n",
        "     - **`subreddit`**: The name of the subreddit where the post was published.\n",
        "     - **`selftext`**: The body text of the post.\n",
        "     - **`author_fullname`**: The full name of the post's author (or `'N/A'` if unavailable).\n",
        "     - **`title`**: The title of the post.\n",
        "     - **`upvote_ratio`** and **`ups`**: The ratio of upvotes and the total number of upvotes the post received.\n",
        "     - **`created`** and **`created_utc`**: The post's creation time in standard and UTC formats.\n",
        "     - **`num_comments`**: The total number of comments on the post.\n",
        "     - **`author`**: The username of the post's author (or `'N/A'` if unavailable).\n",
        "     - **`id`**: The unique identifier of the post.\n",
        "\n",
        "   - The collected data for each post is appended to the `all_posts` list.\n",
        "\n",
        "4. **Alternative Search Options**:\n",
        "   - The code provides flexibility to retrieve posts using different methods:\n",
        "     - **`hot()`**: Retrieves currently trending posts.\n",
        "     - **`search()`**: Searches for posts containing specific keywords (e.g., `'Rome'`) and allows sorting by relevance, top, new, etc.\n",
        "     - Note: The `search()` function has a practical limit of 250 posts.\n",
        "\n",
        "5. **Save the Data to a CSV File**:\n",
        "   - The collected data is converted into a pandas DataFrame using `pd.DataFrame(all_posts)`.\n",
        "   - To ensure uniqueness, duplicate posts are removed based on their IDs using `df.drop_duplicates(subset='id')`.\n",
        "   - The cleaned DataFrame is saved to a CSV file named `'reddit_posts.csv'`.\n",
        "\n",
        "This step generates a structured file containing metadata for up to 1,000 posts from the `ProjectPan` subreddit, ready for further analysis."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 49,
          "referenced_widgets": [
            "a1c8cafc5b7640c1844da65ff695878e",
            "a097c4eff5e74ab2ad709145a5e2adf5",
            "9bbc7cf352a04ecea1d23abfa179373e",
            "0845a6168c344266b3a42e6a851ac705",
            "becf0a3c22564e1e8c605d7627565ea4",
            "9a4cb7a03e7841e68432d1b32aad6382",
            "0981c6f019174c5d86f5409d35b1fd9b",
            "f56caf24ed8543218c7a8826209e9f76",
            "c1c23f6c7bbd48bdb18dc39b32ec3cc1",
            "982f13a7a7914c218997bbf579e0c74f",
            "cadd6c34749a482db6f824541443fff5"
          ]
        },
        "id": "4PWW77i_-tNG",
        "outputId": "cea8e71e-f767-41db-dcab-dc1756b6b73c"
      },
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "Reddit posts:   0%|          | 0/1000 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "a1c8cafc5b7640c1844da65ff695878e"
            }
          },
          "metadata": {}
        }
      ],
      "source": [
        "subreddit_name = 'ProjectPan' # select subreddit name\n",
        "total_posts_to_retrieve = 1000 # select number of posts,\n",
        "time_filter = 'all'  # select among \"all\", \"day\", \"hour\", \"month\", \"week\",\n",
        "                      # or \"year\", only for functions 'top' and 'search'\n",
        "\n",
        "all_posts = []\n",
        "subreddit = reddit.subreddit(subreddit_name)\n",
        "\n",
        "for post in tqdm(subreddit.top(limit=total_posts_to_retrieve, time_filter=time_filter),\n",
        "                 # as an alternative to the 'top' function, you can also use the 'hot' function\n",
        "                 total=total_posts_to_retrieve, desc='Reddit posts'):\n",
        "    all_posts.append({\n",
        "        'subreddit': post.subreddit.display_name,\n",
        "        'selftext': post.selftext,\n",
        "        'author_fullname': post.author_fullname if post.author else 'N/A',\n",
        "        'title': post.title,\n",
        "        'upvote_ratio': post.upvote_ratio,\n",
        "        'ups': post.ups,\n",
        "        'created': post.created,\n",
        "        'created_utc': post.created_utc,\n",
        "        'num_comments': post.num_comments,\n",
        "        'author': str(post.author) if post.author else 'N/A',\n",
        "        'id': post.id\n",
        "    })\n",
        "\n",
        "df = pd.DataFrame(all_posts) # build dataframe\n",
        "df.drop_duplicates(subset='id', inplace=True) # drop potential duplicates\n",
        "df.to_csv('reddit_posts.csv', index=False) # export to csv\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "j2aGVQzYZdMZ",
        "outputId": "2f050746-ae6c-459c-f6a1-06309243632f"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "/tmp/ipykernel_2478/1553159552.py:6: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).\n",
            "  df['created'] = [datetime.utcfromtimestamp(i).strftime('%Y-%m-%d %H:%M:%S') for i in df['created']]\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "      subreddit                                           selftext  \\\n",
              "0    ProjectPan  For months, I was a functional member of socie...   \n",
              "1    ProjectPan  First project pan. This is my inventory. I too...   \n",
              "2    ProjectPan  I have owned and used the same palette for 10 ...   \n",
              "3    ProjectPan  I genuinely enjoy all the blushes I have, and ...   \n",
              "4    ProjectPan  Hi everyone! I’m a huge makeup lover, and this...   \n",
              "..          ...                                                ...   \n",
              "494  ProjectPan                                                NaN   \n",
              "495  ProjectPan  This is rare beauty exhilarate. I forgot how m...   \n",
              "496  ProjectPan                                                NaN   \n",
              "497  ProjectPan                                                NaN   \n",
              "498  ProjectPan                                                NaN   \n",
              "\n",
              "    author_fullname                                              title  \\\n",
              "0     t2_25h3dt43dt  I was absolutely killing \"project pan\"… until ...   \n",
              "1     t2_2pomqc9nht    Inventory at start. Please look and give advice   \n",
              "2     t2_27vcc7mn1v                        10 years of the Morphe 35k!   \n",
              "3      t2_l1rknp069  My blush collection 💗 Dior & NARS already have...   \n",
              "4      t2_a00p5zi9c  How do you work through a collection that does...   \n",
              "..              ...                                                ...   \n",
              "494     t2_1o2qqe2k  This feels like tripping at the finish line, s...   \n",
              "495     t2_cqffp4kv                 Out with the old. In with the new.   \n",
              "496     t2_1o2qqe2k                     the Year of the Rose concluded   \n",
              "497     t2_4fijxhvc                                My everyday palette   \n",
              "498     t2_2f1ayvk5  Today I learned what panning means by stumblin...   \n",
              "\n",
              "     upvote_ratio  ups              created   created_utc  num_comments  \\\n",
              "0            0.97  980  2026-11-03 23:21:58  1.793748e+09            98   \n",
              "1            0.98  425  2026-11-01 20:30:43  1.793565e+09            64   \n",
              "2            0.99  606  2026-11-01 15:04:55  1.793545e+09            22   \n",
              "3            0.98  330  2026-11-01 13:34:28  1.793540e+09            38   \n",
              "4            1.00  451  2026-10-30 02:38:23  1.793328e+09           218   \n",
              "..            ...  ...                  ...           ...           ...   \n",
              "494          0.99  353  2023-12-31 21:34:04  1.704058e+09            32   \n",
              "495          0.99  306  2023-12-13 22:21:54  1.702506e+09            16   \n",
              "496          1.00  323  2022-12-29 19:04:37  1.672341e+09            21   \n",
              "497          1.00  331  2021-03-25 17:05:28  1.616692e+09            15   \n",
              "498          1.00  441  2020-11-18 17:52:59  1.605722e+09            15   \n",
              "\n",
              "                  author       id  \n",
              "0     BelvedereAndBeluga  1xn8j4o  \n",
              "1      InfiniteAccountNo  1xldkqn  \n",
              "2    Much_Equivalent4708  1xl5aws  \n",
              "3             missnolee_  1xl37db  \n",
              "4        jazzygirlhotpot  1xj3sun  \n",
              "..                   ...      ...  \n",
              "494             tulpamom  18vhp1q  \n",
              "495           hokahydro1  18hsy36  \n",
              "496             tulpamom   zydcdd  \n",
              "497         jingly-bells   md33nc  \n",
              "498            kairaanna   jwkjff  \n",
              "\n",
              "[499 rows x 11 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-cf2c7682-fc00-410b-a675-46f3be051c5b\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>subreddit</th>\n",
              "      <th>selftext</th>\n",
              "      <th>author_fullname</th>\n",
              "      <th>title</th>\n",
              "      <th>upvote_ratio</th>\n",
              "      <th>ups</th>\n",
              "      <th>created</th>\n",
              "      <th>created_utc</th>\n",
              "      <th>num_comments</th>\n",
              "      <th>author</th>\n",
              "      <th>id</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>For months, I was a functional member of socie...</td>\n",
              "      <td>t2_25h3dt43dt</td>\n",
              "      <td>I was absolutely killing \"project pan\"… until ...</td>\n",
              "      <td>0.97</td>\n",
              "      <td>980</td>\n",
              "      <td>2026-11-03 23:21:58</td>\n",
              "      <td>1.793748e+09</td>\n",
              "      <td>98</td>\n",
              "      <td>BelvedereAndBeluga</td>\n",
              "      <td>1xn8j4o</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>First project pan. This is my inventory. I too...</td>\n",
              "      <td>t2_2pomqc9nht</td>\n",
              "      <td>Inventory at start. Please look and give advice</td>\n",
              "      <td>0.98</td>\n",
              "      <td>425</td>\n",
              "      <td>2026-11-01 20:30:43</td>\n",
              "      <td>1.793565e+09</td>\n",
              "      <td>64</td>\n",
              "      <td>InfiniteAccountNo</td>\n",
              "      <td>1xldkqn</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>I have owned and used the same palette for 10 ...</td>\n",
              "      <td>t2_27vcc7mn1v</td>\n",
              "      <td>10 years of the Morphe 35k!</td>\n",
              "      <td>0.99</td>\n",
              "      <td>606</td>\n",
              "      <td>2026-11-01 15:04:55</td>\n",
              "      <td>1.793545e+09</td>\n",
              "      <td>22</td>\n",
              "      <td>Much_Equivalent4708</td>\n",
              "      <td>1xl5aws</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>I genuinely enjoy all the blushes I have, and ...</td>\n",
              "      <td>t2_l1rknp069</td>\n",
              "      <td>My blush collection 💗 Dior &amp; NARS already have...</td>\n",
              "      <td>0.98</td>\n",
              "      <td>330</td>\n",
              "      <td>2026-11-01 13:34:28</td>\n",
              "      <td>1.793540e+09</td>\n",
              "      <td>38</td>\n",
              "      <td>missnolee_</td>\n",
              "      <td>1xl37db</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>Hi everyone! I’m a huge makeup lover, and this...</td>\n",
              "      <td>t2_a00p5zi9c</td>\n",
              "      <td>How do you work through a collection that does...</td>\n",
              "      <td>1.00</td>\n",
              "      <td>451</td>\n",
              "      <td>2026-10-30 02:38:23</td>\n",
              "      <td>1.793328e+09</td>\n",
              "      <td>218</td>\n",
              "      <td>jazzygirlhotpot</td>\n",
              "      <td>1xj3sun</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>494</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>NaN</td>\n",
              "      <td>t2_1o2qqe2k</td>\n",
              "      <td>This feels like tripping at the finish line, s...</td>\n",
              "      <td>0.99</td>\n",
              "      <td>353</td>\n",
              "      <td>2023-12-31 21:34:04</td>\n",
              "      <td>1.704058e+09</td>\n",
              "      <td>32</td>\n",
              "      <td>tulpamom</td>\n",
              "      <td>18vhp1q</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>495</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>This is rare beauty exhilarate. I forgot how m...</td>\n",
              "      <td>t2_cqffp4kv</td>\n",
              "      <td>Out with the old. In with the new.</td>\n",
              "      <td>0.99</td>\n",
              "      <td>306</td>\n",
              "      <td>2023-12-13 22:21:54</td>\n",
              "      <td>1.702506e+09</td>\n",
              "      <td>16</td>\n",
              "      <td>hokahydro1</td>\n",
              "      <td>18hsy36</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>496</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>NaN</td>\n",
              "      <td>t2_1o2qqe2k</td>\n",
              "      <td>the Year of the Rose concluded</td>\n",
              "      <td>1.00</td>\n",
              "      <td>323</td>\n",
              "      <td>2022-12-29 19:04:37</td>\n",
              "      <td>1.672341e+09</td>\n",
              "      <td>21</td>\n",
              "      <td>tulpamom</td>\n",
              "      <td>zydcdd</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>497</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>NaN</td>\n",
              "      <td>t2_4fijxhvc</td>\n",
              "      <td>My everyday palette</td>\n",
              "      <td>1.00</td>\n",
              "      <td>331</td>\n",
              "      <td>2021-03-25 17:05:28</td>\n",
              "      <td>1.616692e+09</td>\n",
              "      <td>15</td>\n",
              "      <td>jingly-bells</td>\n",
              "      <td>md33nc</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>498</th>\n",
              "      <td>ProjectPan</td>\n",
              "      <td>NaN</td>\n",
              "      <td>t2_2f1ayvk5</td>\n",
              "      <td>Today I learned what panning means by stumblin...</td>\n",
              "      <td>1.00</td>\n",
              "      <td>441</td>\n",
              "      <td>2020-11-18 17:52:59</td>\n",
              "      <td>1.605722e+09</td>\n",
              "      <td>15</td>\n",
              "      <td>kairaanna</td>\n",
              "      <td>jwkjff</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>499 rows × 11 columns</p>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-cf2c7682-fc00-410b-a675-46f3be051c5b')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-cf2c7682-fc00-410b-a675-46f3be051c5b button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-cf2c7682-fc00-410b-a675-46f3be051c5b');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "  <div id=\"id_1233c0db-7567-4d39-9ab1-dd067453911a\">\n",
              "    <style>\n",
              "      .colab-df-generate {\n",
              "        background-color: #E8F0FE;\n",
              "        border: none;\n",
              "        border-radius: 50%;\n",
              "        cursor: pointer;\n",
              "        display: none;\n",
              "        fill: #1967D2;\n",
              "        height: 32px;\n",
              "        padding: 0 0 0 0;\n",
              "        width: 32px;\n",
              "      }\n",
              "\n",
              "      .colab-df-generate:hover {\n",
              "        background-color: #E2EBFA;\n",
              "        box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "        fill: #174EA6;\n",
              "      }\n",
              "\n",
              "      [theme=dark] .colab-df-generate {\n",
              "        background-color: #3B4455;\n",
              "        fill: #D2E3FC;\n",
              "      }\n",
              "\n",
              "      [theme=dark] .colab-df-generate:hover {\n",
              "        background-color: #434B5C;\n",
              "        box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "        filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "        fill: #FFFFFF;\n",
              "      }\n",
              "    </style>\n",
              "    <button class=\"colab-df-generate\" onclick=\"generateWithVariable('df')\"\n",
              "            title=\"Generate code using this dataframe.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M7,19H8.4L18.45,9,17,7.55,7,17.6ZM5,21V16.75L18.45,3.32a2,2,0,0,1,2.83,0l1.4,1.43a1.91,1.91,0,0,1,.58,1.4,1.91,1.91,0,0,1-.58,1.4L9.25,21ZM18.45,9,17,7.55Zm-12,3A5.31,5.31,0,0,0,4.9,8.1,5.31,5.31,0,0,0,1,6.5,5.31,5.31,0,0,0,4.9,4.9,5.31,5.31,0,0,0,6.5,1,5.31,5.31,0,0,0,8.1,4.9,5.31,5.31,0,0,0,12,6.5,5.46,5.46,0,0,0,6.5,12Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "    <script>\n",
              "      (() => {\n",
              "      const buttonEl =\n",
              "        document.querySelector('#id_1233c0db-7567-4d39-9ab1-dd067453911a button.colab-df-generate');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      buttonEl.onclick = () => {\n",
              "        google.colab.notebook.generateWithVariable('df');\n",
              "      }\n",
              "      })();\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "dataframe",
              "variable_name": "df",
              "summary": "{\n  \"name\": \"df\",\n  \"rows\": 499,\n  \"fields\": [\n    {\n      \"column\": \"subreddit\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 1,\n        \"samples\": [\n          \"ProjectPan\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"selftext\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 452,\n        \"samples\": [\n          \"I\\u2019m not even sure when or how it got this bad, but I\\u2019m looking at ~40 lip products and ~$800 spent all for what? To finally feel like I\\u2019ve found \\u201cthe one\\u201d that will make me feel beautiful? This stops now. I probably won\\u2019t buy a lip product until 2027 at best. \\n\\nNot pictured: my lip liners and lip balms. \"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"author_fullname\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 408,\n        \"samples\": [\n          \"t2_3b19o3ld\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"title\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 494,\n        \"samples\": [\n          \"Shaming myself with backups\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"upvote_ratio\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 0.011069590539927492,\n        \"min\": 0.89,\n        \"max\": 1.0,\n        \"num_unique_values\": 9,\n        \"samples\": [\n          0.92\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"ups\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 681,\n        \"min\": 306,\n        \"max\": 10865,\n        \"num_unique_values\": 316,\n        \"samples\": [\n          1648\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"created\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"num_unique_values\": 499,\n        \"samples\": [\n          \"2025-01-20 02:49:03\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"created_utc\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 20821885.939440798,\n        \"min\": 1605721979.0,\n        \"max\": 1793748118.0,\n        \"num_unique_values\": 499,\n        \"samples\": [\n          1737341343.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"num_comments\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 55,\n        \"min\": 0,\n        \"max\": 470,\n        \"num_unique_values\": 131,\n        \"samples\": [\n          180\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"author\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 408,\n        \"samples\": [\n          \"manicpanit\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"id\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 499,\n        \"samples\": [\n          \"1i5gb7q\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}"
            }
          },
          "metadata": {},
          "execution_count": 5
        }
      ],
      "source": [
        "from datetime import datetime\n",
        "\n",
        "# read dataframe\n",
        "df = pd.DataFrame(pd.read_csv('reddit_posts.csv'))\n",
        "# convert date to readable format\n",
        "df['created'] = [datetime.utcfromtimestamp(i).strftime('%Y-%m-%d %H:%M:%S') for i in df['created']]\n",
        "df.sort_values(by='created', ascending=False, inplace=True, ignore_index=True) # sort by time\n",
        "\n",
        "df # display dataframe"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "xMBtSvyp-tNI"
      },
      "source": [
        "### Revised Explanation for Step 5: Extracting Comments from Reddit Posts\n",
        "\n",
        "This code extracts comments from Reddit posts retrieved earlier. The process includes handling potential rate limits from Reddit's API and saving the extracted comments to a CSV file. Below is a step-by-step explanation:\n",
        "\n",
        "1. **Initialize an Empty List**:\n",
        "   - An empty list, `comments_list`, is created to store the extracted comment data.\n",
        "\n",
        "2. **Loop Through Posts**:\n",
        "   - The loop iterates over the first `num_posts` posts in the DataFrame `df`. For each post, its unique ID (`post_id`) is retrieved, which is used to fetch the corresponding submission object from Reddit.\n",
        "\n",
        "3. **Handle Comments with `try-except`**:\n",
        "   - A `try-except` block ensures that potential exceptions (e.g., rate limit errors) during comment extraction are handled gracefully.\n",
        "   - If an exception occurs, the program waits for 1 second (`sleep(1)`) before continuing.\n",
        "\n",
        "4. **Retrieve All Comments**:\n",
        "   - The `submission.comments.replace_more(limit=None)` method ensures all comments are retrieved, even those hidden behind Reddit's \"load more comments\" feature.\n",
        "\n",
        "5. **Extract Comment Data**:\n",
        "   - For each comment in the post, the following details are extracted:\n",
        "     - **`comment_id`**: The unique identifier for the comment.\n",
        "     - **`parent_id`**: The ID of the parent post or comment to which this comment is replying.\n",
        "     - **`post_id`**: The ID of the original post to which the comment belongs.\n",
        "     - **`comment_body`**: The text content of the comment.\n",
        "\n",
        "6. **Append Data to List**:\n",
        "   - The extracted data for each comment is added to `comments_list` as a dictionary. This ensures that all comments from multiple posts are stored in a single structure.\n",
        "\n",
        "7. **Convert to DataFrame**:\n",
        "   - After processing all posts, the collected comments are converted into a pandas DataFrame named `comments_df`. Each row represents a single comment with its corresponding metadata.\n",
        "\n",
        "8. **Save to CSV**:\n",
        "   - The `comments_df` DataFrame is saved as a CSV file named `'ItalyTravel_top_comments.csv'` without an index column.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 49,
          "referenced_widgets": [
            "b50f0e08f7d6482b953becedfeb21c24",
            "c49243b7038649febcc711a9850436cc",
            "30b0d8d60a6847f486d414430fefa893",
            "c39976332e994277b0575da1345d97a8",
            "428d221c2da74943bce0f67455c131ba",
            "2ac758af2efd4c40bf7b068fbb9fb98c",
            "6e0c66269c624f20afa2fb40c3ffad39",
            "7151f1af9f064d9a9497f16609db6a38",
            "b7a447ffc4754530bde3087b1e89cb34",
            "69c36f9eff8d47ab88d5782cb195e3c2",
            "07859e8e5d9845bdbbb812a9233a2d7b"
          ]
        },
        "id": "lYnRCZjr-tNJ",
        "outputId": "cad90769-77bb-483d-b0b9-09355e6bf375"
      },
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "Reddit comments:   0%|          | 0/50 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "b50f0e08f7d6482b953becedfeb21c24"
            }
          },
          "metadata": {}
        }
      ],
      "source": [
        "# here we run it for the first five posts only\n",
        "# replace 5 -> len(df) for the all the posts\n",
        "\n",
        "num_posts = 50\n",
        "\n",
        "comments_list = []\n",
        "\n",
        "for i in tqdm(range(num_posts), desc='Reddit comments'):\n",
        "    post_id = df.iloc[i]['id']\n",
        "    submission = reddit.submission(id=post_id)\n",
        "    try:\n",
        "        submission.comments.replace_more(limit=None)\n",
        "        for comment in submission.comments.list():\n",
        "            comments_list.extend([{'comment_id': comment.id,\n",
        "                                   'parent_id': comment.parent_id,\n",
        "                                   'post_id': post_id,\n",
        "                                   'comment_body': comment.body,\n",
        "                                  }])\n",
        "\n",
        "    except PossibleExceptions:\n",
        "        print(\"Handling replace_more exception\")\n",
        "        sleep(3) # create delay\n",
        "\n",
        "comments_df = pd.DataFrame(comments_list) # build dataframe\n",
        "comments_df.to_csv('reddit_top_comments.csv', index=False) # export to csv"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 424
        },
        "id": "AO4uzEvL-tNJ",
        "outputId": "df766ca2-9f13-4513-c0c5-d74a34bca14e"
      },
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "         comment_id   parent_id  post_id  \\\n",
              "0     19s3t5v3plsth  t3_1xn8j4o  1xn8j4o   \n",
              "1     19s3n8y6uizhf  t3_1xn8j4o  1xn8j4o   \n",
              "2     19s3q1gopjo6c  t3_1xn8j4o  1xn8j4o   \n",
              "3     19s3rzt8dpyxs  t3_1xn8j4o  1xn8j4o   \n",
              "4     19s3wuih26fj9  t3_1xn8j4o  1xn8j4o   \n",
              "...             ...         ...      ...   \n",
              "3407        p6xpj5s  t1_p6w5oej  1w21da7   \n",
              "3408        p6t2ibc  t1_p6t1s3u  1w21da7   \n",
              "3409        p6wfkup  t1_p6wefzc  1w21da7   \n",
              "3410        p73wn25  t1_p6xpj5s  1w21da7   \n",
              "3411        p6th58l  t1_p6t2ibc  1w21da7   \n",
              "\n",
              "                                           comment_body  \n",
              "0     When I do this, I tell myself: it's not like I...  \n",
              "1     Sorry to be laughing at your pain, but I am to...  \n",
              "2     I think a trip like this is when it's perfectl...  \n",
              "3     Be grateful you had the money to go to Japan a...  \n",
              "4     it sounds like you enjoyed and treated yoursel...  \n",
              "...                                                 ...  \n",
              "3407  I love seeing the packaging from products in o...  \n",
              "3408                                          [deleted]  \n",
              "3409  Ah, while you’re still trying, buy the safe sm...  \n",
              "3410  Love it too! Exactly, those thinners are aweso...  \n",
              "3411  For sure! It’s a huge motivator. And they last...  \n",
              "\n",
              "[3412 rows x 4 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-c1c12354-a2ba-4e69-aaf4-8d17a19818e2\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>comment_id</th>\n",
              "      <th>parent_id</th>\n",
              "      <th>post_id</th>\n",
              "      <th>comment_body</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>19s3t5v3plsth</td>\n",
              "      <td>t3_1xn8j4o</td>\n",
              "      <td>1xn8j4o</td>\n",
              "      <td>When I do this, I tell myself: it's not like I...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>19s3n8y6uizhf</td>\n",
              "      <td>t3_1xn8j4o</td>\n",
              "      <td>1xn8j4o</td>\n",
              "      <td>Sorry to be laughing at your pain, but I am to...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>19s3q1gopjo6c</td>\n",
              "      <td>t3_1xn8j4o</td>\n",
              "      <td>1xn8j4o</td>\n",
              "      <td>I think a trip like this is when it's perfectl...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>19s3rzt8dpyxs</td>\n",
              "      <td>t3_1xn8j4o</td>\n",
              "      <td>1xn8j4o</td>\n",
              "      <td>Be grateful you had the money to go to Japan a...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>19s3wuih26fj9</td>\n",
              "      <td>t3_1xn8j4o</td>\n",
              "      <td>1xn8j4o</td>\n",
              "      <td>it sounds like you enjoyed and treated yoursel...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3407</th>\n",
              "      <td>p6xpj5s</td>\n",
              "      <td>t1_p6w5oej</td>\n",
              "      <td>1w21da7</td>\n",
              "      <td>I love seeing the packaging from products in o...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3408</th>\n",
              "      <td>p6t2ibc</td>\n",
              "      <td>t1_p6t1s3u</td>\n",
              "      <td>1w21da7</td>\n",
              "      <td>[deleted]</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3409</th>\n",
              "      <td>p6wfkup</td>\n",
              "      <td>t1_p6wefzc</td>\n",
              "      <td>1w21da7</td>\n",
              "      <td>Ah, while you’re still trying, buy the safe sm...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3410</th>\n",
              "      <td>p73wn25</td>\n",
              "      <td>t1_p6xpj5s</td>\n",
              "      <td>1w21da7</td>\n",
              "      <td>Love it too! Exactly, those thinners are aweso...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3411</th>\n",
              "      <td>p6th58l</td>\n",
              "      <td>t1_p6t2ibc</td>\n",
              "      <td>1w21da7</td>\n",
              "      <td>For sure! It’s a huge motivator. And they last...</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>3412 rows × 4 columns</p>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-c1c12354-a2ba-4e69-aaf4-8d17a19818e2')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-c1c12354-a2ba-4e69-aaf4-8d17a19818e2 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-c1c12354-a2ba-4e69-aaf4-8d17a19818e2');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "  <div id=\"id_9868a45c-823d-47ca-bbf7-1c15fda55d73\">\n",
              "    <style>\n",
              "      .colab-df-generate {\n",
              "        background-color: #E8F0FE;\n",
              "        border: none;\n",
              "        border-radius: 50%;\n",
              "        cursor: pointer;\n",
              "        display: none;\n",
              "        fill: #1967D2;\n",
              "        height: 32px;\n",
              "        padding: 0 0 0 0;\n",
              "        width: 32px;\n",
              "      }\n",
              "\n",
              "      .colab-df-generate:hover {\n",
              "        background-color: #E2EBFA;\n",
              "        box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "        fill: #174EA6;\n",
              "      }\n",
              "\n",
              "      [theme=dark] .colab-df-generate {\n",
              "        background-color: #3B4455;\n",
              "        fill: #D2E3FC;\n",
              "      }\n",
              "\n",
              "      [theme=dark] .colab-df-generate:hover {\n",
              "        background-color: #434B5C;\n",
              "        box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "        filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "        fill: #FFFFFF;\n",
              "      }\n",
              "    </style>\n",
              "    <button class=\"colab-df-generate\" onclick=\"generateWithVariable('comments_df')\"\n",
              "            title=\"Generate code using this dataframe.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M7,19H8.4L18.45,9,17,7.55,7,17.6ZM5,21V16.75L18.45,3.32a2,2,0,0,1,2.83,0l1.4,1.43a1.91,1.91,0,0,1,.58,1.4,1.91,1.91,0,0,1-.58,1.4L9.25,21ZM18.45,9,17,7.55Zm-12,3A5.31,5.31,0,0,0,4.9,8.1,5.31,5.31,0,0,0,1,6.5,5.31,5.31,0,0,0,4.9,4.9,5.31,5.31,0,0,0,6.5,1,5.31,5.31,0,0,0,8.1,4.9,5.31,5.31,0,0,0,12,6.5,5.46,5.46,0,0,0,6.5,12Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "    <script>\n",
              "      (() => {\n",
              "      const buttonEl =\n",
              "        document.querySelector('#id_9868a45c-823d-47ca-bbf7-1c15fda55d73 button.colab-df-generate');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      buttonEl.onclick = () => {\n",
              "        google.colab.notebook.generateWithVariable('comments_df');\n",
              "      }\n",
              "      })();\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "dataframe",
              "variable_name": "comments_df",
              "summary": "{\n  \"name\": \"comments_df\",\n  \"rows\": 3412,\n  \"fields\": [\n    {\n      \"column\": \"comment_id\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 3412,\n        \"samples\": [\n          \"pc1cgm2\",\n          \"pbjmc85\",\n          \"19s57cpe3ql4w\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"parent_id\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 1444,\n        \"samples\": [\n          \"t1_19rdxy7rtdmwy\",\n          \"t1_phd268e\",\n          \"t1_paiicmh\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"post_id\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 50,\n        \"samples\": [\n          \"1x5i822\",\n          \"1wfnli6\",\n          \"1wo9otz\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"comment_body\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 3326,\n        \"samples\": [\n          \"This is one of the only products I know I\\u2019ll truly pan.  \",\n          \"I would start with disconnecting with makeup released. Unfollow the beauty gurus who review all the new makeup , trend mood and other brands. If you want makeup look inspo , search only for those. You have caught yourself before it blows our of hand. Going on a low buy will become automatic. This helped me in the phase where I was in love with lots of launches. These launches will be here in a year's time too , and that time on discounts as well \",\n          \"Wow I would have stopped at picture 3! How do you get out this last bit of blush so well?\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}"
            }
          },
          "metadata": {},
          "execution_count": 7
        }
      ],
      "source": [
        "comments_df = pd.DataFrame(pd.read_csv('reddit_top_comments.csv')) # read dataframe\n",
        "\n",
        "comments_df # display dataframe"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "venv",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.11.8"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "version_major": 2,
        "version_minor": 0,
        "state": {
          "a1c8cafc5b7640c1844da65ff695878e": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "HBoxModel",
            "model_module_version": "1.5.0",
            "state": {
              "_dom_classes": [],
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "HBoxModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/controls",
              "_view_module_version": "1.5.0",
              "_view_name": "HBoxView",
              "box_style": "",
              "children": [
                "IPY_MODEL_a097c4eff5e74ab2ad709145a5e2adf5",
                "IPY_MODEL_9bbc7cf352a04ecea1d23abfa179373e",
                "IPY_MODEL_0845a6168c344266b3a42e6a851ac705"
              ],
              "layout": "IPY_MODEL_becf0a3c22564e1e8c605d7627565ea4"
            }
          },
          "a097c4eff5e74ab2ad709145a5e2adf5": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "HTMLModel",
            "model_module_version": "1.5.0",
            "state": {
              "_dom_classes": [],
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "HTMLModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/controls",
              "_view_module_version": "1.5.0",
              "_view_name": "HTMLView",
              "description": "",
              "description_tooltip": null,
              "layout": "IPY_MODEL_9a4cb7a03e7841e68432d1b32aad6382",
              "placeholder": "​",
              "style": "IPY_MODEL_0981c6f019174c5d86f5409d35b1fd9b",
              "value": "Reddit posts:  50%"
            }
          },
          "9bbc7cf352a04ecea1d23abfa179373e": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "FloatProgressModel",
            "model_module_version": "1.5.0",
            "state": {
              "_dom_classes": [],
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "FloatProgressModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/controls",
              "_view_module_version": "1.5.0",
              "_view_name": "ProgressView",
              "bar_style": "danger",
              "description": "",
              "description_tooltip": null,
              "layout": "IPY_MODEL_f56caf24ed8543218c7a8826209e9f76",
              "max": 1000,
              "min": 0,
              "orientation": "horizontal",
              "style": "IPY_MODEL_c1c23f6c7bbd48bdb18dc39b32ec3cc1",
              "value": 499
            }
          },
          "0845a6168c344266b3a42e6a851ac705": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "HTMLModel",
            "model_module_version": "1.5.0",
            "state": {
              "_dom_classes": [],
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "HTMLModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/controls",
              "_view_module_version": "1.5.0",
              "_view_name": "HTMLView",
              "description": "",
              "description_tooltip": null,
              "layout": "IPY_MODEL_982f13a7a7914c218997bbf579e0c74f",
              "placeholder": "​",
              "style": "IPY_MODEL_cadd6c34749a482db6f824541443fff5",
              "value": " 499/1000 [00:09&lt;00:09, 50.93it/s]"
            }
          },
          "becf0a3c22564e1e8c605d7627565ea4": {
            "model_module": "@jupyter-widgets/base",
            "model_name": "LayoutModel",
            "model_module_version": "1.2.0",
            "state": {
              "_model_module": "@jupyter-widgets/base",
              "_model_module_version": "1.2.0",
              "_model_name": "LayoutModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "LayoutView",
              "align_content": null,
              "align_items": null,
              "align_self": null,
              "border": null,
              "bottom": null,
              "display": null,
              "flex": null,
              "flex_flow": null,
              "grid_area": null,
              "grid_auto_columns": null,
              "grid_auto_flow": null,
              "grid_auto_rows": null,
              "grid_column": null,
              "grid_gap": null,
              "grid_row": null,
              "grid_template_areas": null,
              "grid_template_columns": null,
              "grid_template_rows": null,
              "height": null,
              "justify_content": null,
              "justify_items": null,
              "left": null,
              "margin": null,
              "max_height": null,
              "max_width": null,
              "min_height": null,
              "min_width": null,
              "object_fit": null,
              "object_position": null,
              "order": null,
              "overflow": null,
              "overflow_x": null,
              "overflow_y": null,
              "padding": null,
              "right": null,
              "top": null,
              "visibility": null,
              "width": null
            }
          },
          "9a4cb7a03e7841e68432d1b32aad6382": {
            "model_module": "@jupyter-widgets/base",
            "model_name": "LayoutModel",
            "model_module_version": "1.2.0",
            "state": {
              "_model_module": "@jupyter-widgets/base",
              "_model_module_version": "1.2.0",
              "_model_name": "LayoutModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "LayoutView",
              "align_content": null,
              "align_items": null,
              "align_self": null,
              "border": null,
              "bottom": null,
              "display": null,
              "flex": null,
              "flex_flow": null,
              "grid_area": null,
              "grid_auto_columns": null,
              "grid_auto_flow": null,
              "grid_auto_rows": null,
              "grid_column": null,
              "grid_gap": null,
              "grid_row": null,
              "grid_template_areas": null,
              "grid_template_columns": null,
              "grid_template_rows": null,
              "height": null,
              "justify_content": null,
              "justify_items": null,
              "left": null,
              "margin": null,
              "max_height": null,
              "max_width": null,
              "min_height": null,
              "min_width": null,
              "object_fit": null,
              "object_position": null,
              "order": null,
              "overflow": null,
              "overflow_x": null,
              "overflow_y": null,
              "padding": null,
              "right": null,
              "top": null,
              "visibility": null,
              "width": null
            }
          },
          "0981c6f019174c5d86f5409d35b1fd9b": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "DescriptionStyleModel",
            "model_module_version": "1.5.0",
            "state": {
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "DescriptionStyleModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "StyleView",
              "description_width": ""
            }
          },
          "f56caf24ed8543218c7a8826209e9f76": {
            "model_module": "@jupyter-widgets/base",
            "model_name": "LayoutModel",
            "model_module_version": "1.2.0",
            "state": {
              "_model_module": "@jupyter-widgets/base",
              "_model_module_version": "1.2.0",
              "_model_name": "LayoutModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "LayoutView",
              "align_content": null,
              "align_items": null,
              "align_self": null,
              "border": null,
              "bottom": null,
              "display": null,
              "flex": null,
              "flex_flow": null,
              "grid_area": null,
              "grid_auto_columns": null,
              "grid_auto_flow": null,
              "grid_auto_rows": null,
              "grid_column": null,
              "grid_gap": null,
              "grid_row": null,
              "grid_template_areas": null,
              "grid_template_columns": null,
              "grid_template_rows": null,
              "height": null,
              "justify_content": null,
              "justify_items": null,
              "left": null,
              "margin": null,
              "max_height": null,
              "max_width": null,
              "min_height": null,
              "min_width": null,
              "object_fit": null,
              "object_position": null,
              "order": null,
              "overflow": null,
              "overflow_x": null,
              "overflow_y": null,
              "padding": null,
              "right": null,
              "top": null,
              "visibility": null,
              "width": null
            }
          },
          "c1c23f6c7bbd48bdb18dc39b32ec3cc1": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "ProgressStyleModel",
            "model_module_version": "1.5.0",
            "state": {
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "ProgressStyleModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "StyleView",
              "bar_color": null,
              "description_width": ""
            }
          },
          "982f13a7a7914c218997bbf579e0c74f": {
            "model_module": "@jupyter-widgets/base",
            "model_name": "LayoutModel",
            "model_module_version": "1.2.0",
            "state": {
              "_model_module": "@jupyter-widgets/base",
              "_model_module_version": "1.2.0",
              "_model_name": "LayoutModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "LayoutView",
              "align_content": null,
              "align_items": null,
              "align_self": null,
              "border": null,
              "bottom": null,
              "display": null,
              "flex": null,
              "flex_flow": null,
              "grid_area": null,
              "grid_auto_columns": null,
              "grid_auto_flow": null,
              "grid_auto_rows": null,
              "grid_column": null,
              "grid_gap": null,
              "grid_row": null,
              "grid_template_areas": null,
              "grid_template_columns": null,
              "grid_template_rows": null,
              "height": null,
              "justify_content": null,
              "justify_items": null,
              "left": null,
              "margin": null,
              "max_height": null,
              "max_width": null,
              "min_height": null,
              "min_width": null,
              "object_fit": null,
              "object_position": null,
              "order": null,
              "overflow": null,
              "overflow_x": null,
              "overflow_y": null,
              "padding": null,
              "right": null,
              "top": null,
              "visibility": null,
              "width": null
            }
          },
          "cadd6c34749a482db6f824541443fff5": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "DescriptionStyleModel",
            "model_module_version": "1.5.0",
            "state": {
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "DescriptionStyleModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "StyleView",
              "description_width": ""
            }
          },
          "b50f0e08f7d6482b953becedfeb21c24": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "HBoxModel",
            "model_module_version": "1.5.0",
            "state": {
              "_dom_classes": [],
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "HBoxModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/controls",
              "_view_module_version": "1.5.0",
              "_view_name": "HBoxView",
              "box_style": "",
              "children": [
                "IPY_MODEL_c49243b7038649febcc711a9850436cc",
                "IPY_MODEL_30b0d8d60a6847f486d414430fefa893",
                "IPY_MODEL_c39976332e994277b0575da1345d97a8"
              ],
              "layout": "IPY_MODEL_428d221c2da74943bce0f67455c131ba"
            }
          },
          "c49243b7038649febcc711a9850436cc": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "HTMLModel",
            "model_module_version": "1.5.0",
            "state": {
              "_dom_classes": [],
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "HTMLModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/controls",
              "_view_module_version": "1.5.0",
              "_view_name": "HTMLView",
              "description": "",
              "description_tooltip": null,
              "layout": "IPY_MODEL_2ac758af2efd4c40bf7b068fbb9fb98c",
              "placeholder": "​",
              "style": "IPY_MODEL_6e0c66269c624f20afa2fb40c3ffad39",
              "value": "Reddit comments: 100%"
            }
          },
          "30b0d8d60a6847f486d414430fefa893": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "FloatProgressModel",
            "model_module_version": "1.5.0",
            "state": {
              "_dom_classes": [],
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "FloatProgressModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/controls",
              "_view_module_version": "1.5.0",
              "_view_name": "ProgressView",
              "bar_style": "success",
              "description": "",
              "description_tooltip": null,
              "layout": "IPY_MODEL_7151f1af9f064d9a9497f16609db6a38",
              "max": 50,
              "min": 0,
              "orientation": "horizontal",
              "style": "IPY_MODEL_b7a447ffc4754530bde3087b1e89cb34",
              "value": 50
            }
          },
          "c39976332e994277b0575da1345d97a8": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "HTMLModel",
            "model_module_version": "1.5.0",
            "state": {
              "_dom_classes": [],
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "HTMLModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/controls",
              "_view_module_version": "1.5.0",
              "_view_name": "HTMLView",
              "description": "",
              "description_tooltip": null,
              "layout": "IPY_MODEL_69c36f9eff8d47ab88d5782cb195e3c2",
              "placeholder": "​",
              "style": "IPY_MODEL_07859e8e5d9845bdbbb812a9233a2d7b",
              "value": " 50/50 [00:21&lt;00:00,  3.46it/s]"
            }
          },
          "428d221c2da74943bce0f67455c131ba": {
            "model_module": "@jupyter-widgets/base",
            "model_name": "LayoutModel",
            "model_module_version": "1.2.0",
            "state": {
              "_model_module": "@jupyter-widgets/base",
              "_model_module_version": "1.2.0",
              "_model_name": "LayoutModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "LayoutView",
              "align_content": null,
              "align_items": null,
              "align_self": null,
              "border": null,
              "bottom": null,
              "display": null,
              "flex": null,
              "flex_flow": null,
              "grid_area": null,
              "grid_auto_columns": null,
              "grid_auto_flow": null,
              "grid_auto_rows": null,
              "grid_column": null,
              "grid_gap": null,
              "grid_row": null,
              "grid_template_areas": null,
              "grid_template_columns": null,
              "grid_template_rows": null,
              "height": null,
              "justify_content": null,
              "justify_items": null,
              "left": null,
              "margin": null,
              "max_height": null,
              "max_width": null,
              "min_height": null,
              "min_width": null,
              "object_fit": null,
              "object_position": null,
              "order": null,
              "overflow": null,
              "overflow_x": null,
              "overflow_y": null,
              "padding": null,
              "right": null,
              "top": null,
              "visibility": null,
              "width": null
            }
          },
          "2ac758af2efd4c40bf7b068fbb9fb98c": {
            "model_module": "@jupyter-widgets/base",
            "model_name": "LayoutModel",
            "model_module_version": "1.2.0",
            "state": {
              "_model_module": "@jupyter-widgets/base",
              "_model_module_version": "1.2.0",
              "_model_name": "LayoutModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "LayoutView",
              "align_content": null,
              "align_items": null,
              "align_self": null,
              "border": null,
              "bottom": null,
              "display": null,
              "flex": null,
              "flex_flow": null,
              "grid_area": null,
              "grid_auto_columns": null,
              "grid_auto_flow": null,
              "grid_auto_rows": null,
              "grid_column": null,
              "grid_gap": null,
              "grid_row": null,
              "grid_template_areas": null,
              "grid_template_columns": null,
              "grid_template_rows": null,
              "height": null,
              "justify_content": null,
              "justify_items": null,
              "left": null,
              "margin": null,
              "max_height": null,
              "max_width": null,
              "min_height": null,
              "min_width": null,
              "object_fit": null,
              "object_position": null,
              "order": null,
              "overflow": null,
              "overflow_x": null,
              "overflow_y": null,
              "padding": null,
              "right": null,
              "top": null,
              "visibility": null,
              "width": null
            }
          },
          "6e0c66269c624f20afa2fb40c3ffad39": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "DescriptionStyleModel",
            "model_module_version": "1.5.0",
            "state": {
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "DescriptionStyleModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "StyleView",
              "description_width": ""
            }
          },
          "7151f1af9f064d9a9497f16609db6a38": {
            "model_module": "@jupyter-widgets/base",
            "model_name": "LayoutModel",
            "model_module_version": "1.2.0",
            "state": {
              "_model_module": "@jupyter-widgets/base",
              "_model_module_version": "1.2.0",
              "_model_name": "LayoutModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "LayoutView",
              "align_content": null,
              "align_items": null,
              "align_self": null,
              "border": null,
              "bottom": null,
              "display": null,
              "flex": null,
              "flex_flow": null,
              "grid_area": null,
              "grid_auto_columns": null,
              "grid_auto_flow": null,
              "grid_auto_rows": null,
              "grid_column": null,
              "grid_gap": null,
              "grid_row": null,
              "grid_template_areas": null,
              "grid_template_columns": null,
              "grid_template_rows": null,
              "height": null,
              "justify_content": null,
              "justify_items": null,
              "left": null,
              "margin": null,
              "max_height": null,
              "max_width": null,
              "min_height": null,
              "min_width": null,
              "object_fit": null,
              "object_position": null,
              "order": null,
              "overflow": null,
              "overflow_x": null,
              "overflow_y": null,
              "padding": null,
              "right": null,
              "top": null,
              "visibility": null,
              "width": null
            }
          },
          "b7a447ffc4754530bde3087b1e89cb34": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "ProgressStyleModel",
            "model_module_version": "1.5.0",
            "state": {
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "ProgressStyleModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "StyleView",
              "bar_color": null,
              "description_width": ""
            }
          },
          "69c36f9eff8d47ab88d5782cb195e3c2": {
            "model_module": "@jupyter-widgets/base",
            "model_name": "LayoutModel",
            "model_module_version": "1.2.0",
            "state": {
              "_model_module": "@jupyter-widgets/base",
              "_model_module_version": "1.2.0",
              "_model_name": "LayoutModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "LayoutView",
              "align_content": null,
              "align_items": null,
              "align_self": null,
              "border": null,
              "bottom": null,
              "display": null,
              "flex": null,
              "flex_flow": null,
              "grid_area": null,
              "grid_auto_columns": null,
              "grid_auto_flow": null,
              "grid_auto_rows": null,
              "grid_column": null,
              "grid_gap": null,
              "grid_row": null,
              "grid_template_areas": null,
              "grid_template_columns": null,
              "grid_template_rows": null,
              "height": null,
              "justify_content": null,
              "justify_items": null,
              "left": null,
              "margin": null,
              "max_height": null,
              "max_width": null,
              "min_height": null,
              "min_width": null,
              "object_fit": null,
              "object_position": null,
              "order": null,
              "overflow": null,
              "overflow_x": null,
              "overflow_y": null,
              "padding": null,
              "right": null,
              "top": null,
              "visibility": null,
              "width": null
            }
          },
          "07859e8e5d9845bdbbb812a9233a2d7b": {
            "model_module": "@jupyter-widgets/controls",
            "model_name": "DescriptionStyleModel",
            "model_module_version": "1.5.0",
            "state": {
              "_model_module": "@jupyter-widgets/controls",
              "_model_module_version": "1.5.0",
              "_model_name": "DescriptionStyleModel",
              "_view_count": null,
              "_view_module": "@jupyter-widgets/base",
              "_view_module_version": "1.2.0",
              "_view_name": "StyleView",
              "description_width": ""
            }
          }
        }
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}