diff --git a/gemini/use-cases/video-analysis/video_analysis.ipynb b/gemini/use-cases/video-analysis/video_analysis.ipynb index 346d714c856..820e9d70ec7 100644 --- a/gemini/use-cases/video-analysis/video_analysis.ipynb +++ b/gemini/use-cases/video-analysis/video_analysis.ipynb @@ -31,6 +31,8 @@ "source": [ "# Video Analysis with Gemini\n", "\n", + "> **NOTE:** This notebook uses the Vertex AI SDK, which does not support Gemini 2.0; refer to [this updated notebook](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/use-cases/video-analysis/youtube_video_analysis.ipynb) which uses the Google Gen AI SDK.\n", + "\n", "\n", "
\n", " \n", diff --git a/gemini/use-cases/video-analysis/youtube_video_analysis.ipynb b/gemini/use-cases/video-analysis/youtube_video_analysis.ipynb index ddf7b9ba8e9..f2b135ad141 100644 --- a/gemini/use-cases/video-analysis/youtube_video_analysis.ipynb +++ b/gemini/use-cases/video-analysis/youtube_video_analysis.ipynb @@ -101,8 +101,9 @@ "In this notebook, you'll explore how to do direct analysis of publicly available [YouTube](https://www.youtube.com/) videos with Gemini.\n", "\n", "You will complete the following tasks:\n", - "- Summarizing a single YouTube video using Gemini 1.5 Flash\n", - "- Extracting a specific set of structured outputs from a longer YouTube video using Gemini 1.5 Pro and controlled generation\n", + "\n", + "- Summarizing a single YouTube video using Gemini 2.0 Flash\n", + "- Extracting a specific set of structured outputs from a longer YouTube video using Gemini 2.0 Pro and controlled generation\n", "- Creating insights from analyzing multiple YouTube videos together using asynchronous generation with Gemini" ] }, @@ -121,18 +122,18 @@ "id": "No17Cw5hgx12" }, "source": [ - "### Install Vertex AI SDK and other required packages\n" + "### Install Google Gen AI SDK and other required packages\n" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "id": "tFy3H3aPgx12" }, "outputs": [], "source": [ - "%pip install --upgrade --user --quiet google-cloud-aiplatform itables" + "%pip install --upgrade --quiet google-genai itables" ] }, { @@ -206,7 +207,7 @@ "id": "DF4l8DTdWgPY" }, "source": [ - "### Set Google Cloud project information and initialize Vertex AI SDK\n", + "### Set Google Cloud project information and create client\n", "\n", "To get started using Vertex AI, you must have an existing Google Cloud project and [enable the Vertex AI API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com).\n", "\n", @@ -215,7 +216,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 26, "metadata": { "id": "Nqwi-5ufWp_B" }, @@ -224,15 +225,15 @@ "# Use the environment variable if the user doesn't provide Project ID.\n", "import os\n", "\n", - "import vertexai\n", - "\n", - "PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\", isTemplate: true}\n", - "if PROJECT_ID == \"[your-project-id]\":\n", + "PROJECT_ID = \"[your-project-id]\" # @param {type: \"string\", placeholder: \"[your-project-id]\", isTemplate: true}\n", + "if not PROJECT_ID or PROJECT_ID == \"[your-project-id]\":\n", " PROJECT_ID = str(os.environ.get(\"GOOGLE_CLOUD_PROJECT\"))\n", "\n", "LOCATION = os.environ.get(\"GOOGLE_CLOUD_REGION\", \"us-central1\")\n", "\n", - "vertexai.init(project=PROJECT_ID, location=LOCATION)" + "from google import genai\n", + "\n", + "client = genai.Client(vertexai=True, project=PROJECT_ID, location=LOCATION)" ] }, { @@ -264,11 +265,11 @@ "import json\n", "\n", "from IPython.display import HTML, Markdown, display\n", + "from google.genai.types import GenerateContentConfig, Part\n", "from itables import show\n", "import itables.options as itable_opts\n", "import pandas as pd\n", - "from tenacity import retry, stop_after_attempt, wait_random_exponential\n", - "from vertexai.generative_models import GenerationConfig, GenerativeModel, Part" + "from tenacity import retry, stop_after_attempt, wait_random_exponential" ] }, { @@ -296,6 +297,38 @@ "itable_opts.column_filters = \"header\"" ] }, + { + "cell_type": "markdown", + "metadata": { + "id": "9d46fd0dfdf7" + }, + "source": [ + "### Create a helper function" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "id": "e9034b0991f4" + }, + "outputs": [], + "source": [ + "def display_youtube_video(url: str) -> None:\n", + " youtube_video_embed_url = url.replace(\"/watch?v=\", \"/embed/\")\n", + "\n", + " # Create HTML code to directly embed video\n", + " youtube_video_embed_html_code = f\"\"\"\n", + " \n", + " \"\"\"\n", + "\n", + " # Display embedded YouTube video\n", + " display(HTML(youtube_video_embed_html_code))" + ] + }, { "cell_type": "markdown", "metadata": { @@ -314,11 +347,8 @@ "outputs": [], "source": [ "# Set Gemini Flash and Pro models to be used in this notebook\n", - "GEMINI_FLASH_MODEL_ID = \"gemini-1.5-flash\"\n", - "GEMINI_PRO_MODEL_ID = \"gemini-1.5-pro\"\n", - "\n", - "gemini_flash_model = GenerativeModel(GEMINI_FLASH_MODEL_ID)\n", - "gemini_pro_model = GenerativeModel(GEMINI_PRO_MODEL_ID)" + "GEMINI_FLASH_MODEL_ID = \"gemini-2.0-flash-001\"\n", + "GEMINI_PRO_MODEL_ID = \"gemini-2.0-pro-exp-02-05\"" ] }, { @@ -343,80 +373,40 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "id": "5c8a32e14eec" }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Provide link to a public YouTube video to summarize\n", "YOUTUBE_VIDEO_URL = (\n", " \"https://www.youtube.com/watch?v=O_W_VGUeHVI\" # @param {type:\"string\"}\n", ")\n", "\n", - "youtube_video_embed_url = YOUTUBE_VIDEO_URL.replace(\"/watch?v=\", \"/embed/\")\n", - "\n", - "# Create HTML code to directly embed video\n", - "youtube_video_embed_html_code = f\"\"\"\n", - "\n", - "\"\"\"\n", - "\n", - "# Display embedded YouTube video\n", - "display(HTML(youtube_video_embed_html_code))" + "display_youtube_video(YOUTUBE_VIDEO_URL)" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "id": "9bd742163fc7" }, - "outputs": [ - { - "data": { - "text/markdown": [ - "This Google Cloud promotional video explores how Major League Baseball (MLB) uses data analytics to enhance the fan experience. Priyanka Vergadia, Lead Developer Advocate at Google, interviews several MLB representatives to discuss the process. \n", - "\n", - "The MLB collects 25 million unique data points per game using Hawk-Eye cameras. This data is then processed and stored in Google Cloud using Anthos, Kubernetes Engine, Bigtable, and other technologies. This information powers MLB tools like MLB Film Room, and makes data accessible to fans and analysts. \n", - "\n", - "Rob Engel, Senior Director of Software Engineering at MLB, explains the technology that enables real-time data transfer. He discusses the use of Anthos, Kubernetes Engine, and Cloud SQL to process and store the data.\n", - "\n", - "John Kraizt, Director, Baseball Systems at Arizona Diamondbacks, explains how MLB teams use the data. Finally, Sarah Langs, Reporter/Researcher at MLB Advanced Media, describes how analysts use websites such as Baseball Savant and Statcast to translate the data for fan consumption." - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Call Gemini API with prompt to summarize video\n", - "video_summary_prompt = \"Summarize this video.\"\n", - "\n", - "video_summary_response = gemini_flash_model.generate_content(\n", - " [video_summary_prompt, Part.from_uri(mime_type=\"video/webm\", uri=YOUTUBE_VIDEO_URL)]\n", + "video_summary_prompt = \"Give a detailed summary of this video.\"\n", + "\n", + "video_summary_response = client.models.generate_content(\n", + " model=GEMINI_FLASH_MODEL_ID,\n", + " contents=[\n", + " Part.from_uri(\n", + " file_uri=YOUTUBE_VIDEO_URL,\n", + " mime_type=\"video/webm\",\n", + " ),\n", + " video_summary_prompt,\n", + " ],\n", ")\n", "\n", "# Display results\n", @@ -445,49 +435,19 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "id": "fc98b36d5fc4" }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Link to full Cloud Next '24 Opening Keynote video\n", - "cloud_next_keynote_video_url = \"https://www.youtube.com/watch?v=V6DJYGn2SFk\"\n", + "# cloud_next_keynote_video_url = \"https://www.youtube.com/watch?v=V6DJYGn2SFk\"\n", "\n", "# Uncomment line below to replace with 14-min keynote summary video instead (faster)\n", - "# cloud_next_keynote_video_url = \"https://www.youtube.com/watch?v=M-CzbTUVykg\"\n", + "cloud_next_keynote_video_url = \"https://www.youtube.com/watch?v=M-CzbTUVykg\"\n", "\n", - "cloud_next_keynote_video_embed_url = cloud_next_keynote_video_url.replace(\n", - " \"/watch?v=\", \"/embed/\"\n", - ")\n", - "\n", - "# Create HTML code to directly embed video\n", - "cloud_next_keynote_youtube_video_embed_html_code = f\"\"\"\n", - "\n", - "\"\"\"\n", - "\n", - "# Display embedded YouTube video\n", - "display(HTML(cloud_next_keynote_youtube_video_embed_html_code))" + "display_youtube_video(cloud_next_keynote_video_url)" ] }, { @@ -498,24 +458,16 @@ "source": [ "Below is a prompt to extract the biggest product announcements that were made during this keynote. We use the response schema to show that we want valid JSON output in a particular form, including a constraint specifying that the \"product status\" field should be either GA, Preview, or Coming Soon.\n", "\n", - "The following cell may take several minutes to run, as Gemini 1.5 Pro is analyzing all 101 minutes of the video and audio to produce comprehensive results." + "The following cell may take several minutes to run, as Gemini 2.0 Pro is analyzing all 101 minutes of the video and audio to produce comprehensive results." ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": { "id": "d5a93cd5d2fa" }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[{\"name\": \"Gemini 1.5 Pro\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Gemini 1.5 Pro shows dramatically enhanced performance and includes a breakthrough in long context understanding.\"}, {\"name\": \"A3 Mega VMs\", \"product_status\": \"GA\", \"quote_from_presenter\": \"A3 Mega VMs powered by Nvidia H100 Tensor Core GPUs with twice the network bandwidth vs. A3 instances.\"}, {\"name\": \"TPU v5p\", \"product_status\": \"GA\", \"quote_from_presenter\": \"Our latest generation TPU pod consists of 8,960 chips interconnected to support the largest scale ML training and serving.\"}, {\"name\": \"NVIDIA GB200 NVL72\", \"product_status\": \"Coming Soon\", \"quote_from_presenter\": \"Nvidia's newest Grace Blackwell generation of GPUs coming to Google Cloud early in 2025.\"}, {\"name\": \"Google Axion Processors\", \"product_status\": \"Coming Soon\", \"quote_from_presenter\": \"Google's first custom Arm-based CPU designed for the data center will be available in preview later this year.\"}, {\"name\": \"Cloud Storage Fuse Caching\", \"product_status\": \"GA\", \"quote_from_presenter\": \"Cloud Storage Fuse Caching is generally available.\"}, {\"name\": \"Parallelstore Caching\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Parallelstore Caching is in preview.\"}, {\"name\": \"Hyperdisk ML\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Hyperdisk ML is our next generation block storage service optimized for AI inference and serving workloads.\"}, {\"name\": \"Dynamic Workload Scheduler\", \"product_status\": \"GA\", \"quote_from_presenter\": \"Dynamic Workload Scheduler now has two new options: Calendar Mode for start time assurance and Flex Start for optimized economics.\"}, {\"name\": \"Gemini in Threat Intelligence\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Gemini in Threat Intelligence is in preview.\"}, {\"name\": \"Gemini in Security Command Center\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Gemini in Security Command Center is in preview.\"}, {\"name\": \"Google Vids\", \"product_status\": \"GA\", \"quote_from_presenter\": \"Google Vids is generally available.\"}, {\"name\": \"Text-to-Live Image\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Text-to-Live Image is in preview.\"}, {\"name\": \"Digital Watermarking\", \"product_status\": \"GA\", \"quote_from_presenter\": \"Digital Watermarking is generally available.\"}, {\"name\": \"New Editing Modes in Imagen 2.0\", \"product_status\": \"GA\", \"quote_from_presenter\": \"New Editing Modes in Imagen 2.0 are generally available.\"}, {\"name\": \"Gemini in BigQuery\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Gemini in BigQuery simplifies data preparation using AI.\"}, {\"name\": \"Vector Indexing in BigQuery and AlloyDB\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Vector Indexing in BigQuery and AlloyDB allows you to query the right data in analytical and operational systems.\"}, {\"name\": \"BigQuery Data Canvas\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"BigQuery Data Canvas provides a notebook-like experience with natural language and embedded visualizations.\"}, {\"name\": \"Gemini Code Assist\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Gemini Code Assist is in preview.\"}, {\"name\": \"Vertex AI Agent Builder\", \"product_status\": \"Preview\", \"quote_from_presenter\": \"Vertex AI Agent Builder lets you create customer agents that are amazingly powerful in just three key steps.\"}] \n" - ] - } - ], + "outputs": [], "source": [ "# Set up pieces (prompt, response schema, config) and run video extraction\n", "\n", @@ -545,189 +497,38 @@ " },\n", "}\n", "\n", - "video_extraction_json_generation_config = GenerationConfig(\n", + "video_extraction_json_generation_config = GenerateContentConfig(\n", " temperature=0.0,\n", " max_output_tokens=8192,\n", " response_mime_type=\"application/json\",\n", " response_schema=video_extraction_response_schema,\n", ")\n", "\n", - "video_extraction_response = gemini_pro_model.generate_content(\n", - " [\n", + "video_extraction_response = client.models.generate_content(\n", + " model=GEMINI_PRO_MODEL_ID,\n", + " contents=[\n", " video_extraction_prompt,\n", - " Part.from_uri(mime_type=\"video/webm\", uri=cloud_next_keynote_video_url),\n", + " Part.from_uri(\n", + " file_uri=cloud_next_keynote_video_url,\n", + " mime_type=\"video/webm\",\n", + " ),\n", " ],\n", - " generation_config=video_extraction_json_generation_config,\n", + " config=video_extraction_json_generation_config,\n", ")\n", "\n", - "video_extraction_response_text = video_extraction_response.text\n", - "\n", - "print(video_extraction_response_text)" + "print(video_extraction_response.text)" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "id": "b7b6aa978eb8" }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
nameproduct_statusquote_from_presenter
\n", - "\n", - "
\n", - "Loading ITables v2.2.1 from the internet...\n", - "(need help?)
\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Convert structured output from response to data frame for display and/or further analysis\n", - "video_extraction_response_df = pd.DataFrame(json.loads(video_extraction_response_text))\n", + "video_extraction_response_df = pd.DataFrame(video_extraction_response.parsed)\n", "\n", "show(video_extraction_response_df)" ] @@ -757,134 +558,11 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "id": "b004061c908a" }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
yearyt_link
02023https://www.youtube.com/watch?v=3KtWfp0UopM
12022https://www.youtube.com/watch?v=4WXs3sKu41I
22021https://www.youtube.com/watch?v=EqboAI-Vk-U
32020https://www.youtube.com/watch?v=rokGy0huYEA
42019https://www.youtube.com/watch?v=ZRCdORJiUgU
52018https://www.youtube.com/watch?v=6aFdEhEZQjE
62017https://www.youtube.com/watch?v=vI4LHl4yFuo
72016https://www.youtube.com/watch?v=KIViy7L_lo8
82015https://www.youtube.com/watch?v=q7o7R5BgWDY
92014https://www.youtube.com/watch?v=DVwHCGAr_OE
102013https://www.youtube.com/watch?v=Lv-sY_z8MNs
112012https://www.youtube.com/watch?v=xY_MUB8adEQ
122011https://www.youtube.com/watch?v=SAIEamakLoY
132010https://www.youtube.com/watch?v=F0QXB5pw2qE
\n", - "
" - ], - "text/plain": [ - " year yt_link\n", - "0 2023 https://www.youtube.com/watch?v=3KtWfp0UopM\n", - "1 2022 https://www.youtube.com/watch?v=4WXs3sKu41I\n", - "2 2021 https://www.youtube.com/watch?v=EqboAI-Vk-U\n", - "3 2020 https://www.youtube.com/watch?v=rokGy0huYEA\n", - "4 2019 https://www.youtube.com/watch?v=ZRCdORJiUgU\n", - "5 2018 https://www.youtube.com/watch?v=6aFdEhEZQjE\n", - "6 2017 https://www.youtube.com/watch?v=vI4LHl4yFuo\n", - "7 2016 https://www.youtube.com/watch?v=KIViy7L_lo8\n", - "8 2015 https://www.youtube.com/watch?v=q7o7R5BgWDY\n", - "9 2014 https://www.youtube.com/watch?v=DVwHCGAr_OE\n", - "10 2013 https://www.youtube.com/watch?v=Lv-sY_z8MNs\n", - "11 2012 https://www.youtube.com/watch?v=xY_MUB8adEQ\n", - "12 2011 https://www.youtube.com/watch?v=SAIEamakLoY\n", - "13 2010 https://www.youtube.com/watch?v=F0QXB5pw2qE" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Read in table of Year in Search video links from public CSV file\n", "GOOGLE_YEAR_IN_SEARCH_VIDEO_LINKS_CSV_GCS_URI = (\n", @@ -911,7 +589,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 18, "metadata": { "id": "b8589a51547d" }, @@ -946,17 +624,11 @@ " },\n", "}\n", "\n", - "multiple_video_extraction_json_generation_config = GenerationConfig(\n", + "multiple_video_extraction_json_generation_config = GenerateContentConfig(\n", " temperature=0.0,\n", " max_output_tokens=8192,\n", " response_mime_type=\"application/json\",\n", " response_schema=multiple_video_extraction_response_schema,\n", - ")\n", - "\n", - "multiple_video_extraction_model = GenerativeModel(\n", - " model_name=GEMINI_PRO_MODEL_ID,\n", - " system_instruction=multiple_video_extraction_system_instruction_text,\n", - " generation_config=multiple_video_extraction_json_generation_config,\n", ")" ] }, @@ -971,7 +643,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 27, "metadata": { "id": "5aa93ca907bc" }, @@ -983,13 +655,13 @@ "@retry(wait=wait_random_exponential(multiplier=1, max=120), stop=stop_after_attempt(2))\n", "async def async_generate(prompt, yt_link):\n", " try:\n", - " response = await multiple_video_extraction_model.generate_content_async(\n", - " [prompt, Part.from_uri(mime_type=\"video/webm\", uri=yt_link)], stream=False\n", + " response = await client.aio.models.generate_content(\n", + " model=GEMINI_PRO_MODEL_ID,\n", + " contents=[prompt, Part.from_uri(file_uri=yt_link, mime_type=\"video/webm\")],\n", + " config=multiple_video_extraction_json_generation_config,\n", " )\n", "\n", - " response_dict = response.to_dict()\n", - "\n", - " return response_dict\n", + " return response.to_json_dict()\n", " except Exception as e:\n", " print(\"Something failed, retrying\")\n", " print(e)\n", @@ -1048,164 +720,11 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": { "id": "6e424adf2cf8" }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
yearnameathlete_or_teamsportvideo_timestamp
\n", - "\n", - "
\n", - "Loading ITables v2.2.1 from the internet...\n", - "(need help?)
\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Add structured outputs by year back to original table, show full extraction results\n", "year_in_search_responses = year_in_search_yt_links.copy()\n", @@ -1252,111 +771,11 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { "id": "c0cd6041bce7" }, - "outputs": [ - { - "data": { - "text/markdown": [ - "Athletes/Teams Appearing in Multiple Year in Search Videos" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
nameathlete_or_teamsportnum_years
0LEBRON JAMESathletebasketball3
1NAOMI OSAKAathletetennis3
2SIMONE BILESathletegymnastics3
3COCO GAUFFathletetennis2
4NICOLAS MAHUTathletetennis2
5SERENA WILLIAMSathletetennis2
\n", - "
" - ], - "text/plain": [ - " name athlete_or_team sport num_years\n", - "0 LEBRON JAMES athlete basketball 3\n", - "1 NAOMI OSAKA athlete tennis 3\n", - "2 SIMONE BILES athlete gymnastics 3\n", - "3 COCO GAUFF athlete tennis 2\n", - "4 NICOLAS MAHUT athlete tennis 2\n", - "5 SERENA WILLIAMS athlete tennis 2" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Analyze results to show athletes/teams showing up most often in Year in Search videos\n", "multiple_year_in_search_app = (\n",