{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "Tvq1WKK4FMUI" }, "source": [ "## Import Libraries" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "id": "xYOtt7aFhcTH" }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": { "id": "WY8dkcVVqkkn" }, "source": [ "# **Import scrapped CSV**" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "id": "0aszwzb-iJ56" }, "outputs": [], "source": [ "df_fight_stats =pd.read_csv('../scrape_ufc_stats-main/ufc_fight_stats.csv')\n", "df_event_details =pd.read_csv('../scrape_ufc_stats-main/ufc_event_details.csv')\n", "df_fighter_tott = pd.read_csv('../scrape_ufc_stats-main/ufc_fighter_tott.csv')\n", "df_results = pd.read_csv('../scrape_ufc_stats-main/ufc_fight_results.csv')\n", "df_fighter_details =pd.read_csv('../scrape_ufc_stats-main/ufc_fighter_details.csv')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "id": "psb-2u3bA6iO" }, "outputs": [], "source": [ "import re\n", "def extract_rounds(text):\n", " if text == \"No Time Limit\":\n", " return [0]\n", " else:\n", " result = re.findall(r'\\((.*?)\\)', text)\n", " result = list(map(int,result[0].split(\"-\")))\n", " return result\n", "\n", "def handle_result_df(df):\n", " WEIGHTCLASSES_my = ['Lightweight', 'Welterweight', 'Middleweight', 'Featherweight','Heavyweigh', 'Light Heavyweight', 'Bantamweight', 'Flyweight', 'Strawweight', 'Open Weight', 'Catch Weight']\n", " df['Winner'] = df.apply(lambda row: 'NC' if row['OUTCOME'] == 'NC/NC' else 'DRAW' if row['OUTCOME'] == 'D/D' else row['BOUT'].split(' vs. ')[(row['OUTCOME'].split('/')).index('W')], axis=1)\n", " WeightClasses_df = df['WEIGHTCLASS']\n", " result=[]\n", " women = []\n", " Title = []\n", " for bout in WeightClasses_df:\n", " bout_low = bout.lower()\n", " women.append(1) if 'women' in bout_low else women.append(0)\n", " Title.append(1) if 'title' in bout_low else Title.append(0)\n", " find = False\n", " for classes in WEIGHTCLASSES_my: \n", " if classes.lower() in bout_low.lower():\n", " result.append(classes)\n", " find = True \n", " break\n", " if not find:\n", " result.append('Open Weight')\n", " \n", " df.loc[:,\"WeightClass\"] = result\n", " df.loc[:,\"Tittle\"] = Title\n", " df.loc[:,\"Women_fight\"] = women\n", " df['TimeSec'] = df['TIME'].apply(lambda x: (datetime.strptime(x, '%M:%S') - datetime(1900,1,1)).total_seconds()).astype(int)\n", " df['TIME FORMAT'] = df['TIME FORMAT'].apply(lambda x: extract_rounds(str(x)))\n", " df_results['TotalTime'] = df_results.apply(lambda row: sum(row['TIME FORMAT'][0:int(row['ROUND'])-1])*60 + row['TimeSec'],axis=1)\n", " df = df.drop(['OUTCOME','WEIGHTCLASS','TimeSec'],axis=1)\n", " df_results = df_results.merge(df_event_details[['EVENT','DATE']],how='left', left_on='EVENT', right_on='EVENT')\n", " df = df[['DATE','EVENT', 'BOUT', 'Winner', 'WeightClass', 'Tittle', 'Women_fight','METHOD','TIME FORMAT', 'ROUND', 'TIME', 'TotalTime', 'REFEREE',\n", " 'DETAILS', 'URL']]\n", " df['BOUT'] = df['BOUT'].str.split().str.join(' ')\n", " df['EVENT'] = df['EVENT'].str.split().str.join(' ')\n", " return df" ] }, { "cell_type": "markdown", "metadata": { "id": "eY45AUhAqba-" }, "source": [ "# **handle duplicated fighters name**" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Srv5o9YTiVvh", "outputId": "6d50b786-9a08-4778-c16d-42076cedb7c0" }, "outputs": [ { "data": { "text/plain": [ "(3926, 7)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fighter_tott.shape" ] }, { "cell_type": "markdown", "metadata": { "id": "zZt2S-S5D6Ne" }, "source": [ "check each fighter if ha has fight in UFC (DWCS not included) if not drop fighters - not solved duplicated values" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "id": "pHoHlo4FnlcC" }, "outputs": [], "source": [ "df_fighter_tott['Has_fight'] = df_fighter_tott['FIGHTER'].apply(lambda x: x in list(df_fight_stats['FIGHTER']))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "v-KlnCyPo0rT", "outputId": "278e87a7-660c-473c-f3f9-76baf26a599a" }, "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", " \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", "
FIGHTERHEIGHTWEIGHTREACHSTANCEDOBURLHas_fight
0Tom Aaron--155 lbs.--NaNJul 13, 1978http://ufcstats.com/fighter-details/93fe7332d1...False
4Hiroyuki Abe5' 6\"145 lbs.--Orthodox--http://ufcstats.com/fighter-details/c0ed7b2081...False
9Daniel Acacio5' 8\"180 lbs.--OrthodoxDec 27, 1977http://ufcstats.com/fighter-details/1c5879330d...False
12Anthony Adams6' 1\"185 lbs.76\"OrthodoxJan 13, 1988http://ufcstats.com/fighter-details/a77633a989...False
19Fabio Aguiar6' 0\"185 lbs.--NaNFeb 10, 1988http://ufcstats.com/fighter-details/501821d7fb...False
...........................
3916Gaston Bolanos--145 lbs.--NaNSep 14, 1992http://ufcstats.com/fighter-details/96924b0019...False
3920Shara Magomedov6' 2\"170 lbs.--NaNMay 16, 1994http://ufcstats.com/fighter-details/06734ca9d8...False
3922Francisco Prado5' 10\"155 lbs.--NaNJun 16, 2002http://ufcstats.com/fighter-details/3920d0cc28...False
3924Elves Brenner5' 9\"155 lbs.--NaNSep 27, 1997http://ufcstats.com/fighter-details/48a9a12878...False
3925Christian Duncan6' 2\"185 lbs.--NaNJul 24, 1995http://ufcstats.com/fighter-details/a93f94c923...False
\n", "

1601 rows × 8 columns

\n", "
" ], "text/plain": [ " FIGHTER HEIGHT WEIGHT REACH STANCE DOB \\\n", "0 Tom Aaron -- 155 lbs. -- NaN Jul 13, 1978 \n", "4 Hiroyuki Abe 5' 6\" 145 lbs. -- Orthodox -- \n", "9 Daniel Acacio 5' 8\" 180 lbs. -- Orthodox Dec 27, 1977 \n", "12 Anthony Adams 6' 1\" 185 lbs. 76\" Orthodox Jan 13, 1988 \n", "19 Fabio Aguiar 6' 0\" 185 lbs. -- NaN Feb 10, 1988 \n", "... ... ... ... ... ... ... \n", "3916 Gaston Bolanos -- 145 lbs. -- NaN Sep 14, 1992 \n", "3920 Shara Magomedov 6' 2\" 170 lbs. -- NaN May 16, 1994 \n", "3922 Francisco Prado 5' 10\" 155 lbs. -- NaN Jun 16, 2002 \n", "3924 Elves Brenner 5' 9\" 155 lbs. -- NaN Sep 27, 1997 \n", "3925 Christian Duncan 6' 2\" 185 lbs. -- NaN Jul 24, 1995 \n", "\n", " URL Has_fight \n", "0 http://ufcstats.com/fighter-details/93fe7332d1... False \n", "4 http://ufcstats.com/fighter-details/c0ed7b2081... False \n", "9 http://ufcstats.com/fighter-details/1c5879330d... False \n", "12 http://ufcstats.com/fighter-details/a77633a989... False \n", "19 http://ufcstats.com/fighter-details/501821d7fb... False \n", "... ... ... \n", "3916 http://ufcstats.com/fighter-details/96924b0019... False \n", "3920 http://ufcstats.com/fighter-details/06734ca9d8... False \n", "3922 http://ufcstats.com/fighter-details/3920d0cc28... False \n", "3924 http://ufcstats.com/fighter-details/48a9a12878... False \n", "3925 http://ufcstats.com/fighter-details/a93f94c923... False \n", "\n", "[1601 rows x 8 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fighter_tott[df_fighter_tott['Has_fight'] == False]" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "id": "BWMFhcqIO857" }, "outputs": [], "source": [ "df_fighter_tott = df_fighter_tott.loc[df_fighter_tott['Has_fight']==True,:]" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "39uFAb49DP_O", "outputId": "566a4fec-d02d-4993-d480-a14d7ee74781" }, "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", " \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", "
FIGHTERHEIGHTWEIGHTREACHSTANCEDOBURLHas_fight
1Danny Abbadi5' 11\"155 lbs.--OrthodoxJul 03, 1983http://ufcstats.com/fighter-details/15df64c02b...True
2David Abbott6' 0\"265 lbs.--Switch--http://ufcstats.com/fighter-details/b361180739...True
3Shamil Abdurakhimov6' 3\"235 lbs.76\"OrthodoxSep 02, 1981http://ufcstats.com/fighter-details/2f5cbecbbe...True
5Daichi Abe5' 11\"170 lbs.71\"OrthodoxNov 27, 1991http://ufcstats.com/fighter-details/5140122c3e...True
6Papy Abedi5' 11\"185 lbs.--SouthpawJun 30, 1978http://ufcstats.com/fighter-details/c9f6385af6...True
...........................
3917Steven Koslow--125 lbs.--NaN--http://ufcstats.com/fighter-details/8451233947...True
3918Luan Lacerda5' 7\"135 lbs.--NaNJan 07, 1993http://ufcstats.com/fighter-details/6fc506e109...True
3919Nick Fiore5' 11\"155 lbs.--NaNDec 10, 1997http://ufcstats.com/fighter-details/036e96c1c1...True
3921Melquizael Costa5' 10\"155 lbs.--NaNSep 14, 1996http://ufcstats.com/fighter-details/20bccc9bb4...True
3923Nick Aguirre5' 9\"145 lbs.74\"SouthpawJan 15, 1996http://ufcstats.com/fighter-details/0978385b2b...True
\n", "

2325 rows × 8 columns

\n", "
" ], "text/plain": [ " FIGHTER HEIGHT WEIGHT REACH STANCE DOB \\\n", "1 Danny Abbadi 5' 11\" 155 lbs. -- Orthodox Jul 03, 1983 \n", "2 David Abbott 6' 0\" 265 lbs. -- Switch -- \n", "3 Shamil Abdurakhimov 6' 3\" 235 lbs. 76\" Orthodox Sep 02, 1981 \n", "5 Daichi Abe 5' 11\" 170 lbs. 71\" Orthodox Nov 27, 1991 \n", "6 Papy Abedi 5' 11\" 185 lbs. -- Southpaw Jun 30, 1978 \n", "... ... ... ... ... ... ... \n", "3917 Steven Koslow -- 125 lbs. -- NaN -- \n", "3918 Luan Lacerda 5' 7\" 135 lbs. -- NaN Jan 07, 1993 \n", "3919 Nick Fiore 5' 11\" 155 lbs. -- NaN Dec 10, 1997 \n", "3921 Melquizael Costa 5' 10\" 155 lbs. -- NaN Sep 14, 1996 \n", "3923 Nick Aguirre 5' 9\" 145 lbs. 74\" Southpaw Jan 15, 1996 \n", "\n", " URL Has_fight \n", "1 http://ufcstats.com/fighter-details/15df64c02b... True \n", "2 http://ufcstats.com/fighter-details/b361180739... True \n", "3 http://ufcstats.com/fighter-details/2f5cbecbbe... True \n", "5 http://ufcstats.com/fighter-details/5140122c3e... True \n", "6 http://ufcstats.com/fighter-details/c9f6385af6... True \n", "... ... ... \n", "3917 http://ufcstats.com/fighter-details/8451233947... True \n", "3918 http://ufcstats.com/fighter-details/6fc506e109... True \n", "3919 http://ufcstats.com/fighter-details/036e96c1c1... True \n", "3921 http://ufcstats.com/fighter-details/20bccc9bb4... True \n", "3923 http://ufcstats.com/fighter-details/0978385b2b... True \n", "\n", "[2325 rows x 8 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fighter_tott" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ohL_u-bsB8o-", "outputId": "e18111c3-e94a-4a3c-e653-5e5a35dab398" }, "outputs": [], "source": [ "df_fighter_tott['WEIGHT'] = pd.to_numeric(df_fighter_tott['WEIGHT'].str.replace('lbs.','',regex=True), errors='coerce')\n", "df_fighter_tott['REACH'] = pd.to_numeric(df_fighter_tott['REACH'].str.replace('\"','',regex=True), errors='coerce')" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "YsNc2tPNHaua", "outputId": "1fe647f6-e5dc-4a87-f948-f91df22be6b9" }, "outputs": [], "source": [ "df_fighter_tott['HEIGHT'] = df_fighter_tott['HEIGHT'].replace('--',np.nan)\n", "df_fighter_tott[['ft','inch']] = df_fighter_tott['HEIGHT'].str.extractall(r\"(\\d+)\").unstack().astype(float)\n", "df_fighter_tott['HEIGHT'] = df_fighter_tott['ft']*12 + df_fighter_tott['inch']" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "id": "imexuyRQNy40" }, "outputs": [], "source": [ "df_fighter_tott = df_fighter_tott.drop(['ft', 'inch'], axis =1)" ] }, { "cell_type": "markdown", "metadata": { "id": "yDBZBQPqES_8" }, "source": [ "**drop fighters dupplicated fighters which has no start in ufc**" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "id": "Sh3oK6gmiYNK" }, "outputs": [], "source": [ "df_fighter_tott.drop(df_fighter_tott[df_fighter_tott['URL']=='http://ufcstats.com/fighter-details/c8661e204c66f325'].index, inplace=True)\n", "df_fighter_tott.drop(df_fighter_tott[df_fighter_tott['URL']=='http://ufcstats.com/fighter-details/3a28e1e641366308'].index, inplace=True)\n", "df_fighter_tott.drop(df_fighter_tott[df_fighter_tott['URL']=='http://ufcstats.com/fighter-details/d52ef694108f8235'].index, inplace=True)" ] }, { "cell_type": "markdown", "metadata": { "id": "keSdwfSXExEj" }, "source": [ "find fighters with same names and put nickname to one of them" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "id": "OcGkw0rThcgm" }, "outputs": [], "source": [ "duplicated_fighters_index = list(df_fighter_tott[df_fighter_tott['FIGHTER'].duplicated()].index)[0]\n" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "s8U73ZmKxdbr", "outputId": "02530915-eed6-48cd-a426-9cf880f4c614" }, "outputs": [ { "data": { "text/plain": [ "3109" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "duplicated_fighters_index" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 112 }, "id": "bksk8A2EpPfB", "outputId": "7c24cc5d-1fb8-47b5-c655-0d0b64dceba0" }, "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", "
FIGHTERHEIGHTWEIGHTREACHSTANCEDOBURLHas_fight
3108Bruno Silva64.0125.065.0OrthodoxMar 16, 1990http://ufcstats.com/fighter-details/294aa73dbf...True
3109Bruno Silva72.0185.074.0OrthodoxJul 13, 1989http://ufcstats.com/fighter-details/12ebd7d157...True
\n", "
" ], "text/plain": [ " FIGHTER HEIGHT WEIGHT REACH STANCE DOB \\\n", "3108 Bruno Silva 64.0 125.0 65.0 Orthodox Mar 16, 1990 \n", "3109 Bruno Silva 72.0 185.0 74.0 Orthodox Jul 13, 1989 \n", "\n", " URL Has_fight \n", "3108 http://ufcstats.com/fighter-details/294aa73dbf... True \n", "3109 http://ufcstats.com/fighter-details/12ebd7d157... True " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fighter_tott[df_fighter_tott['FIGHTER'] == df_fighter_tott.loc[duplicated_fighters_index,'FIGHTER']]" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 36 }, "id": "gGbIWtWEvkcY", "outputId": "b2756014-07d3-4140-ae2d-3983e1f1592f" }, "outputs": [ { "data": { "text/plain": [ "'http://ufcstats.com/fighter-details/12ebd7d157e91701'" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "name_dup_fighter = df_fighter_tott.loc[duplicated_fighters_index,'FIGHTER']\n", "url_dup_fighter = df_fighter_tott.loc[duplicated_fighters_index,'URL']\n", "url_dup_fighter" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 206 }, "id": "4Jno1XxFxtuI", "outputId": "126c1d6a-08b9-4e3f-b276-c67546f5dafc" }, "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", "
FIRSTLASTNICKNAMEURL
0TomAaronNaNhttp://ufcstats.com/fighter-details/93fe7332d1...
1DannyAbbadiThe Assassinhttp://ufcstats.com/fighter-details/15df64c02b...
2NarimanAbbasovBayraktarhttp://ufcstats.com/fighter-details/59a9d6dac6...
3DavidAbbottTankhttp://ufcstats.com/fighter-details/b361180739...
4HamdyAbdelwahabThe Hammerhttp://ufcstats.com/fighter-details/3329d692ae...
\n", "
" ], "text/plain": [ " FIRST LAST NICKNAME \\\n", "0 Tom Aaron NaN \n", "1 Danny Abbadi The Assassin \n", "2 Nariman Abbasov Bayraktar \n", "3 David Abbott Tank \n", "4 Hamdy Abdelwahab The Hammer \n", "\n", " URL \n", "0 http://ufcstats.com/fighter-details/93fe7332d1... \n", "1 http://ufcstats.com/fighter-details/15df64c02b... \n", "2 http://ufcstats.com/fighter-details/59a9d6dac6... \n", "3 http://ufcstats.com/fighter-details/b361180739... \n", "4 http://ufcstats.com/fighter-details/3329d692ae... " ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fighter_details.head()" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 36 }, "id": "qZR0Hh6lxxgr", "outputId": "e154f033-b79e-4847-de9b-0fd20cb657fd" }, "outputs": [ { "data": { "text/plain": [ "'Blindado'" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nickname=df_fighter_details.loc[df_fighter_details['URL']==url_dup_fighter, 'NICKNAME'].values[0]\n", "weight_class ='Middleweight'\n", "nickname" ] }, { "cell_type": "markdown", "metadata": { "id": "eR6Pp63eF527" }, "source": [ "**update name in fighter tott df**" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "id": "BukifCkCVIch" }, "outputs": [], "source": [ "df_fighter_tott.loc[df_fighter_tott['URL'] == url_dup_fighter, 'FIGHTER'] = df_fighter_tott.loc[df_fighter_tott['URL'] == url_dup_fighter, 'FIGHTER'] + ' ' + nickname" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "diwFjJcqVuHH", "outputId": "078969ea-fce7-48bc-fa19-495b86a2fc42" }, "outputs": [ { "data": { "text/plain": [ "3109 Bruno Silva Blindado\n", "Name: FIGHTER, dtype: object" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fighter_tott.loc[df_fighter_tott['URL'] == url_dup_fighter, 'FIGHTER']" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "7FxEmkI9TeCL", "outputId": "b89c3940-e28e-44b8-ef9e-c114656d1ac2" }, "outputs": [ { "data": { "text/plain": [ "['BrunoSilvavs.GeraldMeerschaert',\n", " 'AlexPereiravs.BrunoSilva',\n", " 'JordanWrightvs.BrunoSilva',\n", " 'AndrewSanchezvs.BrunoSilva',\n", " 'WellingtonTurmanvs.BrunoSilva']" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fights_list = df_results[(df_results['BOUT'].str.contains(name_dup_fighter)) & (df_results['WEIGHTCLASS'].str.contains(weight_class))]['BOUT'].str.replace(\" \", \"\").tolist()\n", "fights_list" ] }, { "cell_type": "markdown", "metadata": { "id": "m8TZgNh2GFME" }, "source": [ "**update name in fight stats df**" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "id": "LiGk-6DTV8Hz" }, "outputs": [], "source": [ "df_fight_stats.loc[(df_fight_stats['BOUT'].str.replace(\" \", \"\").isin(fights_list)) & (df_fight_stats['FIGHTER']==name_dup_fighter),'FIGHTER'] = name_dup_fighter + ' ' + nickname" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "Wuv0YNXSZ8LF", "outputId": "25e5233c-361b-4b9a-ff50-fa4f1a887e16" }, "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", " \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", " \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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EVENTBOUTROUNDFIGHTERKDSIG.STR.SIG.STR. %TOTAL STR.TDTD %SUB.ATTREV.CTRLHEADBODYLEGDISTANCECLINCHGROUND
946UFC Fight Night: Vera vs. CruzBruno Silva vs. Gerald MeerschaertRound 1Bruno Silva Blindado0.010 of 2638%19 of 380 of 0---0.00.00:005 of 173 of 62 of 39 of 251 of 10 of 0
947UFC Fight Night: Vera vs. CruzBruno Silva vs. Gerald MeerschaertRound 2Bruno Silva Blindado0.012 of 4129%12 of 410 of 0---0.00.00:008 of 322 of 72 of 212 of 410 of 00 of 0
948UFC Fight Night: Vera vs. CruzBruno Silva vs. Gerald MeerschaertRound 3Bruno Silva Blindado0.07 of 1450%7 of 140 of 0---0.00.00:014 of 111 of 12 of 26 of 131 of 10 of 0
949UFC Fight Night: Vera vs. CruzBruno Silva vs. Gerald MeerschaertRound 1Gerald Meerschaert0.012 of 3831%20 of 521 of 1100%0.00.01:558 of 332 of 22 of 36 of 250 of 06 of 13
950UFC Fight Night: Vera vs. CruzBruno Silva vs. Gerald MeerschaertRound 2Gerald Meerschaert0.019 of 5137%19 of 510 of 20%0.00.00:038 of 386 of 85 of 519 of 500 of 00 of 1
951UFC Fight Night: Vera vs. CruzBruno Silva vs. Gerald MeerschaertRound 3Gerald Meerschaert1.015 of 2560%22 of 330 of 30%1.00.00:1412 of 211 of 22 of 211 of 200 of 04 of 5
2056UFC Fight Night: Santos vs. AnkalaevAlex Pereira vs. Bruno SilvaRound 1Alex Pereira0.027 of 5152%31 of 550 of 0---0.00.00:0010 of 2811 of 166 of 723 of 454 of 60 of 0
2057UFC Fight Night: Santos vs. AnkalaevAlex Pereira vs. Bruno SilvaRound 2Alex Pereira0.033 of 5856%53 of 790 of 0---0.00.00:0719 of 4113 of 161 of 130 of 533 of 40 of 1
2058UFC Fight Night: Santos vs. AnkalaevAlex Pereira vs. Bruno SilvaRound 3Alex Pereira0.048 of 7068%81 of 1050 of 0---0.00.01:1031 of 5117 of 180 of 133 of 5315 of 170 of 0
2059UFC Fight Night: Santos vs. AnkalaevAlex Pereira vs. Bruno SilvaRound 1Bruno Silva Blindado0.016 of 4634%19 of 491 of 1100%0.00.00:4810 of 402 of 24 of 413 of 423 of 40 of 0
2060UFC Fight Night: Santos vs. AnkalaevAlex Pereira vs. Bruno SilvaRound 2Bruno Silva Blindado0.031 of 6448%32 of 651 of 250%0.00.01:1020 of 496 of 105 of 527 of 574 of 70 of 0
2061UFC Fight Night: Santos vs. AnkalaevAlex Pereira vs. Bruno SilvaRound 3Bruno Silva Blindado0.012 of 3732%21 of 460 of 50%0.00.01:179 of 300 of 43 of 312 of 350 of 20 of 0
2614UFC 269: Oliveira vs. PoirierJordan Wright vs. Bruno SilvaRound 1Jordan Wright0.020 of 2676%22 of 280 of 0---0.00.00:239 of 1510 of 101 of 111 of 169 of 100 of 0
2615UFC 269: Oliveira vs. PoirierJordan Wright vs. Bruno SilvaRound 1Bruno Silva Blindado1.019 of 2965%22 of 330 of 0---0.00.00:1018 of 280 of 01 of 18 of 133 of 58 of 11
3062UFC Fight Night: Ladd vs. DumontAndrew Sanchez vs. Bruno SilvaRound 1Andrew Sanchez0.04 of 757%25 of 341 of 333%0.00.03:252 of 52 of 20 of 02 of 51 of 11 of 1
3063UFC Fight Night: Ladd vs. DumontAndrew Sanchez vs. Bruno SilvaRound 2Andrew Sanchez0.07 of 1353%35 of 466 of 6100%0.00.04:286 of 110 of 11 of 13 of 90 of 04 of 4
3064UFC Fight Night: Ladd vs. DumontAndrew Sanchez vs. Bruno SilvaRound 3Andrew Sanchez0.022 of 3366%26 of 370 of 30%0.00.00:0018 of 274 of 60 of 021 of 321 of 10 of 0
3065UFC Fight Night: Ladd vs. DumontAndrew Sanchez vs. Bruno SilvaRound 1Bruno Silva Blindado0.08 of 2334%28 of 430 of 10%0.00.00:004 of 163 of 51 of 27 of 221 of 10 of 0
3066UFC Fight Night: Ladd vs. DumontAndrew Sanchez vs. Bruno SilvaRound 2Bruno Silva Blindado0.07 of 1643%17 of 280 of 0---0.00.00:006 of 150 of 01 of 11 of 61 of 15 of 9
3067UFC Fight Night: Ladd vs. DumontAndrew Sanchez vs. Bruno SilvaRound 3Bruno Silva Blindado0.055 of 8465%55 of 840 of 0---0.00.00:1537 of 6518 of 190 of 047 of 748 of 100 of 0
3848UFC Fight Night: Jung vs. IgeWellington Turman vs. Bruno SilvaRound 1Wellington Turman0.01 of 1100%12 of 120 of 100%0.00.02:520 of 01 of 10 of 01 of 10 of 00 of 0
3849UFC Fight Night: Jung vs. IgeWellington Turman vs. Bruno SilvaRound 1Bruno Silva Blindado0.019 of 2673%28 of 370 of 20%0.00.01:3818 of 241 of 20 of 00 of 10 of 119 of 24
\n", "
" ], "text/plain": [ " EVENT \\\n", "946 UFC Fight Night: Vera vs. Cruz \n", "947 UFC Fight Night: Vera vs. Cruz \n", "948 UFC Fight Night: Vera vs. Cruz \n", "949 UFC Fight Night: Vera vs. Cruz \n", "950 UFC Fight Night: Vera vs. Cruz \n", "951 UFC Fight Night: Vera vs. Cruz \n", "2056 UFC Fight Night: Santos vs. Ankalaev \n", "2057 UFC Fight Night: Santos vs. Ankalaev \n", "2058 UFC Fight Night: Santos vs. Ankalaev \n", "2059 UFC Fight Night: Santos vs. Ankalaev \n", "2060 UFC Fight Night: Santos vs. Ankalaev \n", "2061 UFC Fight Night: Santos vs. Ankalaev \n", "2614 UFC 269: Oliveira vs. Poirier \n", "2615 UFC 269: Oliveira vs. Poirier \n", "3062 UFC Fight Night: Ladd vs. Dumont \n", "3063 UFC Fight Night: Ladd vs. Dumont \n", "3064 UFC Fight Night: Ladd vs. Dumont \n", "3065 UFC Fight Night: Ladd vs. Dumont \n", "3066 UFC Fight Night: Ladd vs. Dumont \n", "3067 UFC Fight Night: Ladd vs. Dumont \n", "3848 UFC Fight Night: Jung vs. Ige \n", "3849 UFC Fight Night: Jung vs. Ige \n", "\n", " BOUT ROUND FIGHTER KD \\\n", "946 Bruno Silva vs. Gerald Meerschaert Round 1 Bruno Silva Blindado 0.0 \n", "947 Bruno Silva vs. Gerald Meerschaert Round 2 Bruno Silva Blindado 0.0 \n", "948 Bruno Silva vs. Gerald Meerschaert Round 3 Bruno Silva Blindado 0.0 \n", "949 Bruno Silva vs. Gerald Meerschaert Round 1 Gerald Meerschaert 0.0 \n", "950 Bruno Silva vs. Gerald Meerschaert Round 2 Gerald Meerschaert 0.0 \n", "951 Bruno Silva vs. Gerald Meerschaert Round 3 Gerald Meerschaert 1.0 \n", "2056 Alex Pereira vs. Bruno Silva Round 1 Alex Pereira 0.0 \n", "2057 Alex Pereira vs. Bruno Silva Round 2 Alex Pereira 0.0 \n", "2058 Alex Pereira vs. Bruno Silva Round 3 Alex Pereira 0.0 \n", "2059 Alex Pereira vs. Bruno Silva Round 1 Bruno Silva Blindado 0.0 \n", "2060 Alex Pereira vs. Bruno Silva Round 2 Bruno Silva Blindado 0.0 \n", "2061 Alex Pereira vs. Bruno Silva Round 3 Bruno Silva Blindado 0.0 \n", "2614 Jordan Wright vs. Bruno Silva Round 1 Jordan Wright 0.0 \n", "2615 Jordan Wright vs. Bruno Silva Round 1 Bruno Silva Blindado 1.0 \n", "3062 Andrew Sanchez vs. Bruno Silva Round 1 Andrew Sanchez 0.0 \n", "3063 Andrew Sanchez vs. Bruno Silva Round 2 Andrew Sanchez 0.0 \n", "3064 Andrew Sanchez vs. Bruno Silva Round 3 Andrew Sanchez 0.0 \n", "3065 Andrew Sanchez vs. Bruno Silva Round 1 Bruno Silva Blindado 0.0 \n", "3066 Andrew Sanchez vs. Bruno Silva Round 2 Bruno Silva Blindado 0.0 \n", "3067 Andrew Sanchez vs. Bruno Silva Round 3 Bruno Silva Blindado 0.0 \n", "3848 Wellington Turman vs. Bruno Silva Round 1 Wellington Turman 0.0 \n", "3849 Wellington Turman vs. Bruno Silva Round 1 Bruno Silva Blindado 0.0 \n", "\n", " SIG.STR. SIG.STR. % TOTAL STR. TD TD % SUB.ATT REV. CTRL \\\n", "946 10 of 26 38% 19 of 38 0 of 0 --- 0.0 0.0 0:00 \n", "947 12 of 41 29% 12 of 41 0 of 0 --- 0.0 0.0 0:00 \n", "948 7 of 14 50% 7 of 14 0 of 0 --- 0.0 0.0 0:01 \n", "949 12 of 38 31% 20 of 52 1 of 1 100% 0.0 0.0 1:55 \n", "950 19 of 51 37% 19 of 51 0 of 2 0% 0.0 0.0 0:03 \n", "951 15 of 25 60% 22 of 33 0 of 3 0% 1.0 0.0 0:14 \n", "2056 27 of 51 52% 31 of 55 0 of 0 --- 0.0 0.0 0:00 \n", "2057 33 of 58 56% 53 of 79 0 of 0 --- 0.0 0.0 0:07 \n", "2058 48 of 70 68% 81 of 105 0 of 0 --- 0.0 0.0 1:10 \n", "2059 16 of 46 34% 19 of 49 1 of 1 100% 0.0 0.0 0:48 \n", "2060 31 of 64 48% 32 of 65 1 of 2 50% 0.0 0.0 1:10 \n", "2061 12 of 37 32% 21 of 46 0 of 5 0% 0.0 0.0 1:17 \n", "2614 20 of 26 76% 22 of 28 0 of 0 --- 0.0 0.0 0:23 \n", "2615 19 of 29 65% 22 of 33 0 of 0 --- 0.0 0.0 0:10 \n", "3062 4 of 7 57% 25 of 34 1 of 3 33% 0.0 0.0 3:25 \n", "3063 7 of 13 53% 35 of 46 6 of 6 100% 0.0 0.0 4:28 \n", "3064 22 of 33 66% 26 of 37 0 of 3 0% 0.0 0.0 0:00 \n", "3065 8 of 23 34% 28 of 43 0 of 1 0% 0.0 0.0 0:00 \n", "3066 7 of 16 43% 17 of 28 0 of 0 --- 0.0 0.0 0:00 \n", "3067 55 of 84 65% 55 of 84 0 of 0 --- 0.0 0.0 0:15 \n", "3848 1 of 1 100% 12 of 12 0 of 10 0% 0.0 0.0 2:52 \n", "3849 19 of 26 73% 28 of 37 0 of 2 0% 0.0 0.0 1:38 \n", "\n", " HEAD BODY LEG DISTANCE CLINCH GROUND \n", "946 5 of 17 3 of 6 2 of 3 9 of 25 1 of 1 0 of 0 \n", "947 8 of 32 2 of 7 2 of 2 12 of 41 0 of 0 0 of 0 \n", "948 4 of 11 1 of 1 2 of 2 6 of 13 1 of 1 0 of 0 \n", "949 8 of 33 2 of 2 2 of 3 6 of 25 0 of 0 6 of 13 \n", "950 8 of 38 6 of 8 5 of 5 19 of 50 0 of 0 0 of 1 \n", "951 12 of 21 1 of 2 2 of 2 11 of 20 0 of 0 4 of 5 \n", "2056 10 of 28 11 of 16 6 of 7 23 of 45 4 of 6 0 of 0 \n", "2057 19 of 41 13 of 16 1 of 1 30 of 53 3 of 4 0 of 1 \n", "2058 31 of 51 17 of 18 0 of 1 33 of 53 15 of 17 0 of 0 \n", "2059 10 of 40 2 of 2 4 of 4 13 of 42 3 of 4 0 of 0 \n", "2060 20 of 49 6 of 10 5 of 5 27 of 57 4 of 7 0 of 0 \n", "2061 9 of 30 0 of 4 3 of 3 12 of 35 0 of 2 0 of 0 \n", "2614 9 of 15 10 of 10 1 of 1 11 of 16 9 of 10 0 of 0 \n", "2615 18 of 28 0 of 0 1 of 1 8 of 13 3 of 5 8 of 11 \n", "3062 2 of 5 2 of 2 0 of 0 2 of 5 1 of 1 1 of 1 \n", "3063 6 of 11 0 of 1 1 of 1 3 of 9 0 of 0 4 of 4 \n", "3064 18 of 27 4 of 6 0 of 0 21 of 32 1 of 1 0 of 0 \n", "3065 4 of 16 3 of 5 1 of 2 7 of 22 1 of 1 0 of 0 \n", "3066 6 of 15 0 of 0 1 of 1 1 of 6 1 of 1 5 of 9 \n", "3067 37 of 65 18 of 19 0 of 0 47 of 74 8 of 10 0 of 0 \n", "3848 0 of 0 1 of 1 0 of 0 1 of 1 0 of 0 0 of 0 \n", "3849 18 of 24 1 of 2 0 of 0 0 of 1 0 of 1 19 of 24 " ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fight_stats.loc[(df_fight_stats['BOUT'].str.replace(\" \", \"\").isin(fights_list))]" ] }, { "cell_type": "markdown", "metadata": { "id": "UozLP_DYFAX5" }, "source": [ "# **Fight_stats_details df**" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "6jwct572jhZv", "outputId": "622065dc-b8a3-4d73-ce5e-0767835ee504" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 32374 entries, 0 to 32373\n", "Data columns (total 19 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 32374 non-null object \n", " 1 BOUT 32374 non-null object \n", " 2 ROUND 32332 non-null object \n", " 3 FIGHTER 32332 non-null object \n", " 4 KD 32332 non-null float64\n", " 5 SIG.STR. 32332 non-null object \n", " 6 SIG.STR. % 32332 non-null object \n", " 7 TOTAL STR. 32332 non-null object \n", " 8 TD 32332 non-null object \n", " 9 TD % 32332 non-null object \n", " 10 SUB.ATT 32332 non-null float64\n", " 11 REV. 32332 non-null float64\n", " 12 CTRL 32332 non-null object \n", " 13 HEAD 32332 non-null object \n", " 14 BODY 32332 non-null object \n", " 15 LEG 32332 non-null object \n", " 16 DISTANCE 32332 non-null object \n", " 17 CLINCH 32332 non-null object \n", " 18 GROUND 32332 non-null object \n", "dtypes: float64(3), object(16)\n", "memory usage: 4.7+ MB\n" ] } ], "source": [ "df_fight_stats.info()" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 250 }, "id": "ctIfwws1iaJK", "outputId": "4d477707-e729-41e5-8609-851abc2d2e2c" }, "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", " \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", "
EVENTBOUTROUNDFIGHTERKDSIG.STR.SIG.STR. %TOTAL STR.TDTD %SUB.ATTREV.CTRLHEADBODYLEGDISTANCECLINCHGROUND
0UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacRound 1Derrick Lewis0.00 of 30%0 of 30 of 0---0.00.00:000 of 20 of 10 of 00 of 30 of 00 of 0
1UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacRound 1Serghei Spivac0.012 of 2157%36 of 546 of 875%1.00.02:3212 of 210 of 00 of 00 of 30 of 012 of 18
2UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkRound 1Da Woon Jung0.05 of 1533%9 of 200 of 40%0.00.02:065 of 150 of 00 of 02 of 103 of 50 of 0
3UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkRound 2Da Woon Jung0.06 of 1250%23 of 290 of 0---0.00.02:162 of 83 of 31 of 13 of 73 of 50 of 0
4UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkRound 3Da Woon Jung0.07 of 2528%11 of 291 of 1100%0.00.01:264 of 193 of 60 of 02 of 195 of 60 of 0
\n", "
" ], "text/plain": [ " EVENT BOUT \\\n", "0 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "1 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "2 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "3 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "4 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "\n", " ROUND FIGHTER KD SIG.STR. SIG.STR. % TOTAL STR. TD TD % \\\n", "0 Round 1 Derrick Lewis 0.0 0 of 3 0% 0 of 3 0 of 0 --- \n", "1 Round 1 Serghei Spivac 0.0 12 of 21 57% 36 of 54 6 of 8 75% \n", "2 Round 1 Da Woon Jung 0.0 5 of 15 33% 9 of 20 0 of 4 0% \n", "3 Round 2 Da Woon Jung 0.0 6 of 12 50% 23 of 29 0 of 0 --- \n", "4 Round 3 Da Woon Jung 0.0 7 of 25 28% 11 of 29 1 of 1 100% \n", "\n", " SUB.ATT REV. CTRL HEAD BODY LEG DISTANCE CLINCH GROUND \n", "0 0.0 0.0 0:00 0 of 2 0 of 1 0 of 0 0 of 3 0 of 0 0 of 0 \n", "1 1.0 0.0 2:32 12 of 21 0 of 0 0 of 0 0 of 3 0 of 0 12 of 18 \n", "2 0.0 0.0 2:06 5 of 15 0 of 0 0 of 0 2 of 10 3 of 5 0 of 0 \n", "3 0.0 0.0 2:16 2 of 8 3 of 3 1 of 1 3 of 7 3 of 5 0 of 0 \n", "4 0.0 0.0 1:26 4 of 19 3 of 6 0 of 0 2 of 19 5 of 6 0 of 0 " ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fight_stats.head()" ] }, { "cell_type": "markdown", "metadata": { "id": "lk9zbnyJGUW8" }, "source": [ "**drop rows where are not fighter filled**" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "id": "GRmEnkzBxBKx" }, "outputs": [], "source": [ "df_fight_stats = df_fight_stats[df_fight_stats['FIGHTER'].notna()]" ] }, { "cell_type": "markdown", "metadata": { "id": "fD41GE-8GdXP" }, "source": [ "**splits stats by 'of' to attemp, landed**" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "id": "HS1qhSNfouYj" }, "outputs": [], "source": [ "cols_to_split = [col for col in list(df_fight_stats.columns) if ' of ' in str(df_fight_stats.loc[0,col])]" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "5fuUD-Pyqc9W", "outputId": "522a6fda-9643-4357-9fb5-f2aa8d0806bb" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SIG.STR._landed\n", "TOTAL STR._landed\n", "TD_landed\n", "HEAD_landed\n", "BODY_landed\n", "LEG_landed\n", "DISTANCE_landed\n", "CLINCH_landed\n", "GROUND_landed\n" ] } ], "source": [ "for col in cols_to_split:\n", " print(col + '_landed')\n", " df_fight_stats[[col + '_landed', col + '_attemps']] = (df_fight_stats[col].str.split(' of ', expand=True))\n", " df_fight_stats[[col + '_landed', col + '_attemps']] = df_fight_stats[[col + '_landed', col + '_attemps']].fillna(0)\n", " df_fight_stats[[col + '_landed', col + '_attemps']] = df_fight_stats[[col + '_landed', col + '_attemps']].astype(int)" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "-hLszcAtr9xz", "outputId": "e142d2dd-2ef4-4730-f66e-cfcdb4274d5c" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Int64Index: 32332 entries, 0 to 32373\n", "Data columns (total 37 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 32332 non-null object \n", " 1 BOUT 32332 non-null object \n", " 2 ROUND 32332 non-null object \n", " 3 FIGHTER 32332 non-null object \n", " 4 KD 32332 non-null float64\n", " 5 SIG.STR. 32332 non-null object \n", " 6 SIG.STR. % 32332 non-null object \n", " 7 TOTAL STR. 32332 non-null object \n", " 8 TD 32332 non-null object \n", " 9 TD % 32332 non-null object \n", " 10 SUB.ATT 32332 non-null float64\n", " 11 REV. 32332 non-null float64\n", " 12 CTRL 32332 non-null object \n", " 13 HEAD 32332 non-null object \n", " 14 BODY 32332 non-null object \n", " 15 LEG 32332 non-null object \n", " 16 DISTANCE 32332 non-null object \n", " 17 CLINCH 32332 non-null object \n", " 18 GROUND 32332 non-null object \n", " 19 SIG.STR._landed 32332 non-null int32 \n", " 20 SIG.STR._attemps 32332 non-null int32 \n", " 21 TOTAL STR._landed 32332 non-null int32 \n", " 22 TOTAL STR._attemps 32332 non-null int32 \n", " 23 TD_landed 32332 non-null int32 \n", " 24 TD_attemps 32332 non-null int32 \n", " 25 HEAD_landed 32332 non-null int32 \n", " 26 HEAD_attemps 32332 non-null int32 \n", " 27 BODY_landed 32332 non-null int32 \n", " 28 BODY_attemps 32332 non-null int32 \n", " 29 LEG_landed 32332 non-null int32 \n", " 30 LEG_attemps 32332 non-null int32 \n", " 31 DISTANCE_landed 32332 non-null int32 \n", " 32 DISTANCE_attemps 32332 non-null int32 \n", " 33 CLINCH_landed 32332 non-null int32 \n", " 34 CLINCH_attemps 32332 non-null int32 \n", " 35 GROUND_landed 32332 non-null int32 \n", " 36 GROUND_attemps 32332 non-null int32 \n", "dtypes: float64(3), int32(18), object(16)\n", "memory usage: 8.2+ MB\n" ] } ], "source": [ "df_fight_stats.info()" ] }, { "cell_type": "markdown", "metadata": { "id": "fvC8gyiGGsNw" }, "source": [ "**drop original columns + columns with %**" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "id": "BDxhINRduTGW" }, "outputs": [], "source": [ "cols_to_del = cols_to_split + ['SIG.STR. %', 'TD %']\n", "df_fight_stats = df_fight_stats.drop(cols_to_del, axis = 1)" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "HLWDMDndjSBZ", "outputId": "9d60af20-d96e-46f7-dc03-8742d0e82c66" }, "outputs": [ { "data": { "text/plain": [ "EVENT False\n", "BOUT False\n", "ROUND False\n", "FIGHTER False\n", "KD False\n", "SUB.ATT False\n", "REV. False\n", "CTRL False\n", "SIG.STR._landed False\n", "SIG.STR._attemps False\n", "TOTAL STR._landed False\n", "TOTAL STR._attemps False\n", "TD_landed False\n", "TD_attemps False\n", "HEAD_landed False\n", "HEAD_attemps False\n", "BODY_landed False\n", "BODY_attemps False\n", "LEG_landed False\n", "LEG_attemps False\n", "DISTANCE_landed False\n", "DISTANCE_attemps False\n", "CLINCH_landed False\n", "CLINCH_attemps False\n", "GROUND_landed False\n", "GROUND_attemps False\n", "dtype: bool" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fight_stats.isna().any()" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 445 }, "id": "ny3fLP86ui9N", "outputId": "dfc8f8f2-164d-4eaf-9ec3-0e95ec0205a8" }, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EVENTBOUTROUNDFIGHTERKDSUB.ATTREV.CTRLSIG.STR._landedSIG.STR._attemps...BODY_landedBODY_attempsLEG_landedLEG_attempsDISTANCE_landedDISTANCE_attempsCLINCH_landedCLINCH_attempsGROUND_landedGROUND_attemps
0UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacRound 1Derrick Lewis0.00.00.00:0003...0100030000
1UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacRound 1Serghei Spivac0.01.00.02:321221...000003001218
2UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkRound 1Da Woon Jung0.00.00.02:06515...00002103500
\n", "

3 rows × 26 columns

\n", "
" ], "text/plain": [ " EVENT BOUT \\\n", "0 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "1 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "2 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "\n", " ROUND FIGHTER KD SUB.ATT REV. CTRL SIG.STR._landed \\\n", "0 Round 1 Derrick Lewis 0.0 0.0 0.0 0:00 0 \n", "1 Round 1 Serghei Spivac 0.0 1.0 0.0 2:32 12 \n", "2 Round 1 Da Woon Jung 0.0 0.0 0.0 2:06 5 \n", "\n", " SIG.STR._attemps ... BODY_landed BODY_attemps LEG_landed LEG_attemps \\\n", "0 3 ... 0 1 0 0 \n", "1 21 ... 0 0 0 0 \n", "2 15 ... 0 0 0 0 \n", "\n", " DISTANCE_landed DISTANCE_attemps CLINCH_landed CLINCH_attemps \\\n", "0 0 3 0 0 \n", "1 0 3 0 0 \n", "2 2 10 3 5 \n", "\n", " GROUND_landed GROUND_attemps \n", "0 0 0 \n", "1 12 18 \n", "2 0 0 \n", "\n", "[3 rows x 26 columns]" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fight_stats.head(3)" ] }, { "cell_type": "markdown", "metadata": { "id": "AUl9fUXuHBgm" }, "source": [ "**create agg df**" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "id": "68tMLhnEvv3f" }, "outputs": [], "source": [ "df_fight_stats_agg = df_fight_stats.copy()" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "id": "25rBgYrtv2Jf" }, "outputs": [], "source": [ "df_fight_stats_agg = df_fight_stats_agg.drop(['ROUND'], axis = 1)" ] }, { "cell_type": "code", "execution_count": 35, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "Ffl1IK5QwItV", "outputId": "73d684b2-2b68-4334-c4dc-0e6dc53e8c8e" }, "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", " \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", " \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", " \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", "
EVENTBOUTFIGHTERKDSUB.ATTREV.CTRLSIG.STR._landedSIG.STR._attempsTOTAL STR._landed...BODY_landedBODY_attempsLEG_landedLEG_attempsDISTANCE_landedDISTANCE_attempsCLINCH_landedCLINCH_attempsGROUND_landedGROUND_attemps
0UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacDerrick Lewis0.00.00.00:00030...0100030000
1UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacSerghei Spivac0.01.00.02:32122136...000003001218
2UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkDa Woon Jung0.00.00.02:065159...00002103500
3UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkDa Woon Jung0.00.00.02:1661223...3311373500
4UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkDa Woon Jung0.00.00.01:2672511...36002195600
5UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkDevin Clark0.00.00.02:09101542...1155693313
6UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkDevin Clark0.00.00.01:25101824...11556134500
7UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkDevin Clark0.00.00.01:28193730...342314304611
8UFC Fight Night: Lewis vs. SpivacMarcin Tybura vs. Blagoy IvanovMarcin Tybura0.00.00.00:00224522...10127722450000
9UFC Fight Night: Lewis vs. SpivacMarcin Tybura vs. Blagoy IvanovMarcin Tybura0.00.00.00:00175717...9121117570000
\n", "

10 rows × 25 columns

\n", "
" ], "text/plain": [ " EVENT BOUT \\\n", "0 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "1 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "2 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "3 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "4 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "5 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "6 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "7 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "8 UFC Fight Night: Lewis vs. Spivac Marcin Tybura vs. Blagoy Ivanov \n", "9 UFC Fight Night: Lewis vs. Spivac Marcin Tybura vs. Blagoy Ivanov \n", "\n", " FIGHTER KD SUB.ATT REV. CTRL SIG.STR._landed \\\n", "0 Derrick Lewis 0.0 0.0 0.0 0:00 0 \n", "1 Serghei Spivac 0.0 1.0 0.0 2:32 12 \n", "2 Da Woon Jung 0.0 0.0 0.0 2:06 5 \n", "3 Da Woon Jung 0.0 0.0 0.0 2:16 6 \n", "4 Da Woon Jung 0.0 0.0 0.0 1:26 7 \n", "5 Devin Clark 0.0 0.0 0.0 2:09 10 \n", "6 Devin Clark 0.0 0.0 0.0 1:25 10 \n", "7 Devin Clark 0.0 0.0 0.0 1:28 19 \n", "8 Marcin Tybura 0.0 0.0 0.0 0:00 22 \n", "9 Marcin Tybura 0.0 0.0 0.0 0:00 17 \n", "\n", " SIG.STR._attemps TOTAL STR._landed ... BODY_landed BODY_attemps \\\n", "0 3 0 ... 0 1 \n", "1 21 36 ... 0 0 \n", "2 15 9 ... 0 0 \n", "3 12 23 ... 3 3 \n", "4 25 11 ... 3 6 \n", "5 15 42 ... 1 1 \n", "6 18 24 ... 1 1 \n", "7 37 30 ... 3 4 \n", "8 45 22 ... 10 12 \n", "9 57 17 ... 9 12 \n", "\n", " LEG_landed LEG_attemps DISTANCE_landed DISTANCE_attemps CLINCH_landed \\\n", "0 0 0 0 3 0 \n", "1 0 0 0 3 0 \n", "2 0 0 2 10 3 \n", "3 1 1 3 7 3 \n", "4 0 0 2 19 5 \n", "5 5 5 6 9 3 \n", "6 5 5 6 13 4 \n", "7 2 3 14 30 4 \n", "8 7 7 22 45 0 \n", "9 1 1 17 57 0 \n", "\n", " CLINCH_attemps GROUND_landed GROUND_attemps \n", "0 0 0 0 \n", "1 0 12 18 \n", "2 5 0 0 \n", "3 5 0 0 \n", "4 6 0 0 \n", "5 3 1 3 \n", "6 5 0 0 \n", "7 6 1 1 \n", "8 0 0 0 \n", "9 0 0 0 \n", "\n", "[10 rows x 25 columns]" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fight_stats_agg.head(10)" ] }, { "cell_type": "markdown", "metadata": { "id": "6mMeqM5JHJkX" }, "source": [ "**handle control time value** " ] }, { "cell_type": "code", "execution_count": 36, "metadata": { "id": "crYib1Lqx-cH" }, "outputs": [], "source": [ "df_fight_stats_agg['CTRL'] = df_fight_stats_agg['CTRL'].replace(\"--\", \"0:00\")" ] }, { "cell_type": "code", "execution_count": 37, "metadata": { "id": "_7fr7f4w1HRK" }, "outputs": [], "source": [ "from datetime import datetime, timedelta" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "id": "oNnmAxT9zVtm" }, "outputs": [], "source": [ "df_fight_stats_agg['CTRL'] = df_fight_stats_agg['CTRL'].apply(lambda x: (datetime.strptime(x, '%M:%S') - datetime(1900,1,1)).total_seconds()).astype(int)" ] }, { "cell_type": "code", "execution_count": 39, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "o5QSnzkC1Kge", "outputId": "b8090ead-a7ec-4a8f-c562-0c516573b126" }, "outputs": [ { "data": { "text/plain": [ "count 32332.000000\n", "mean 56.378572\n", "std 74.218739\n", "min 0.000000\n", "25% 0.000000\n", "50% 20.000000\n", "75% 90.000000\n", "max 300.000000\n", "Name: CTRL, dtype: float64" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fight_stats_agg['CTRL'].describe()" ] }, { "cell_type": "code", "execution_count": 40, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "f_vkhPW7xUVO", "outputId": "6401c650-d747-41f0-b7a3-7e7118df2f18" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Int64Index: 32332 entries, 0 to 32373\n", "Data columns (total 25 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 32332 non-null object \n", " 1 BOUT 32332 non-null object \n", " 2 FIGHTER 32332 non-null object \n", " 3 KD 32332 non-null float64\n", " 4 SUB.ATT 32332 non-null float64\n", " 5 REV. 32332 non-null float64\n", " 6 CTRL 32332 non-null int32 \n", " 7 SIG.STR._landed 32332 non-null int32 \n", " 8 SIG.STR._attemps 32332 non-null int32 \n", " 9 TOTAL STR._landed 32332 non-null int32 \n", " 10 TOTAL STR._attemps 32332 non-null int32 \n", " 11 TD_landed 32332 non-null int32 \n", " 12 TD_attemps 32332 non-null int32 \n", " 13 HEAD_landed 32332 non-null int32 \n", " 14 HEAD_attemps 32332 non-null int32 \n", " 15 BODY_landed 32332 non-null int32 \n", " 16 BODY_attemps 32332 non-null int32 \n", " 17 LEG_landed 32332 non-null int32 \n", " 18 LEG_attemps 32332 non-null int32 \n", " 19 DISTANCE_landed 32332 non-null int32 \n", " 20 DISTANCE_attemps 32332 non-null int32 \n", " 21 CLINCH_landed 32332 non-null int32 \n", " 22 CLINCH_attemps 32332 non-null int32 \n", " 23 GROUND_landed 32332 non-null int32 \n", " 24 GROUND_attemps 32332 non-null int32 \n", "dtypes: float64(3), int32(19), object(3)\n", "memory usage: 5.1+ MB\n" ] } ], "source": [ "df_fight_stats_agg.info()" ] }, { "cell_type": "markdown", "metadata": { "id": "lqv-JlmIHVd9" }, "source": [ "**AGG df by bout**" ] }, { "cell_type": "code", "execution_count": 41, "metadata": { "id": "gKGkUejN156X" }, "outputs": [], "source": [ "df_total = df_fight_stats_agg.groupby(['EVENT','BOUT','FIGHTER'],as_index=False).sum()" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "EVENT False\n", "BOUT False\n", "FIGHTER False\n", "KD False\n", "SUB.ATT False\n", "REV. False\n", "CTRL False\n", "SIG.STR._landed False\n", "SIG.STR._attemps False\n", "TOTAL STR._landed False\n", "TOTAL STR._attemps False\n", "TD_landed False\n", "TD_attemps False\n", "HEAD_landed False\n", "HEAD_attemps False\n", "BODY_landed False\n", "BODY_attemps False\n", "LEG_landed False\n", "LEG_attemps False\n", "DISTANCE_landed False\n", "DISTANCE_attemps False\n", "CLINCH_landed False\n", "CLINCH_attemps False\n", "GROUND_landed False\n", "GROUND_attemps False\n", "dtype: bool" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.isna().any()" ] }, { "cell_type": "code", "execution_count": 43, "metadata": { "id": "L9o43F5S1_9u" }, "outputs": [], "source": [ "df_total['BOUT'] = df_total['BOUT'].str.strip()" ] }, { "cell_type": "code", "execution_count": 44, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Rx4FZvANDUp-", "outputId": "28c20b93-0e71-4550-fea4-b8c8000745ce" }, "outputs": [ { "data": { "text/plain": [ "0 Jason MacDonald vs. Ed Herman\n", "1 Jason MacDonald vs. Ed Herman\n", "2 Kendall Grove vs. Chris Price\n", "3 Kendall Grove vs. Chris Price\n", "4 Marcus Davis vs. Forrest Petz\n", " ... \n", "13851 Rory Markham vs. Brodie Farber\n", "13852 Shannon Gugerty vs. Dale Hartt\n", "13853 Shannon Gugerty vs. Dale Hartt\n", "13854 Tim Credeur vs. Cale Yarbrough\n", "13855 Tim Credeur vs. Cale Yarbrough\n", "Name: BOUT, Length: 13856, dtype: object" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total['BOUT']" ] }, { "cell_type": "markdown", "metadata": { "id": "sGMg0mslIn36" }, "source": [ "**split bout to fighter oponnent columns**" ] }, { "cell_type": "code", "execution_count": 45, "metadata": { "id": "COwiC4IoIqSB" }, "outputs": [], "source": [ "df_total['OPPONENT'] = df_total.apply(lambda row: row['BOUT'].split(' vs. ')[0] if row['FIGHTER'] == row['BOUT'].split(' vs. ')[1] else row['BOUT'].split(' vs. ')[1], axis=1)" ] }, { "cell_type": "code", "execution_count": 46, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "VZKJsJvFmMuK", "outputId": "ea1bbe1d-7e8b-45af-9a9d-8bf412dfb388" }, "outputs": [ { "data": { "text/plain": [ "(13856, 26)" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.shape" ] }, { "cell_type": "markdown", "metadata": { "id": "GA8x4VLiJLbM" }, "source": [ "**přidání datumu k eventu a vypočítání věku fightera**" ] }, { "cell_type": "code", "execution_count": 47, "metadata": { "id": "N_ImAoXIjLZI" }, "outputs": [], "source": [ "df_total = df_total.merge(df_event_details[['EVENT','DATE']],how='left', left_on='EVENT', right_on='EVENT')\n", "df_total['DATE'] = df_total['DATE'].apply(pd.to_datetime)" ] }, { "cell_type": "code", "execution_count": 48, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "W7CnJfEUmqDf", "outputId": "440776ca-f43d-41b7-fd3a-c3fbe368d45b" }, "outputs": [ { "data": { "text/plain": [ "(13856, 27)" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.shape" ] }, { "cell_type": "code", "execution_count": 49, "metadata": { "id": "y0A9jcLPpQsj" }, "outputs": [], "source": [ "df_fighter_tott['DOB'] = df_fighter_tott['DOB'] = pd.to_datetime(df_fighter_tott['DOB'], errors='coerce')" ] }, { "cell_type": "markdown", "metadata": { "id": "Ym-m7lLIJYe7" }, "source": [ "**přidání parametrů fightera**" ] }, { "cell_type": "code", "execution_count": 50, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "ps48cIjF6Rtt", "outputId": "12afc65c-4596-497e-c190-74c3469a6f78" }, "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", " \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", "
FIGHTERHEIGHTWEIGHTREACHSTANCEDOBURLHas_fight
1Danny Abbadi71.0155.0NaNOrthodox1983-07-03http://ufcstats.com/fighter-details/15df64c02b...True
2David Abbott72.0265.0NaNSwitchNaThttp://ufcstats.com/fighter-details/b361180739...True
3Shamil Abdurakhimov75.0235.076.0Orthodox1981-09-02http://ufcstats.com/fighter-details/2f5cbecbbe...True
5Daichi Abe71.0170.071.0Orthodox1991-11-27http://ufcstats.com/fighter-details/5140122c3e...True
6Papy Abedi71.0185.0NaNSouthpaw1978-06-30http://ufcstats.com/fighter-details/c9f6385af6...True
...........................
3917Steven KoslowNaN125.0NaNNaNNaThttp://ufcstats.com/fighter-details/8451233947...True
3918Luan Lacerda67.0135.0NaNNaN1993-01-07http://ufcstats.com/fighter-details/6fc506e109...True
3919Nick Fiore71.0155.0NaNNaN1997-12-10http://ufcstats.com/fighter-details/036e96c1c1...True
3921Melquizael Costa70.0155.0NaNNaN1996-09-14http://ufcstats.com/fighter-details/20bccc9bb4...True
3923Nick Aguirre69.0145.074.0Southpaw1996-01-15http://ufcstats.com/fighter-details/0978385b2b...True
\n", "

2322 rows × 8 columns

\n", "
" ], "text/plain": [ " FIGHTER HEIGHT WEIGHT REACH STANCE DOB \\\n", "1 Danny Abbadi 71.0 155.0 NaN Orthodox 1983-07-03 \n", "2 David Abbott 72.0 265.0 NaN Switch NaT \n", "3 Shamil Abdurakhimov 75.0 235.0 76.0 Orthodox 1981-09-02 \n", "5 Daichi Abe 71.0 170.0 71.0 Orthodox 1991-11-27 \n", "6 Papy Abedi 71.0 185.0 NaN Southpaw 1978-06-30 \n", "... ... ... ... ... ... ... \n", "3917 Steven Koslow NaN 125.0 NaN NaN NaT \n", "3918 Luan Lacerda 67.0 135.0 NaN NaN 1993-01-07 \n", "3919 Nick Fiore 71.0 155.0 NaN NaN 1997-12-10 \n", "3921 Melquizael Costa 70.0 155.0 NaN NaN 1996-09-14 \n", "3923 Nick Aguirre 69.0 145.0 74.0 Southpaw 1996-01-15 \n", "\n", " URL Has_fight \n", "1 http://ufcstats.com/fighter-details/15df64c02b... True \n", "2 http://ufcstats.com/fighter-details/b361180739... True \n", "3 http://ufcstats.com/fighter-details/2f5cbecbbe... True \n", "5 http://ufcstats.com/fighter-details/5140122c3e... True \n", "6 http://ufcstats.com/fighter-details/c9f6385af6... True \n", "... ... ... \n", "3917 http://ufcstats.com/fighter-details/8451233947... True \n", "3918 http://ufcstats.com/fighter-details/6fc506e109... True \n", "3919 http://ufcstats.com/fighter-details/036e96c1c1... True \n", "3921 http://ufcstats.com/fighter-details/20bccc9bb4... True \n", "3923 http://ufcstats.com/fighter-details/0978385b2b... True \n", "\n", "[2322 rows x 8 columns]" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_fighter_tott" ] }, { "cell_type": "code", "execution_count": 51, "metadata": { "id": "GbMuny47pboh" }, "outputs": [], "source": [ "df_total = df_total.merge(df_fighter_tott[['FIGHTER', 'HEIGHT', 'WEIGHT', 'REACH', 'STANCE','DOB']], left_on='FIGHTER', right_on='FIGHTER', how='left')" ] }, { "cell_type": "code", "execution_count": 52, "metadata": { "id": "qQjtOeF9nkfE" }, "outputs": [], "source": [ "#df_total = df_total.merge(df_fighter_tott[['FIGHTER', 'HEIGHT', 'WEIGHT', 'REACH', 'STANCE','DOB']], left_on='OPPONENT', right_on='FIGHTER', suffixes=('_fighter','_opponent'))" ] }, { "cell_type": "code", "execution_count": 53, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "XjBLbPugtXf5", "outputId": "c0e9161c-63d6-40a3-d09a-a823070fe293" }, "outputs": [ { "data": { "text/plain": [ "(13857, 32)" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.shape" ] }, { "cell_type": "code", "execution_count": 54, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "EVENT False\n", "BOUT False\n", "FIGHTER False\n", "KD False\n", "SUB.ATT False\n", "REV. False\n", "CTRL False\n", "SIG.STR._landed False\n", "SIG.STR._attemps False\n", "TOTAL STR._landed False\n", "TOTAL STR._attemps False\n", "TD_landed False\n", "TD_attemps False\n", "HEAD_landed False\n", "HEAD_attemps False\n", "BODY_landed False\n", "BODY_attemps False\n", "LEG_landed False\n", "LEG_attemps False\n", "DISTANCE_landed False\n", "DISTANCE_attemps False\n", "CLINCH_landed False\n", "CLINCH_attemps False\n", "GROUND_landed False\n", "GROUND_attemps False\n", "OPPONENT False\n", "DATE False\n", "HEIGHT True\n", "WEIGHT True\n", "REACH True\n", "STANCE True\n", "DOB True\n", "dtype: bool" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.isna().any()" ] }, { "cell_type": "code", "execution_count": 55, "metadata": { "id": "CXEzOSXbtNu9" }, "outputs": [], "source": [ "df_total['AGE'] = (pd.to_datetime(df_total['DATE']) - pd.to_datetime(df_total['DOB'])).astype('\n", "RangeIndex: 13857 entries, 0 to 13856\n", "Data columns (total 33 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 13857 non-null object \n", " 1 BOUT 13857 non-null object \n", " 2 FIGHTER 13857 non-null object \n", " 3 KD 13857 non-null float64 \n", " 4 SUB.ATT 13857 non-null float64 \n", " 5 REV. 13857 non-null float64 \n", " 6 CTRL 13857 non-null int32 \n", " 7 SIG.STR._landed 13857 non-null int32 \n", " 8 SIG.STR._attemps 13857 non-null int32 \n", " 9 TOTAL STR._landed 13857 non-null int32 \n", " 10 TOTAL STR._attemps 13857 non-null int32 \n", " 11 TD_landed 13857 non-null int32 \n", " 12 TD_attemps 13857 non-null int32 \n", " 13 HEAD_landed 13857 non-null int32 \n", " 14 HEAD_attemps 13857 non-null int32 \n", " 15 BODY_landed 13857 non-null int32 \n", " 16 BODY_attemps 13857 non-null int32 \n", " 17 LEG_landed 13857 non-null int32 \n", " 18 LEG_attemps 13857 non-null int32 \n", " 19 DISTANCE_landed 13857 non-null int32 \n", " 20 DISTANCE_attemps 13857 non-null int32 \n", " 21 CLINCH_landed 13857 non-null int32 \n", " 22 CLINCH_attemps 13857 non-null int32 \n", " 23 GROUND_landed 13857 non-null int32 \n", " 24 GROUND_attemps 13857 non-null int32 \n", " 25 OPPONENT 13857 non-null object \n", " 26 DATE 13857 non-null datetime64[ns]\n", " 27 HEIGHT 13794 non-null float64 \n", " 28 WEIGHT 13834 non-null float64 \n", " 29 REACH 12475 non-null float64 \n", " 30 STANCE 13671 non-null object \n", " 31 AGE 13602 non-null float64 \n", " 32 fightNo 13857 non-null int64 \n", "dtypes: datetime64[ns](1), float64(7), int32(19), int64(1), object(5)\n", "memory usage: 2.5+ MB\n" ] } ], "source": [ "df_total.info()" ] }, { "cell_type": "code", "execution_count": 62, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "QMCDtCQwmHaK", "outputId": "869f06f0-f01f-4f91-f553-86ffeac472a6" }, "outputs": [ { "data": { "text/plain": [ "EVENT False\n", "BOUT False\n", "FIGHTER False\n", "KD False\n", "SUB.ATT False\n", "REV. False\n", "CTRL False\n", "SIG.STR._landed False\n", "SIG.STR._attemps False\n", "TOTAL STR._landed False\n", "TOTAL STR._attemps False\n", "TD_landed False\n", "TD_attemps False\n", "HEAD_landed False\n", "HEAD_attemps False\n", "BODY_landed False\n", "BODY_attemps False\n", "LEG_landed False\n", "LEG_attemps False\n", "DISTANCE_landed False\n", "DISTANCE_attemps False\n", "CLINCH_landed False\n", "CLINCH_attemps False\n", "GROUND_landed False\n", "GROUND_attemps False\n", "OPPONENT False\n", "DATE False\n", "HEIGHT True\n", "WEIGHT True\n", "REACH True\n", "STANCE True\n", "AGE True\n", "fightNo False\n", "dtype: bool" ] }, "execution_count": 62, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.isna().any()" ] }, { "cell_type": "code", "execution_count": 63, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ltU284ipdXOT", "outputId": "6cfc5299-451b-42dc-dbf3-01b873c6a24b" }, "outputs": [ { "data": { "text/plain": [ "Index(['EVENT', 'BOUT', 'FIGHTER', 'KD', 'SUB.ATT', 'REV.', 'CTRL',\n", " 'SIG.STR._landed', 'SIG.STR._attemps', 'TOTAL STR._landed',\n", " 'TOTAL STR._attemps', 'TD_landed', 'TD_attemps', 'HEAD_landed',\n", " 'HEAD_attemps', 'BODY_landed', 'BODY_attemps', 'LEG_landed',\n", " 'LEG_attemps', 'DISTANCE_landed', 'DISTANCE_attemps', 'CLINCH_landed',\n", " 'CLINCH_attemps', 'GROUND_landed', 'GROUND_attemps', 'OPPONENT', 'DATE',\n", " 'HEIGHT', 'WEIGHT', 'REACH', 'STANCE', 'AGE', 'fightNo'],\n", " dtype='object')" ] }, "execution_count": 63, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.columns" ] }, { "cell_type": "code", "execution_count": 64, "metadata": { "id": "NcM5nNyzdJc2" }, "outputs": [], "source": [ "df_total = df_total.merge(df_total,how='left', left_on=['EVENT', 'BOUT', 'OPPONENT'], right_on=['EVENT', 'BOUT', 'FIGHTER'], suffixes=('_fighter', '_opponent'))" ] }, { "cell_type": "code", "execution_count": 65, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "EVENT 0\n", "BOUT 0\n", "FIGHTER_fighter 0\n", "KD_fighter 0\n", "SUB.ATT_fighter 0\n", " ... \n", "WEIGHT_opponent 32\n", "REACH_opponent 1392\n", "STANCE_opponent 196\n", "AGE_opponent 265\n", "fightNo_opponent 9\n", "Length: 64, dtype: int64" ] }, "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.isna().sum()" ] }, { "cell_type": "code", "execution_count": 66, "metadata": { "id": "WFvptPtNb3J7" }, "outputs": [], "source": [ "df_total = df_total.drop(['FIGHTER_opponent', 'OPPONENT_opponent', 'DATE_opponent'],axis=1)" ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "id": "_AgY2cHucuE-" }, "outputs": [], "source": [ "df_total= df_total.rename(columns={'BOUT_fighter': \"BOUT\", \"FIGHTER_fighter\": \"FIGHTER\", \"OPPONENT_fighter\": \"OPPONENT\"})" ] }, { "cell_type": "code", "execution_count": 68, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "4u2K2PaAduVn", "outputId": "ede7735d-a8e4-454d-88fa-a18bd9c77c45" }, "outputs": [ { "data": { "text/plain": [ "(13858, 61)" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.shape" ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "guziek8ia1fB", "outputId": "d19c78bb-342c-4aa0-fa69-eda5d1959329" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Int64Index: 13858 entries, 0 to 13857\n", "Data columns (total 61 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 13858 non-null object \n", " 1 BOUT 13858 non-null object \n", " 2 FIGHTER 13858 non-null object \n", " 3 KD_fighter 13858 non-null float64 \n", " 4 SUB.ATT_fighter 13858 non-null float64 \n", " 5 REV._fighter 13858 non-null float64 \n", " 6 CTRL_fighter 13858 non-null int32 \n", " 7 SIG.STR._landed_fighter 13858 non-null int32 \n", " 8 SIG.STR._attemps_fighter 13858 non-null int32 \n", " 9 TOTAL STR._landed_fighter 13858 non-null int32 \n", " 10 TOTAL STR._attemps_fighter 13858 non-null int32 \n", " 11 TD_landed_fighter 13858 non-null int32 \n", " 12 TD_attemps_fighter 13858 non-null int32 \n", " 13 HEAD_landed_fighter 13858 non-null int32 \n", " 14 HEAD_attemps_fighter 13858 non-null int32 \n", " 15 BODY_landed_fighter 13858 non-null int32 \n", " 16 BODY_attemps_fighter 13858 non-null int32 \n", " 17 LEG_landed_fighter 13858 non-null int32 \n", " 18 LEG_attemps_fighter 13858 non-null int32 \n", " 19 DISTANCE_landed_fighter 13858 non-null int32 \n", " 20 DISTANCE_attemps_fighter 13858 non-null int32 \n", " 21 CLINCH_landed_fighter 13858 non-null int32 \n", " 22 CLINCH_attemps_fighter 13858 non-null int32 \n", " 23 GROUND_landed_fighter 13858 non-null int32 \n", " 24 GROUND_attemps_fighter 13858 non-null int32 \n", " 25 OPPONENT 13858 non-null object \n", " 26 DATE_fighter 13858 non-null datetime64[ns]\n", " 27 HEIGHT_fighter 13794 non-null float64 \n", " 28 WEIGHT_fighter 13835 non-null float64 \n", " 29 REACH_fighter 12475 non-null float64 \n", " 30 STANCE_fighter 13671 non-null object \n", " 31 AGE_fighter 13602 non-null float64 \n", " 32 fightNo_fighter 13858 non-null int64 \n", " 33 KD_opponent 13849 non-null float64 \n", " 34 SUB.ATT_opponent 13849 non-null float64 \n", " 35 REV._opponent 13849 non-null float64 \n", " 36 CTRL_opponent 13849 non-null float64 \n", " 37 SIG.STR._landed_opponent 13849 non-null float64 \n", " 38 SIG.STR._attemps_opponent 13849 non-null float64 \n", " 39 TOTAL STR._landed_opponent 13849 non-null float64 \n", " 40 TOTAL STR._attemps_opponent 13849 non-null float64 \n", " 41 TD_landed_opponent 13849 non-null float64 \n", " 42 TD_attemps_opponent 13849 non-null float64 \n", " 43 HEAD_landed_opponent 13849 non-null float64 \n", " 44 HEAD_attemps_opponent 13849 non-null float64 \n", " 45 BODY_landed_opponent 13849 non-null float64 \n", " 46 BODY_attemps_opponent 13849 non-null float64 \n", " 47 LEG_landed_opponent 13849 non-null float64 \n", " 48 LEG_attemps_opponent 13849 non-null float64 \n", " 49 DISTANCE_landed_opponent 13849 non-null float64 \n", " 50 DISTANCE_attemps_opponent 13849 non-null float64 \n", " 51 CLINCH_landed_opponent 13849 non-null float64 \n", " 52 CLINCH_attemps_opponent 13849 non-null float64 \n", " 53 GROUND_landed_opponent 13849 non-null float64 \n", " 54 GROUND_attemps_opponent 13849 non-null float64 \n", " 55 HEIGHT_opponent 13785 non-null float64 \n", " 56 WEIGHT_opponent 13826 non-null float64 \n", " 57 REACH_opponent 12466 non-null float64 \n", " 58 STANCE_opponent 13662 non-null object \n", " 59 AGE_opponent 13593 non-null float64 \n", " 60 fightNo_opponent 13849 non-null float64 \n", "dtypes: datetime64[ns](1), float64(34), int32(19), int64(1), object(6)\n", "memory usage: 5.6+ MB\n" ] } ], "source": [ "df_total.info()" ] }, { "cell_type": "code", "execution_count": 70, "metadata": { "id": "30pzH4ZjDEVg" }, "outputs": [ { "data": { "text/plain": [ "EVENT False\n", "BOUT False\n", "FIGHTER False\n", "KD_fighter False\n", "SUB.ATT_fighter False\n", " ... \n", "WEIGHT_opponent True\n", "REACH_opponent True\n", "STANCE_opponent True\n", "AGE_opponent True\n", "fightNo_opponent True\n", "Length: 61, dtype: bool" ] }, "execution_count": 70, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.isna().any()" ] }, { "cell_type": "code", "execution_count": 71, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 337 }, "id": "ieMfYKFd-Q0s", "outputId": "b970e7ae-f29b-4e75-ead9-d5757f250803" }, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EVENTBOUTOUTCOMEWEIGHTCLASSMETHODROUNDTIMETIME FORMATREFEREEDETAILSURL
0UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacL/WHeavyweight BoutSubmission13:055 Rnd (5-5-5-5-5)Marc GoddardArm Triangle On Groundhttp://ufcstats.com/fight-details/caeeb398f73d...
1UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkL/WLight Heavyweight BoutDecision - Unanimous35:003 Rnd (5-5-5)Keith PetersonEric Colon 27 - 30.Chris Lee 27 - 30.David Let...http://ufcstats.com/fight-details/7a1abc0230af...
2UFC Fight Night: Lewis vs. SpivacMarcin Tybura vs. Blagoy IvanovW/LHeavyweight BoutDecision - Unanimous35:003 Rnd (5-5-5)Mark SmithJunichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29...http://ufcstats.com/fight-details/8741e6a3a5a2...
3UFC Fight Night: Lewis vs. SpivacDooho Choi vs. Kyle NelsonD/DFeatherweight BoutDecision - Majority35:003 Rnd (5-5-5)Chris TognoniAdalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris...http://ufcstats.com/fight-details/01e886808600...
4UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittL/WWelterweight BoutKO/TKO14:363 Rnd (5-5-5)Keith PetersonElbows to Head From Mounthttp://ufcstats.com/fight-details/c63d8062c89c...
\n", "
" ], "text/plain": [ " EVENT BOUT \\\n", "0 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "1 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "2 UFC Fight Night: Lewis vs. Spivac Marcin Tybura vs. Blagoy Ivanov \n", "3 UFC Fight Night: Lewis vs. Spivac Dooho Choi vs. Kyle Nelson \n", "4 UFC Fight Night: Lewis vs. Spivac Yusaku Kinoshita vs. Adam Fugitt \n", "\n", " OUTCOME WEIGHTCLASS METHOD ROUND TIME \\\n", "0 L/W Heavyweight Bout Submission 1 3:05 \n", "1 L/W Light Heavyweight Bout Decision - Unanimous 3 5:00 \n", "2 W/L Heavyweight Bout Decision - Unanimous 3 5:00 \n", "3 D/D Featherweight Bout Decision - Majority 3 5:00 \n", "4 L/W Welterweight Bout KO/TKO 1 4:36 \n", "\n", " TIME FORMAT REFEREE \\\n", "0 5 Rnd (5-5-5-5-5) Marc Goddard \n", "1 3 Rnd (5-5-5) Keith Peterson \n", "2 3 Rnd (5-5-5) Mark Smith \n", "3 3 Rnd (5-5-5) Chris Tognoni \n", "4 3 Rnd (5-5-5) Keith Peterson \n", "\n", " DETAILS \\\n", "0 Arm Triangle On Ground \n", "1 Eric Colon 27 - 30.Chris Lee 27 - 30.David Let... \n", "2 Junichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29... \n", "3 Adalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris... \n", "4 Elbows to Head From Mount \n", "\n", " URL \n", "0 http://ufcstats.com/fight-details/caeeb398f73d... \n", "1 http://ufcstats.com/fight-details/7a1abc0230af... \n", "2 http://ufcstats.com/fight-details/8741e6a3a5a2... \n", "3 http://ufcstats.com/fight-details/01e886808600... \n", "4 http://ufcstats.com/fight-details/c63d8062c89c... " ] }, "execution_count": 71, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results.head()" ] }, { "cell_type": "code", "execution_count": 72, "metadata": { "id": "Nt0jYBUMMwZt" }, "outputs": [], "source": [ "df_results['Winner'] = df_results.apply(lambda row: 'NC' if row['OUTCOME'] == 'NC/NC' else 'DRAW' if row['OUTCOME'] == 'D/D' else row['BOUT'].split(' vs. ')[(row['OUTCOME'].split('/')).index('W')], axis=1)" ] }, { "cell_type": "code", "execution_count": 73, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "Pxr43NK0OPH5", "outputId": "2e892733-cc76-458a-d462-8736dd7dc8a7" }, "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", " \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", " \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", " \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", " \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", " \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", "
EVENTBOUTOUTCOMEWEIGHTCLASSMETHODROUNDTIMETIME FORMATREFEREEDETAILSURLWinner
0UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacL/WHeavyweight BoutSubmission13:055 Rnd (5-5-5-5-5)Marc GoddardArm Triangle On Groundhttp://ufcstats.com/fight-details/caeeb398f73d...Serghei Spivac
1UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkL/WLight Heavyweight BoutDecision - Unanimous35:003 Rnd (5-5-5)Keith PetersonEric Colon 27 - 30.Chris Lee 27 - 30.David Let...http://ufcstats.com/fight-details/7a1abc0230af...Devin Clark
2UFC Fight Night: Lewis vs. SpivacMarcin Tybura vs. Blagoy IvanovW/LHeavyweight BoutDecision - Unanimous35:003 Rnd (5-5-5)Mark SmithJunichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29...http://ufcstats.com/fight-details/8741e6a3a5a2...Marcin Tybura
3UFC Fight Night: Lewis vs. SpivacDooho Choi vs. Kyle NelsonD/DFeatherweight BoutDecision - Majority35:003 Rnd (5-5-5)Chris TognoniAdalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris...http://ufcstats.com/fight-details/01e886808600...DRAW
4UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittL/WWelterweight BoutKO/TKO14:363 Rnd (5-5-5)Keith PetersonElbows to Head From Mounthttp://ufcstats.com/fight-details/c63d8062c89c...Adam Fugitt
5UFC Fight Night: Lewis vs. SpivacJeka Saragih vs. Anshul JubliL/WLightweight BoutKO/TKO23:443 Rnd + OT (5-5-5-5)Marc GoddardElbows to Head From Mounthttp://ufcstats.com/fight-details/b1b20c686dfe...Anshul Jubli
6UFC Fight Night: Lewis vs. SpivacJeongYeong Lee vs. Yi ZhaW/LFeatherweight BoutDecision - Split35:003 Rnd + OT (5-5-5-5)Mark SmithJacob Montalvo 30 - 27.David Lethaby 28 - 29.J...http://ufcstats.com/fight-details/765482eb58e8...JeongYeong Lee
7UFC Fight Night: Lewis vs. SpivacToshiomi Kazama vs. Rinya NakamuraL/WBantamweight BoutKO/TKO10:333 Rnd + OT (5-5-5-5)Keith PetersonPunch to Head At Distancehttp://ufcstats.com/fight-details/a8067e65eb73...Rinya Nakamura
8UFC Fight Night: Lewis vs. SpivacSeungGuk Choi vs. HyunSung ParkL/WFlyweight BoutSubmission33:113 Rnd + OT (5-5-5-5)Marc GoddardRear Naked Chokehttp://ufcstats.com/fight-details/98094a500529...HyunSung Park
9UFC Fight Night: Lewis vs. SpivacJunYong Park vs. Denis TiuliulinW/LMiddleweight BoutSubmission14:053 Rnd (5-5-5)Mark SmithRear Naked Chokehttp://ufcstats.com/fight-details/983fab408074...JunYong Park
10UFC Fight Night: Lewis vs. SpivacTatsuro Taira vs. Jesus AguilarW/LFlyweight BoutSubmission14:203 Rnd (5-5-5)Chris TognoniTriangle Armbar From Bottom Guardhttp://ufcstats.com/fight-details/a26ca06cce40...Tatsuro Taira
11UFC 283: Teixeira vs. HillGlover Teixeira vs. Jamahal HillL/WUFC Light Heavyweight Title BoutDecision - Unanimous55:005 Rnd (5-5-5-5-5)Marc GoddardFabio Alves 44 - 50.Derek Cleary 44 - 50.Sal D...http://ufcstats.com/fight-details/dde7d29cc443...Jamahal Hill
12UFC 283: Teixeira vs. HillDeiveson Figueiredo vs. Brandon MorenoL/WUFC Flyweight Title BoutTKO - Doctor's Stoppage35:005 Rnd (5-5-5-5-5)Herb DeanEye Injuryhttp://ufcstats.com/fight-details/0462bcc27498...Brandon Moreno
13UFC 283: Teixeira vs. HillGilbert Burns vs. Neil MagnyW/LWelterweight BoutSubmission14:153 Rnd (5-5-5)Fernando PortellaArm Triangle From Mounthttp://ufcstats.com/fight-details/1c51f405e5c4...Gilbert Burns
14UFC 283: Teixeira vs. HillLauren Murphy vs. Jessica AndradeL/WWomen's Flyweight BoutDecision - Unanimous35:003 Rnd (5-5-5)Osiris MaiaRafael Ferreira 25 - 30.Fabio Alves 25 - 30.Sa...http://ufcstats.com/fight-details/022198293028...Jessica Andrade
15UFC 283: Teixeira vs. HillPaul Craig vs. Johnny WalkerL/WLight Heavyweight BoutKO/TKO12:163 Rnd (5-5-5)Herb DeanPunches to Head In Clinchhttp://ufcstats.com/fight-details/2d1ac675e6c1...Johnny Walker
16UFC 283: Teixeira vs. HillMauricio Rua vs. Ihor PotieriaL/WLight Heavyweight BoutKO/TKO14:053 Rnd (5-5-5)Herb DeanPunches to Head At Distancehttp://ufcstats.com/fight-details/a3ef3d05ddd8...Ihor Potieria
17UFC 283: Teixeira vs. HillGregory Rodrigues vs. Brunno FerreiraL/WMiddleweight BoutKO/TKO14:133 Rnd (5-5-5)Fernando PortellaPunch to Head At Distancehttp://ufcstats.com/fight-details/5ad8aa57c8d6...Brunno Ferreira
18UFC 283: Teixeira vs. HillThiago Moises vs. Melquizael CostaW/LLightweight BoutSubmission24:053 Rnd (5-5-5)Osiris MaiaRear Naked Chokehttp://ufcstats.com/fight-details/8cdcdfb76d16...Thiago Moises
19UFC 283: Teixeira vs. HillGabriel Bonfim vs. Mounir LazzezW/LWelterweight BoutSubmission10:493 Rnd (5-5-5)Herb DeanGuillotine Choke After Drop to Guardhttp://ufcstats.com/fight-details/7ed9e8f32584...Gabriel Bonfim
20UFC 283: Teixeira vs. HillShamil Abdurakhimov vs. Jailton AlmeidaL/WHeavyweight BoutKO/TKO22:563 Rnd (5-5-5)Fernando PortellaPunches to Head From Back Controlhttp://ufcstats.com/fight-details/fffdc5725527...Jailton Almeida
21UFC 283: Teixeira vs. HillLuan Lacerda vs. Cody StamannL/WBantamweight BoutDecision - Unanimous35:003 Rnd (5-5-5)Marc GoddardHallison Pontes 28 - 29.Derek Cleary 28 - 29.R...http://ufcstats.com/fight-details/354dc211166a...Cody Stamann
22UFC 283: Teixeira vs. HillIsmael Bonfim vs. Terrance McKinneyW/LLightweight BoutKO/TKO22:173 Rnd (5-5-5)Osiris MaiaFlying Knee Headhttp://ufcstats.com/fight-details/911b73db9173...Ismael Bonfim
23UFC 283: Teixeira vs. HillWarlley Alves vs. Nicolas DalbyL/WWelterweight BoutDecision - Split35:003 Rnd (5-5-5)Herb DeanFabio Alves 28 - 29.Derek Cleary 29 - 28.Sal D...http://ufcstats.com/fight-details/f09c3d8a2680...Nicolas Dalby
24UFC 283: Teixeira vs. HillJosiane Nunes vs. Zarah FairnW/LWomen's Featherweight BoutDecision - Unanimous35:003 Rnd (5-5-5)Marc GoddardHallison Pontes 28 - 29.Derek Cleary 28 - 29.M...http://ufcstats.com/fight-details/fcf385ae7519...Josiane Nunes
25UFC 283: Teixeira vs. HillSaimon Oliveira vs. Daniel MarcosL/WBantamweight BoutKO/TKO22:183 Rnd (5-5-5)Fernando PortellaKnees to Body At Distancehttp://ufcstats.com/fight-details/1d35e4c0941d...Daniel Marcos
26UFC Fight Night: Strickland vs. ImavovSean Strickland vs. Nassourdine ImavovW/LLight Heavyweight BoutDecision - Unanimous55:005 Rnd (5-5-5-5-5)Mark SmithDerek Cleary 46 - 49.Sal D'amato 46 - 49.Mike ...http://ufcstats.com/fight-details/868c83e734db...Sean Strickland
27UFC Fight Night: Strickland vs. ImavovDan Ige vs. Damon JacksonW/LFeatherweight BoutKO/TKO24:133 Rnd (5-5-5)Jason HerzogPunch to Head At Distancehttp://ufcstats.com/fight-details/c88a7dbe7717...Dan Ige
28UFC Fight Night: Strickland vs. ImavovPunahele Soriano vs. Roman KopylovL/WMiddleweight BoutKO/TKO23:193 Rnd (5-5-5)Kerry HatleyKick to Body At Distancehttp://ufcstats.com/fight-details/d4420be78065...Roman Kopylov
29UFC Fight Night: Strickland vs. ImavovKetlen Vieira vs. Raquel PenningtonL/WWomen's Bantamweight BoutDecision - Split35:003 Rnd (5-5-5)Chris TognoniMike Bell 28 - 29.Sal D'amato 29 - 28.Derek Cl...http://ufcstats.com/fight-details/622cc4ef4691...Raquel Pennington
\n", "
" ], "text/plain": [ " EVENT \\\n", "0 UFC Fight Night: Lewis vs. Spivac \n", "1 UFC Fight Night: Lewis vs. Spivac \n", "2 UFC Fight Night: Lewis vs. Spivac \n", "3 UFC Fight Night: Lewis vs. Spivac \n", "4 UFC Fight Night: Lewis vs. Spivac \n", "5 UFC Fight Night: Lewis vs. Spivac \n", "6 UFC Fight Night: Lewis vs. Spivac \n", "7 UFC Fight Night: Lewis vs. Spivac \n", "8 UFC Fight Night: Lewis vs. Spivac \n", "9 UFC Fight Night: Lewis vs. Spivac \n", "10 UFC Fight Night: Lewis vs. Spivac \n", "11 UFC 283: Teixeira vs. Hill \n", "12 UFC 283: Teixeira vs. Hill \n", "13 UFC 283: Teixeira vs. Hill \n", "14 UFC 283: Teixeira vs. Hill \n", "15 UFC 283: Teixeira vs. Hill \n", "16 UFC 283: Teixeira vs. Hill \n", "17 UFC 283: Teixeira vs. Hill \n", "18 UFC 283: Teixeira vs. Hill \n", "19 UFC 283: Teixeira vs. Hill \n", "20 UFC 283: Teixeira vs. Hill \n", "21 UFC 283: Teixeira vs. Hill \n", "22 UFC 283: Teixeira vs. Hill \n", "23 UFC 283: Teixeira vs. Hill \n", "24 UFC 283: Teixeira vs. Hill \n", "25 UFC 283: Teixeira vs. Hill \n", "26 UFC Fight Night: Strickland vs. Imavov \n", "27 UFC Fight Night: Strickland vs. Imavov \n", "28 UFC Fight Night: Strickland vs. Imavov \n", "29 UFC Fight Night: Strickland vs. Imavov \n", "\n", " BOUT OUTCOME \\\n", "0 Derrick Lewis vs. Serghei Spivac L/W \n", "1 Da Woon Jung vs. Devin Clark L/W \n", "2 Marcin Tybura vs. Blagoy Ivanov W/L \n", "3 Dooho Choi vs. Kyle Nelson D/D \n", "4 Yusaku Kinoshita vs. Adam Fugitt L/W \n", "5 Jeka Saragih vs. Anshul Jubli L/W \n", "6 JeongYeong Lee vs. Yi Zha W/L \n", "7 Toshiomi Kazama vs. Rinya Nakamura L/W \n", "8 SeungGuk Choi vs. HyunSung Park L/W \n", "9 JunYong Park vs. Denis Tiuliulin W/L \n", "10 Tatsuro Taira vs. Jesus Aguilar W/L \n", "11 Glover Teixeira vs. Jamahal Hill L/W \n", "12 Deiveson Figueiredo vs. Brandon Moreno L/W \n", "13 Gilbert Burns vs. Neil Magny W/L \n", "14 Lauren Murphy vs. Jessica Andrade L/W \n", "15 Paul Craig vs. Johnny Walker L/W \n", "16 Mauricio Rua vs. Ihor Potieria L/W \n", "17 Gregory Rodrigues vs. Brunno Ferreira L/W \n", "18 Thiago Moises vs. Melquizael Costa W/L \n", "19 Gabriel Bonfim vs. Mounir Lazzez W/L \n", "20 Shamil Abdurakhimov vs. Jailton Almeida L/W \n", "21 Luan Lacerda vs. Cody Stamann L/W \n", "22 Ismael Bonfim vs. Terrance McKinney W/L \n", "23 Warlley Alves vs. Nicolas Dalby L/W \n", "24 Josiane Nunes vs. Zarah Fairn W/L \n", "25 Saimon Oliveira vs. Daniel Marcos L/W \n", "26 Sean Strickland vs. Nassourdine Imavov W/L \n", "27 Dan Ige vs. Damon Jackson W/L \n", "28 Punahele Soriano vs. Roman Kopylov L/W \n", "29 Ketlen Vieira vs. Raquel Pennington L/W \n", "\n", " WEIGHTCLASS METHOD ROUND TIME \\\n", "0 Heavyweight Bout Submission 1 3:05 \n", "1 Light Heavyweight Bout Decision - Unanimous 3 5:00 \n", "2 Heavyweight Bout Decision - Unanimous 3 5:00 \n", "3 Featherweight Bout Decision - Majority 3 5:00 \n", "4 Welterweight Bout KO/TKO 1 4:36 \n", "5 Lightweight Bout KO/TKO 2 3:44 \n", "6 Featherweight Bout Decision - Split 3 5:00 \n", "7 Bantamweight Bout KO/TKO 1 0:33 \n", "8 Flyweight Bout Submission 3 3:11 \n", "9 Middleweight Bout Submission 1 4:05 \n", "10 Flyweight Bout Submission 1 4:20 \n", "11 UFC Light Heavyweight Title Bout Decision - Unanimous 5 5:00 \n", "12 UFC Flyweight Title Bout TKO - Doctor's Stoppage 3 5:00 \n", "13 Welterweight Bout Submission 1 4:15 \n", "14 Women's Flyweight Bout Decision - Unanimous 3 5:00 \n", "15 Light Heavyweight Bout KO/TKO 1 2:16 \n", "16 Light Heavyweight Bout KO/TKO 1 4:05 \n", "17 Middleweight Bout KO/TKO 1 4:13 \n", "18 Lightweight Bout Submission 2 4:05 \n", "19 Welterweight Bout Submission 1 0:49 \n", "20 Heavyweight Bout KO/TKO 2 2:56 \n", "21 Bantamweight Bout Decision - Unanimous 3 5:00 \n", "22 Lightweight Bout KO/TKO 2 2:17 \n", "23 Welterweight Bout Decision - Split 3 5:00 \n", "24 Women's Featherweight Bout Decision - Unanimous 3 5:00 \n", "25 Bantamweight Bout KO/TKO 2 2:18 \n", "26 Light Heavyweight Bout Decision - Unanimous 5 5:00 \n", "27 Featherweight Bout KO/TKO 2 4:13 \n", "28 Middleweight Bout KO/TKO 2 3:19 \n", "29 Women's Bantamweight Bout Decision - Split 3 5:00 \n", "\n", " TIME FORMAT REFEREE \\\n", "0 5 Rnd (5-5-5-5-5) Marc Goddard \n", "1 3 Rnd (5-5-5) Keith Peterson \n", "2 3 Rnd (5-5-5) Mark Smith \n", "3 3 Rnd (5-5-5) Chris Tognoni \n", "4 3 Rnd (5-5-5) Keith Peterson \n", "5 3 Rnd + OT (5-5-5-5) Marc Goddard \n", "6 3 Rnd + OT (5-5-5-5) Mark Smith \n", "7 3 Rnd + OT (5-5-5-5) Keith Peterson \n", "8 3 Rnd + OT (5-5-5-5) Marc Goddard \n", "9 3 Rnd (5-5-5) Mark Smith \n", "10 3 Rnd (5-5-5) Chris Tognoni \n", "11 5 Rnd (5-5-5-5-5) Marc Goddard \n", "12 5 Rnd (5-5-5-5-5) Herb Dean \n", "13 3 Rnd (5-5-5) Fernando Portella \n", "14 3 Rnd (5-5-5) Osiris Maia \n", "15 3 Rnd (5-5-5) Herb Dean \n", "16 3 Rnd (5-5-5) Herb Dean \n", "17 3 Rnd (5-5-5) Fernando Portella \n", "18 3 Rnd (5-5-5) Osiris Maia \n", "19 3 Rnd (5-5-5) Herb Dean \n", "20 3 Rnd (5-5-5) Fernando Portella \n", "21 3 Rnd (5-5-5) Marc Goddard \n", "22 3 Rnd (5-5-5) Osiris Maia \n", "23 3 Rnd (5-5-5) Herb Dean \n", "24 3 Rnd (5-5-5) Marc Goddard \n", "25 3 Rnd (5-5-5) Fernando Portella \n", "26 5 Rnd (5-5-5-5-5) Mark Smith \n", "27 3 Rnd (5-5-5) Jason Herzog \n", "28 3 Rnd (5-5-5) Kerry Hatley \n", "29 3 Rnd (5-5-5) Chris Tognoni \n", "\n", " DETAILS \\\n", "0 Arm Triangle On Ground \n", "1 Eric Colon 27 - 30.Chris Lee 27 - 30.David Let... \n", "2 Junichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29... \n", "3 Adalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris... \n", "4 Elbows to Head From Mount \n", "5 Elbows to Head From Mount \n", "6 Jacob Montalvo 30 - 27.David Lethaby 28 - 29.J... \n", "7 Punch to Head At Distance \n", "8 Rear Naked Choke \n", "9 Rear Naked Choke \n", "10 Triangle Armbar From Bottom Guard \n", "11 Fabio Alves 44 - 50.Derek Cleary 44 - 50.Sal D... \n", "12 Eye Injury \n", "13 Arm Triangle From Mount \n", "14 Rafael Ferreira 25 - 30.Fabio Alves 25 - 30.Sa... \n", "15 Punches to Head In Clinch \n", "16 Punches to Head At Distance \n", "17 Punch to Head At Distance \n", "18 Rear Naked Choke \n", "19 Guillotine Choke After Drop to Guard \n", "20 Punches to Head From Back Control \n", "21 Hallison Pontes 28 - 29.Derek Cleary 28 - 29.R... \n", "22 Flying Knee Head \n", "23 Fabio Alves 28 - 29.Derek Cleary 29 - 28.Sal D... \n", "24 Hallison Pontes 28 - 29.Derek Cleary 28 - 29.M... \n", "25 Knees to Body At Distance \n", "26 Derek Cleary 46 - 49.Sal D'amato 46 - 49.Mike ... \n", "27 Punch to Head At Distance \n", "28 Kick to Body At Distance \n", "29 Mike Bell 28 - 29.Sal D'amato 29 - 28.Derek Cl... \n", "\n", " URL Winner \n", "0 http://ufcstats.com/fight-details/caeeb398f73d... Serghei Spivac \n", "1 http://ufcstats.com/fight-details/7a1abc0230af... Devin Clark \n", "2 http://ufcstats.com/fight-details/8741e6a3a5a2... Marcin Tybura \n", "3 http://ufcstats.com/fight-details/01e886808600... DRAW \n", "4 http://ufcstats.com/fight-details/c63d8062c89c... Adam Fugitt \n", "5 http://ufcstats.com/fight-details/b1b20c686dfe... Anshul Jubli \n", "6 http://ufcstats.com/fight-details/765482eb58e8... JeongYeong Lee \n", "7 http://ufcstats.com/fight-details/a8067e65eb73... Rinya Nakamura \n", "8 http://ufcstats.com/fight-details/98094a500529... HyunSung Park \n", "9 http://ufcstats.com/fight-details/983fab408074... JunYong Park \n", "10 http://ufcstats.com/fight-details/a26ca06cce40... Tatsuro Taira \n", "11 http://ufcstats.com/fight-details/dde7d29cc443... Jamahal Hill \n", "12 http://ufcstats.com/fight-details/0462bcc27498... Brandon Moreno \n", "13 http://ufcstats.com/fight-details/1c51f405e5c4... Gilbert Burns \n", "14 http://ufcstats.com/fight-details/022198293028... Jessica Andrade \n", "15 http://ufcstats.com/fight-details/2d1ac675e6c1... Johnny Walker \n", "16 http://ufcstats.com/fight-details/a3ef3d05ddd8... Ihor Potieria \n", "17 http://ufcstats.com/fight-details/5ad8aa57c8d6... Brunno Ferreira \n", "18 http://ufcstats.com/fight-details/8cdcdfb76d16... Thiago Moises \n", "19 http://ufcstats.com/fight-details/7ed9e8f32584... Gabriel Bonfim \n", "20 http://ufcstats.com/fight-details/fffdc5725527... Jailton Almeida \n", "21 http://ufcstats.com/fight-details/354dc211166a... Cody Stamann \n", "22 http://ufcstats.com/fight-details/911b73db9173... Ismael Bonfim \n", "23 http://ufcstats.com/fight-details/f09c3d8a2680... Nicolas Dalby \n", "24 http://ufcstats.com/fight-details/fcf385ae7519... Josiane Nunes \n", "25 http://ufcstats.com/fight-details/1d35e4c0941d... Daniel Marcos \n", "26 http://ufcstats.com/fight-details/868c83e734db... Sean Strickland \n", "27 http://ufcstats.com/fight-details/c88a7dbe7717... Dan Ige \n", "28 http://ufcstats.com/fight-details/d4420be78065... Roman Kopylov \n", "29 http://ufcstats.com/fight-details/622cc4ef4691... Raquel Pennington " ] }, "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results.head(30)" ] }, { "cell_type": "code", "execution_count": 74, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "3ua06NS4RMSe", "outputId": "5706b411-50b8-4bb0-ca58-7caf5aec3e1a" }, "outputs": [ { "data": { "text/plain": [ "TIME FORMAT\n", "3 Rnd (5-5-5) 6104\n", "5 Rnd (5-5-5-5-5) 601\n", "1 Rnd + OT (12-3) 88\n", "No Time Limit 31\n", "3 Rnd + OT (5-5-5-5) 30\n", "1 Rnd (20) 25\n", "1 Rnd + 2OT (15-3-3) 20\n", "2 Rnd (5-5) 14\n", "1 Rnd (15) 12\n", "1 Rnd (10) 7\n", "1 Rnd (12) 6\n", "1 Rnd + OT (30-5) 3\n", "1 Rnd (18) 2\n", "1 Rnd + OT (15-3) 2\n", "1 Rnd + OT (27-3) 1\n", "1 Rnd + OT (30-3) 1\n", "1 Rnd + OT (31-5) 1\n", "1 Rnd + 2OT (24-3-3) 1\n", "1 Rnd (30) 1\n", "Name: TIME FORMAT, dtype: int64" ] }, "execution_count": 74, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results.groupby('TIME FORMAT')['TIME FORMAT'].count().sort_values(ascending=False).head(50)" ] }, { "cell_type": "code", "execution_count": 75, "metadata": { "id": "EOA91w-4SQiK" }, "outputs": [], "source": [ "WEIGHTCLASSES_my = ['Lightweight', 'Welterweight', 'Middleweight', 'Featherweight','Heavyweigh', 'Light Heavyweight', 'Bantamweight', 'Flyweight', 'Strawweight', 'Open Weight', 'Catch Weight']" ] }, { "cell_type": "code", "execution_count": 76, "metadata": { "id": "UyM8t6hLS4qL" }, "outputs": [], "source": [ "WeightClasses_df = df_results['WEIGHTCLASS']" ] }, { "cell_type": "code", "execution_count": 77, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "CaUWWgc7TF01", "outputId": "f9541a5d-fc66-44a3-9cfa-2b84c85377c2" }, "outputs": [ { "data": { "text/plain": [ "0 Heavyweight Bout\n", "1 Light Heavyweight Bout\n", "2 Heavyweight Bout\n", "3 Featherweight Bout\n", "4 Welterweight Bout\n", " ... \n", "6945 Open Weight Bout\n", "6946 Open Weight Bout\n", "6947 Open Weight Bout\n", "6948 Open Weight Bout\n", "6949 Open Weight Bout\n", "Name: WEIGHTCLASS, Length: 6950, dtype: object" ] }, "execution_count": 77, "metadata": {}, "output_type": "execute_result" } ], "source": [ "WeightClasses_df" ] }, { "cell_type": "code", "execution_count": 78, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "kFnd3zL3TJQU", "outputId": "4b6a61a3-d07b-4fd6-ffcf-040921217d79" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Catch Weight Ultimate Ultimate '96 Tournament Title Bout\n", "Catch Weight UFC 10 Tournament Title Bout\n", "Catch Weight UFC Superfight Championship Bout\n", "Catch Weight UFC 8 Tournament Title Bout\n", "Catch Weight UFC Superfight Championship Bout\n", "Catch Weight Ultimate Ultimate '95 Tournament Title Bout\n", "Catch Weight UFC 7 Tournament Title Bout\n", "Catch Weight UFC Superfight Championship Bout\n", "Catch Weight UFC 6 Tournament Title Bout\n", "Catch Weight UFC Superfight Championship Bout\n", "Catch Weight UFC 5 Tournament Title Bout\n", "Catch Weight UFC Superfight Championship Bout\n", "Catch Weight UFC 4 Tournament Title Bout\n", "Catch Weight UFC 3 Tournament Title Bout\n", "Catch Weight UFC 2 Tournament Title Bout\n" ] } ], "source": [ "result=[]\n", "women = []\n", "Title = []\n", "for bout in WeightClasses_df:\n", " bout_low = bout.lower()\n", " women.append(1) if 'women' in bout_low else women.append(0)\n", " Title.append(1) if 'title' in bout_low else Title.append(0)\n", " find = False\n", " for classes in WEIGHTCLASSES_my: \n", " if classes.lower() in bout_low.lower():\n", " result.append(classes)\n", " find = True \n", " break\n", " if not find:\n", " result.append('Open Weight')\n", " print(classes, bout)" ] }, { "cell_type": "code", "execution_count": 79, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "TA7__qV0TqcI", "outputId": "1aec9c22-8db4-48cf-d6a4-99ef408c0d40" }, "outputs": [ { "data": { "text/plain": [ "['Heavyweigh',\n", " 'Heavyweigh',\n", " 'Heavyweigh',\n", " 'Featherweight',\n", " 'Welterweight',\n", " 'Lightweight',\n", " 'Featherweight',\n", " 'Bantamweight',\n", " 'Flyweight',\n", " 'Middleweight']" ] }, "execution_count": 79, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result[:10]" ] }, { "cell_type": "code", "execution_count": 80, "metadata": { "id": "qRQU0vOEWN-T" }, "outputs": [], "source": [ "df_results.loc[:,\"WeightClass\"] = result\n", "df_results.loc[:,\"Tittle\"] = Title\n", "df_results.loc[:,\"Women_fight\"] = women\n" ] }, { "cell_type": "code", "execution_count": 81, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 354 }, "id": "2OJupg7AWWdg", "outputId": "90e6f3ff-27a5-4229-f4f6-f11cbac95719" }, "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", " \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", "
EVENTBOUTOUTCOMEWEIGHTCLASSMETHODROUNDTIMETIME FORMATREFEREEDETAILSURLWinnerWeightClassTittleWomen_fight
6945UFC 2: No Way OutOrlando Wiet vs. Robert LucarelliW/LOpen Weight BoutKO/TKO12:50No Time LimitJohn McCarthytoCorner Stoppagehttp://ufcstats.com/fight-details/3b020d4914b4...Orlando WietOpen Weight00
6946UFC 2: No Way OutFrank Hamaker vs. Thaddeus LusterW/LOpen Weight BoutSubmission14:52No Time LimitJohn McCarthyKeylock From Half Guardhttp://ufcstats.com/fight-details/d917c8c7461b...Frank HamakerOpen Weight00
6947UFC 2: No Way OutJohnny Rhodes vs. David LevickiW/LOpen Weight BoutKO/TKO112:13No Time LimitJohn McCarthyPunches to Head From GuardSubmission to Strikeshttp://ufcstats.com/fight-details/ccee020be2e8...Johnny RhodesOpen Weight00
6948UFC 2: No Way OutPatrick Smith vs. Ray WizardW/LOpen Weight BoutSubmission10:58No Time LimitJohn McCarthyGuillotine Choke Standinghttp://ufcstats.com/fight-details/4b9ae533ccb3...Patrick SmithOpen Weight00
6949UFC 2: No Way OutScott Morris vs. Sean DaughertyW/LOpen Weight BoutSubmission10:20No Time LimitJohn McCarthyGuillotine Choke From Mounthttp://ufcstats.com/fight-details/4acab67848e7...Scott MorrisOpen Weight00
\n", "
" ], "text/plain": [ " EVENT BOUT OUTCOME \\\n", "6945 UFC 2: No Way Out Orlando Wiet vs. Robert Lucarelli W/L \n", "6946 UFC 2: No Way Out Frank Hamaker vs. Thaddeus Luster W/L \n", "6947 UFC 2: No Way Out Johnny Rhodes vs. David Levicki W/L \n", "6948 UFC 2: No Way Out Patrick Smith vs. Ray Wizard W/L \n", "6949 UFC 2: No Way Out Scott Morris vs. Sean Daugherty W/L \n", "\n", " WEIGHTCLASS METHOD ROUND TIME TIME FORMAT \\\n", "6945 Open Weight Bout KO/TKO 1 2:50 No Time Limit \n", "6946 Open Weight Bout Submission 1 4:52 No Time Limit \n", "6947 Open Weight Bout KO/TKO 1 12:13 No Time Limit \n", "6948 Open Weight Bout Submission 1 0:58 No Time Limit \n", "6949 Open Weight Bout Submission 1 0:20 No Time Limit \n", "\n", " REFEREE DETAILS \\\n", "6945 John McCarthy toCorner Stoppage \n", "6946 John McCarthy Keylock From Half Guard \n", "6947 John McCarthy Punches to Head From GuardSubmission to Strikes \n", "6948 John McCarthy Guillotine Choke Standing \n", "6949 John McCarthy Guillotine Choke From Mount \n", "\n", " URL Winner \\\n", "6945 http://ufcstats.com/fight-details/3b020d4914b4... Orlando Wiet \n", "6946 http://ufcstats.com/fight-details/d917c8c7461b... Frank Hamaker \n", "6947 http://ufcstats.com/fight-details/ccee020be2e8... Johnny Rhodes \n", "6948 http://ufcstats.com/fight-details/4b9ae533ccb3... Patrick Smith \n", "6949 http://ufcstats.com/fight-details/4acab67848e7... Scott Morris \n", "\n", " WeightClass Tittle Women_fight \n", "6945 Open Weight 0 0 \n", "6946 Open Weight 0 0 \n", "6947 Open Weight 0 0 \n", "6948 Open Weight 0 0 \n", "6949 Open Weight 0 0 " ] }, "execution_count": 81, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results.tail()" ] }, { "cell_type": "code", "execution_count": 82, "metadata": { "id": "WukUisXsYZMK" }, "outputs": [], "source": [ "df_results['TimeSec'] = df_results['TIME'].apply(lambda x: (datetime.strptime(x, '%M:%S') - datetime(1900,1,1)).total_seconds()).astype(int)" ] }, { "cell_type": "code", "execution_count": 83, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "A0cs8C01WdF2", "outputId": "8de87ad5-3841-41b2-e141-fa401fe8ea7c" }, "outputs": [ { "data": { "text/plain": [ "TIME FORMAT\n", "3 Rnd (5-5-5) 6104\n", "5 Rnd (5-5-5-5-5) 601\n", "1 Rnd + OT (12-3) 88\n", "No Time Limit 31\n", "3 Rnd + OT (5-5-5-5) 30\n", "1 Rnd (20) 25\n", "1 Rnd + 2OT (15-3-3) 20\n", "2 Rnd (5-5) 14\n", "1 Rnd (15) 12\n", "1 Rnd (10) 7\n", "1 Rnd (12) 6\n", "1 Rnd + OT (30-5) 3\n", "1 Rnd (18) 2\n", "1 Rnd + OT (15-3) 2\n", "1 Rnd + OT (27-3) 1\n", "1 Rnd + OT (30-3) 1\n", "1 Rnd + OT (31-5) 1\n", "1 Rnd + 2OT (24-3-3) 1\n", "1 Rnd (30) 1\n", "Name: TIME FORMAT, dtype: int64" ] }, "execution_count": 83, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results.groupby('TIME FORMAT')['TIME FORMAT'].count().sort_values(ascending=False).head(50)" ] }, { "cell_type": "code", "execution_count": 84, "metadata": { "id": "WxNiV-4tX9p3" }, "outputs": [], "source": [ "import re\n", "def extract_rounds(text):\n", " if text == \"No Time Limit\":\n", " return [0]\n", " else:\n", " result = re.findall(r'\\((.*?)\\)', text)\n", " result = list(map(int,result[0].split(\"-\")))\n", " return result" ] }, { "cell_type": "code", "execution_count": 85, "metadata": { "id": "sDDuLfJlY9kr" }, "outputs": [], "source": [ "df_results['TIME FORMAT'] = df_results['TIME FORMAT'].apply(lambda x: extract_rounds(x))" ] }, { "cell_type": "code", "execution_count": 86, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 780 }, "id": "SFD4aBS55vHQ", "outputId": "8b5a9730-e8ee-43a4-a3c0-100e1e1ecbc8" }, "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", " \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", " \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", "
EVENTBOUTOUTCOMEWEIGHTCLASSMETHODROUNDTIMETIME FORMATREFEREEDETAILSURLWinnerWeightClassTittleWomen_fightTimeSec
0UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacL/WHeavyweight BoutSubmission13:05[5, 5, 5, 5, 5]Marc GoddardArm Triangle On Groundhttp://ufcstats.com/fight-details/caeeb398f73d...Serghei SpivacHeavyweigh00185
1UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkL/WLight Heavyweight BoutDecision - Unanimous35:00[5, 5, 5]Keith PetersonEric Colon 27 - 30.Chris Lee 27 - 30.David Let...http://ufcstats.com/fight-details/7a1abc0230af...Devin ClarkHeavyweigh00300
2UFC Fight Night: Lewis vs. SpivacMarcin Tybura vs. Blagoy IvanovW/LHeavyweight BoutDecision - Unanimous35:00[5, 5, 5]Mark SmithJunichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29...http://ufcstats.com/fight-details/8741e6a3a5a2...Marcin TyburaHeavyweigh00300
3UFC Fight Night: Lewis vs. SpivacDooho Choi vs. Kyle NelsonD/DFeatherweight BoutDecision - Majority35:00[5, 5, 5]Chris TognoniAdalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris...http://ufcstats.com/fight-details/01e886808600...DRAWFeatherweight00300
4UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittL/WWelterweight BoutKO/TKO14:36[5, 5, 5]Keith PetersonElbows to Head From Mounthttp://ufcstats.com/fight-details/c63d8062c89c...Adam FugittWelterweight00276
...................................................
6945UFC 2: No Way OutOrlando Wiet vs. Robert LucarelliW/LOpen Weight BoutKO/TKO12:50[0]John McCarthytoCorner Stoppagehttp://ufcstats.com/fight-details/3b020d4914b4...Orlando WietOpen Weight00170
6946UFC 2: No Way OutFrank Hamaker vs. Thaddeus LusterW/LOpen Weight BoutSubmission14:52[0]John McCarthyKeylock From Half Guardhttp://ufcstats.com/fight-details/d917c8c7461b...Frank HamakerOpen Weight00292
6947UFC 2: No Way OutJohnny Rhodes vs. David LevickiW/LOpen Weight BoutKO/TKO112:13[0]John McCarthyPunches to Head From GuardSubmission to Strikeshttp://ufcstats.com/fight-details/ccee020be2e8...Johnny RhodesOpen Weight00733
6948UFC 2: No Way OutPatrick Smith vs. Ray WizardW/LOpen Weight BoutSubmission10:58[0]John McCarthyGuillotine Choke Standinghttp://ufcstats.com/fight-details/4b9ae533ccb3...Patrick SmithOpen Weight0058
6949UFC 2: No Way OutScott Morris vs. Sean DaughertyW/LOpen Weight BoutSubmission10:20[0]John McCarthyGuillotine Choke From Mounthttp://ufcstats.com/fight-details/4acab67848e7...Scott MorrisOpen Weight0020
\n", "

6950 rows × 16 columns

\n", "
" ], "text/plain": [ " EVENT BOUT \\\n", "0 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "1 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "2 UFC Fight Night: Lewis vs. Spivac Marcin Tybura vs. Blagoy Ivanov \n", "3 UFC Fight Night: Lewis vs. Spivac Dooho Choi vs. Kyle Nelson \n", "4 UFC Fight Night: Lewis vs. Spivac Yusaku Kinoshita vs. Adam Fugitt \n", "... ... ... \n", "6945 UFC 2: No Way Out Orlando Wiet vs. Robert Lucarelli \n", "6946 UFC 2: No Way Out Frank Hamaker vs. Thaddeus Luster \n", "6947 UFC 2: No Way Out Johnny Rhodes vs. David Levicki \n", "6948 UFC 2: No Way Out Patrick Smith vs. Ray Wizard \n", "6949 UFC 2: No Way Out Scott Morris vs. Sean Daugherty \n", "\n", " OUTCOME WEIGHTCLASS METHOD ROUND TIME \\\n", "0 L/W Heavyweight Bout Submission 1 3:05 \n", "1 L/W Light Heavyweight Bout Decision - Unanimous 3 5:00 \n", "2 W/L Heavyweight Bout Decision - Unanimous 3 5:00 \n", "3 D/D Featherweight Bout Decision - Majority 3 5:00 \n", "4 L/W Welterweight Bout KO/TKO 1 4:36 \n", "... ... ... ... ... ... \n", "6945 W/L Open Weight Bout KO/TKO 1 2:50 \n", "6946 W/L Open Weight Bout Submission 1 4:52 \n", "6947 W/L Open Weight Bout KO/TKO 1 12:13 \n", "6948 W/L Open Weight Bout Submission 1 0:58 \n", "6949 W/L Open Weight Bout Submission 1 0:20 \n", "\n", " TIME FORMAT REFEREE \\\n", "0 [5, 5, 5, 5, 5] Marc Goddard \n", "1 [5, 5, 5] Keith Peterson \n", "2 [5, 5, 5] Mark Smith \n", "3 [5, 5, 5] Chris Tognoni \n", "4 [5, 5, 5] Keith Peterson \n", "... ... ... \n", "6945 [0] John McCarthy \n", "6946 [0] John McCarthy \n", "6947 [0] John McCarthy \n", "6948 [0] John McCarthy \n", "6949 [0] John McCarthy \n", "\n", " DETAILS \\\n", "0 Arm Triangle On Ground \n", "1 Eric Colon 27 - 30.Chris Lee 27 - 30.David Let... \n", "2 Junichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29... \n", "3 Adalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris... \n", "4 Elbows to Head From Mount \n", "... ... \n", "6945 toCorner Stoppage \n", "6946 Keylock From Half Guard \n", "6947 Punches to Head From GuardSubmission to Strikes \n", "6948 Guillotine Choke Standing \n", "6949 Guillotine Choke From Mount \n", "\n", " URL Winner \\\n", "0 http://ufcstats.com/fight-details/caeeb398f73d... Serghei Spivac \n", "1 http://ufcstats.com/fight-details/7a1abc0230af... Devin Clark \n", "2 http://ufcstats.com/fight-details/8741e6a3a5a2... Marcin Tybura \n", "3 http://ufcstats.com/fight-details/01e886808600... DRAW \n", "4 http://ufcstats.com/fight-details/c63d8062c89c... Adam Fugitt \n", "... ... ... \n", "6945 http://ufcstats.com/fight-details/3b020d4914b4... Orlando Wiet \n", "6946 http://ufcstats.com/fight-details/d917c8c7461b... Frank Hamaker \n", "6947 http://ufcstats.com/fight-details/ccee020be2e8... Johnny Rhodes \n", "6948 http://ufcstats.com/fight-details/4b9ae533ccb3... Patrick Smith \n", "6949 http://ufcstats.com/fight-details/4acab67848e7... Scott Morris \n", "\n", " WeightClass Tittle Women_fight TimeSec \n", "0 Heavyweigh 0 0 185 \n", "1 Heavyweigh 0 0 300 \n", "2 Heavyweigh 0 0 300 \n", "3 Featherweight 0 0 300 \n", "4 Welterweight 0 0 276 \n", "... ... ... ... ... \n", "6945 Open Weight 0 0 170 \n", "6946 Open Weight 0 0 292 \n", "6947 Open Weight 0 0 733 \n", "6948 Open Weight 0 0 58 \n", "6949 Open Weight 0 0 20 \n", "\n", "[6950 rows x 16 columns]" ] }, "execution_count": 86, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results" ] }, { "cell_type": "code", "execution_count": 87, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "fG2SJJVZZM3c", "outputId": "a36e7d7d-45af-4739-9158-4196e5b65853" }, "outputs": [ { "data": { "text/plain": [ "0 [5, 5, 5, 5, 5]\n", "1 [5, 5, 5]\n", "2 [5, 5, 5]\n", "3 [5, 5, 5]\n", "4 [5, 5, 5]\n", " ... \n", "6945 [0]\n", "6946 [0]\n", "6947 [0]\n", "6948 [0]\n", "6949 [0]\n", "Name: TIME FORMAT, Length: 6950, dtype: object" ] }, "execution_count": 87, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results['TIME FORMAT']" ] }, { "cell_type": "code", "execution_count": 88, "metadata": { "id": "LxvXjC-u4Ctj" }, "outputs": [], "source": [ "df_results['TotalTime'] = df_results.apply(lambda row: sum(row['TIME FORMAT'][0:int(row['ROUND'])-1])*60 + row['TimeSec'],axis=1)" ] }, { "cell_type": "code", "execution_count": 89, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "iCKGXl1a5DQg", "outputId": "ec256aeb-620e-4514-8725-11d514c4703d" }, "outputs": [ { "data": { "text/plain": [ "array([1, 3, 2, 5, 4], dtype=int64)" ] }, "execution_count": 89, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results['ROUND'].unique()" ] }, { "cell_type": "code", "execution_count": 90, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "kSWqKbFvNNUh", "outputId": "318337a7-fbf1-47d6-9a6b-32935252df14" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 6950 entries, 0 to 6949\n", "Data columns (total 17 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 6950 non-null object\n", " 1 BOUT 6950 non-null object\n", " 2 OUTCOME 6950 non-null object\n", " 3 WEIGHTCLASS 6950 non-null object\n", " 4 METHOD 6950 non-null object\n", " 5 ROUND 6950 non-null int64 \n", " 6 TIME 6950 non-null object\n", " 7 TIME FORMAT 6950 non-null object\n", " 8 REFEREE 6918 non-null object\n", " 9 DETAILS 6877 non-null object\n", " 10 URL 6950 non-null object\n", " 11 Winner 6950 non-null object\n", " 12 WeightClass 6950 non-null object\n", " 13 Tittle 6950 non-null int64 \n", " 14 Women_fight 6950 non-null int64 \n", " 15 TimeSec 6950 non-null int32 \n", " 16 TotalTime 6950 non-null int64 \n", "dtypes: int32(1), int64(4), object(12)\n", "memory usage: 896.0+ KB\n" ] } ], "source": [ "df_results.info()" ] }, { "cell_type": "code", "execution_count": 91, "metadata": { "id": "42YyodllPiBT" }, "outputs": [], "source": [ "df_results = df_results.drop(['OUTCOME','WEIGHTCLASS','TimeSec'],axis=1)" ] }, { "cell_type": "code", "execution_count": 92, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "8-BQVFWfQqpr", "outputId": "14bd3748-087d-4056-eda8-e69f45c0e88b" }, "outputs": [ { "data": { "text/plain": [ "Index(['EVENT', 'BOUT', 'METHOD', 'ROUND', 'TIME', 'TIME FORMAT', 'REFEREE',\n", " 'DETAILS', 'URL', 'Winner', 'WeightClass', 'Tittle', 'Women_fight',\n", " 'TotalTime'],\n", " dtype='object')" ] }, "execution_count": 92, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results.columns" ] }, { "cell_type": "code", "execution_count": 93, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "ONBh2JyZ2HaL", "outputId": "8c8d828e-af6e-488f-f5eb-b02747aee33c" }, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EVENTURLDATELOCATION
0UFC Fight Night: Lewis vs. Spivachttp://ufcstats.com/event-details/d26394fc0e8e...February 04, 2023Las Vegas, Nevada, USA
1UFC 283: Teixeira vs. Hillhttp://ufcstats.com/event-details/5717efc6f271...January 21, 2023Rio de Janeiro, Rio de Janeiro, Brazil
2UFC Fight Night: Strickland vs. Imavovhttp://ufcstats.com/event-details/2e2cdb6e9eb8...January 14, 2023Las Vegas, Nevada, USA
3UFC Fight Night: Cannonier vs. Stricklandhttp://ufcstats.com/event-details/56ec58954158...December 17, 2022Las Vegas, Nevada, USA
4UFC 282: Blachowicz vs. Ankalaevhttp://ufcstats.com/event-details/f65a0eb902f9...December 10, 2022Las Vegas, Nevada, USA
...............
628UFC 6: Clash of the Titanshttp://ufcstats.com/event-details/1c3f5e85b59e...July 14, 1995Casper, Wyoming, USA
629UFC 5: The Return of the Beasthttp://ufcstats.com/event-details/dedc3bb440d0...April 07, 1995Charlotte, North Carolina, USA
630UFC 4: Revenge of the Warriorshttp://ufcstats.com/event-details/b60391da771d...December 16, 1994Tulsa, Oklahoma, USA
631UFC 3: The American Dreamhttp://ufcstats.com/event-details/1a49e0670dfa...September 09, 1994Charlotte, North Carolina, USA
632UFC 2: No Way Outhttp://ufcstats.com/event-details/a6a9ab5a824e...March 11, 1994Denver, Colorado, USA
\n", "

633 rows × 4 columns

\n", "
" ], "text/plain": [ " EVENT \\\n", "0 UFC Fight Night: Lewis vs. Spivac \n", "1 UFC 283: Teixeira vs. Hill \n", "2 UFC Fight Night: Strickland vs. Imavov \n", "3 UFC Fight Night: Cannonier vs. Strickland \n", "4 UFC 282: Blachowicz vs. Ankalaev \n", ".. ... \n", "628 UFC 6: Clash of the Titans \n", "629 UFC 5: The Return of the Beast \n", "630 UFC 4: Revenge of the Warriors \n", "631 UFC 3: The American Dream \n", "632 UFC 2: No Way Out \n", "\n", " URL DATE \\\n", "0 http://ufcstats.com/event-details/d26394fc0e8e... February 04, 2023 \n", "1 http://ufcstats.com/event-details/5717efc6f271... January 21, 2023 \n", "2 http://ufcstats.com/event-details/2e2cdb6e9eb8... January 14, 2023 \n", "3 http://ufcstats.com/event-details/56ec58954158... December 17, 2022 \n", "4 http://ufcstats.com/event-details/f65a0eb902f9... December 10, 2022 \n", ".. ... ... \n", "628 http://ufcstats.com/event-details/1c3f5e85b59e... July 14, 1995 \n", "629 http://ufcstats.com/event-details/dedc3bb440d0... April 07, 1995 \n", "630 http://ufcstats.com/event-details/b60391da771d... December 16, 1994 \n", "631 http://ufcstats.com/event-details/1a49e0670dfa... September 09, 1994 \n", "632 http://ufcstats.com/event-details/a6a9ab5a824e... March 11, 1994 \n", "\n", " LOCATION \n", "0 Las Vegas, Nevada, USA \n", "1 Rio de Janeiro, Rio de Janeiro, Brazil \n", "2 Las Vegas, Nevada, USA \n", "3 Las Vegas, Nevada, USA \n", "4 Las Vegas, Nevada, USA \n", ".. ... \n", "628 Casper, Wyoming, USA \n", "629 Charlotte, North Carolina, USA \n", "630 Tulsa, Oklahoma, USA \n", "631 Charlotte, North Carolina, USA \n", "632 Denver, Colorado, USA \n", "\n", "[633 rows x 4 columns]" ] }, "execution_count": 93, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_event_details" ] }, { "cell_type": "code", "execution_count": 94, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 659 }, "id": "KuqyGcCU2JPr", "outputId": "03679f36-4b09-47b5-f81f-ef84b8f8c856" }, "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", " \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", " \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", "
EVENTBOUTMETHODROUNDTIMETIME FORMATREFEREEDETAILSURLWinnerWeightClassTittleWomen_fightTotalTime
0UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacSubmission13:05[5, 5, 5, 5, 5]Marc GoddardArm Triangle On Groundhttp://ufcstats.com/fight-details/caeeb398f73d...Serghei SpivacHeavyweigh00185
1UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkDecision - Unanimous35:00[5, 5, 5]Keith PetersonEric Colon 27 - 30.Chris Lee 27 - 30.David Let...http://ufcstats.com/fight-details/7a1abc0230af...Devin ClarkHeavyweigh00900
2UFC Fight Night: Lewis vs. SpivacMarcin Tybura vs. Blagoy IvanovDecision - Unanimous35:00[5, 5, 5]Mark SmithJunichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29...http://ufcstats.com/fight-details/8741e6a3a5a2...Marcin TyburaHeavyweigh00900
3UFC Fight Night: Lewis vs. SpivacDooho Choi vs. Kyle NelsonDecision - Majority35:00[5, 5, 5]Chris TognoniAdalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris...http://ufcstats.com/fight-details/01e886808600...DRAWFeatherweight00900
4UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittKO/TKO14:36[5, 5, 5]Keith PetersonElbows to Head From Mounthttp://ufcstats.com/fight-details/c63d8062c89c...Adam FugittWelterweight00276
.............................................
6945UFC 2: No Way OutOrlando Wiet vs. Robert LucarelliKO/TKO12:50[0]John McCarthytoCorner Stoppagehttp://ufcstats.com/fight-details/3b020d4914b4...Orlando WietOpen Weight00170
6946UFC 2: No Way OutFrank Hamaker vs. Thaddeus LusterSubmission14:52[0]John McCarthyKeylock From Half Guardhttp://ufcstats.com/fight-details/d917c8c7461b...Frank HamakerOpen Weight00292
6947UFC 2: No Way OutJohnny Rhodes vs. David LevickiKO/TKO112:13[0]John McCarthyPunches to Head From GuardSubmission to Strikeshttp://ufcstats.com/fight-details/ccee020be2e8...Johnny RhodesOpen Weight00733
6948UFC 2: No Way OutPatrick Smith vs. Ray WizardSubmission10:58[0]John McCarthyGuillotine Choke Standinghttp://ufcstats.com/fight-details/4b9ae533ccb3...Patrick SmithOpen Weight0058
6949UFC 2: No Way OutScott Morris vs. Sean DaughertySubmission10:20[0]John McCarthyGuillotine Choke From Mounthttp://ufcstats.com/fight-details/4acab67848e7...Scott MorrisOpen Weight0020
\n", "

6950 rows × 14 columns

\n", "
" ], "text/plain": [ " EVENT BOUT \\\n", "0 UFC Fight Night: Lewis vs. Spivac Derrick Lewis vs. Serghei Spivac \n", "1 UFC Fight Night: Lewis vs. Spivac Da Woon Jung vs. Devin Clark \n", "2 UFC Fight Night: Lewis vs. Spivac Marcin Tybura vs. Blagoy Ivanov \n", "3 UFC Fight Night: Lewis vs. Spivac Dooho Choi vs. Kyle Nelson \n", "4 UFC Fight Night: Lewis vs. Spivac Yusaku Kinoshita vs. Adam Fugitt \n", "... ... ... \n", "6945 UFC 2: No Way Out Orlando Wiet vs. Robert Lucarelli \n", "6946 UFC 2: No Way Out Frank Hamaker vs. Thaddeus Luster \n", "6947 UFC 2: No Way Out Johnny Rhodes vs. David Levicki \n", "6948 UFC 2: No Way Out Patrick Smith vs. Ray Wizard \n", "6949 UFC 2: No Way Out Scott Morris vs. Sean Daugherty \n", "\n", " METHOD ROUND TIME TIME FORMAT REFEREE \\\n", "0 Submission 1 3:05 [5, 5, 5, 5, 5] Marc Goddard \n", "1 Decision - Unanimous 3 5:00 [5, 5, 5] Keith Peterson \n", "2 Decision - Unanimous 3 5:00 [5, 5, 5] Mark Smith \n", "3 Decision - Majority 3 5:00 [5, 5, 5] Chris Tognoni \n", "4 KO/TKO 1 4:36 [5, 5, 5] Keith Peterson \n", "... ... ... ... ... ... \n", "6945 KO/TKO 1 2:50 [0] John McCarthy \n", "6946 Submission 1 4:52 [0] John McCarthy \n", "6947 KO/TKO 1 12:13 [0] John McCarthy \n", "6948 Submission 1 0:58 [0] John McCarthy \n", "6949 Submission 1 0:20 [0] John McCarthy \n", "\n", " DETAILS \\\n", "0 Arm Triangle On Ground \n", "1 Eric Colon 27 - 30.Chris Lee 27 - 30.David Let... \n", "2 Junichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29... \n", "3 Adalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris... \n", "4 Elbows to Head From Mount \n", "... ... \n", "6945 toCorner Stoppage \n", "6946 Keylock From Half Guard \n", "6947 Punches to Head From GuardSubmission to Strikes \n", "6948 Guillotine Choke Standing \n", "6949 Guillotine Choke From Mount \n", "\n", " URL Winner \\\n", "0 http://ufcstats.com/fight-details/caeeb398f73d... Serghei Spivac \n", "1 http://ufcstats.com/fight-details/7a1abc0230af... Devin Clark \n", "2 http://ufcstats.com/fight-details/8741e6a3a5a2... Marcin Tybura \n", "3 http://ufcstats.com/fight-details/01e886808600... DRAW \n", "4 http://ufcstats.com/fight-details/c63d8062c89c... Adam Fugitt \n", "... ... ... \n", "6945 http://ufcstats.com/fight-details/3b020d4914b4... Orlando Wiet \n", "6946 http://ufcstats.com/fight-details/d917c8c7461b... Frank Hamaker \n", "6947 http://ufcstats.com/fight-details/ccee020be2e8... Johnny Rhodes \n", "6948 http://ufcstats.com/fight-details/4b9ae533ccb3... Patrick Smith \n", "6949 http://ufcstats.com/fight-details/4acab67848e7... Scott Morris \n", "\n", " WeightClass Tittle Women_fight TotalTime \n", "0 Heavyweigh 0 0 185 \n", "1 Heavyweigh 0 0 900 \n", "2 Heavyweigh 0 0 900 \n", "3 Featherweight 0 0 900 \n", "4 Welterweight 0 0 276 \n", "... ... ... ... ... \n", "6945 Open Weight 0 0 170 \n", "6946 Open Weight 0 0 292 \n", "6947 Open Weight 0 0 733 \n", "6948 Open Weight 0 0 58 \n", "6949 Open Weight 0 0 20 \n", "\n", "[6950 rows x 14 columns]" ] }, "execution_count": 94, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results" ] }, { "cell_type": "code", "execution_count": 95, "metadata": { "id": "_rHDTh2p_UUf" }, "outputs": [], "source": [ "df_results['BOUT'] = df_results['BOUT'].str.split().str.join(' ')\n", "df_results['EVENT'] = df_results['EVENT'].str.split().str.join(' ')" ] }, { "cell_type": "code", "execution_count": 96, "metadata": { "id": "gDnCioPy2Gq-" }, "outputs": [], "source": [ "df_results = df_results.merge(df_event_details[['EVENT','DATE']],how='left', left_on='EVENT', right_on='EVENT')" ] }, { "cell_type": "code", "execution_count": 97, "metadata": { "id": "5pt7gp-3Qlqu" }, "outputs": [], "source": [ "df_results = df_results[['DATE','EVENT', 'BOUT', 'Winner', 'WeightClass', 'Tittle', 'Women_fight','METHOD','TIME FORMAT', 'ROUND', 'TIME', 'TotalTime', 'REFEREE',\n", " 'DETAILS', 'URL']]" ] }, { "cell_type": "code", "execution_count": 98, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 354 }, "id": "LHlG0gyk2vDr", "outputId": "9bd32270-3242-498d-f99b-9443a1bdb4f3" }, "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", " \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", "
DATEEVENTBOUTWinnerWeightClassTittleWomen_fightMETHODTIME FORMATROUNDTIMETotalTimeREFEREEDETAILSURL
0February 04, 2023UFC Fight Night: Lewis vs. SpivacDerrick Lewis vs. Serghei SpivacSerghei SpivacHeavyweigh00Submission[5, 5, 5, 5, 5]13:05185Marc GoddardArm Triangle On Groundhttp://ufcstats.com/fight-details/caeeb398f73d...
1February 04, 2023UFC Fight Night: Lewis vs. SpivacDa Woon Jung vs. Devin ClarkDevin ClarkHeavyweigh00Decision - Unanimous[5, 5, 5]35:00900Keith PetersonEric Colon 27 - 30.Chris Lee 27 - 30.David Let...http://ufcstats.com/fight-details/7a1abc0230af...
2February 04, 2023UFC Fight Night: Lewis vs. SpivacMarcin Tybura vs. Blagoy IvanovMarcin TyburaHeavyweigh00Decision - Unanimous[5, 5, 5]35:00900Mark SmithJunichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29...http://ufcstats.com/fight-details/8741e6a3a5a2...
3February 04, 2023UFC Fight Night: Lewis vs. SpivacDooho Choi vs. Kyle NelsonDRAWFeatherweight00Decision - Majority[5, 5, 5]35:00900Chris TognoniAdalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris...http://ufcstats.com/fight-details/01e886808600...
4February 04, 2023UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittAdam FugittWelterweight00KO/TKO[5, 5, 5]14:36276Keith PetersonElbows to Head From Mounthttp://ufcstats.com/fight-details/c63d8062c89c...
\n", "
" ], "text/plain": [ " DATE EVENT \\\n", "0 February 04, 2023 UFC Fight Night: Lewis vs. Spivac \n", "1 February 04, 2023 UFC Fight Night: Lewis vs. Spivac \n", "2 February 04, 2023 UFC Fight Night: Lewis vs. Spivac \n", "3 February 04, 2023 UFC Fight Night: Lewis vs. Spivac \n", "4 February 04, 2023 UFC Fight Night: Lewis vs. Spivac \n", "\n", " BOUT Winner WeightClass Tittle \\\n", "0 Derrick Lewis vs. Serghei Spivac Serghei Spivac Heavyweigh 0 \n", "1 Da Woon Jung vs. Devin Clark Devin Clark Heavyweigh 0 \n", "2 Marcin Tybura vs. Blagoy Ivanov Marcin Tybura Heavyweigh 0 \n", "3 Dooho Choi vs. Kyle Nelson DRAW Featherweight 0 \n", "4 Yusaku Kinoshita vs. Adam Fugitt Adam Fugitt Welterweight 0 \n", "\n", " Women_fight METHOD TIME FORMAT ROUND TIME \\\n", "0 0 Submission [5, 5, 5, 5, 5] 1 3:05 \n", "1 0 Decision - Unanimous [5, 5, 5] 3 5:00 \n", "2 0 Decision - Unanimous [5, 5, 5] 3 5:00 \n", "3 0 Decision - Majority [5, 5, 5] 3 5:00 \n", "4 0 KO/TKO [5, 5, 5] 1 4:36 \n", "\n", " TotalTime REFEREE \\\n", "0 185 Marc Goddard \n", "1 900 Keith Peterson \n", "2 900 Mark Smith \n", "3 900 Chris Tognoni \n", "4 276 Keith Peterson \n", "\n", " DETAILS \\\n", "0 Arm Triangle On Ground \n", "1 Eric Colon 27 - 30.Chris Lee 27 - 30.David Let... \n", "2 Junichiro Kamijo 27 - 30.Ben Cartlidge 28 - 29... \n", "3 Adalaide Byrd 27 - 29.Eric Colon 28 - 28.Chris... \n", "4 Elbows to Head From Mount \n", "\n", " URL \n", "0 http://ufcstats.com/fight-details/caeeb398f73d... \n", "1 http://ufcstats.com/fight-details/7a1abc0230af... \n", "2 http://ufcstats.com/fight-details/8741e6a3a5a2... \n", "3 http://ufcstats.com/fight-details/01e886808600... \n", "4 http://ufcstats.com/fight-details/c63d8062c89c... " ] }, "execution_count": 98, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results.head()" ] }, { "cell_type": "code", "execution_count": 99, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "x13SQ2I7SOhZ", "outputId": "5ba14e7e-c6c3-4bc4-f3db-04885c7f35f8" }, "outputs": [ { "data": { "text/plain": [ "array(['Submission ', 'Decision - Unanimous ', 'Decision - Majority ',\n", " 'KO/TKO ', 'Decision - Split ', \"TKO - Doctor's Stoppage \",\n", " 'Could Not Continue ', 'DQ ', 'Other ', 'Overturned '],\n", " dtype=object)" ] }, "execution_count": 99, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results['METHOD'].unique()" ] }, { "cell_type": "code", "execution_count": 100, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "dnTC3zuDRAbp", "outputId": "c5d96c65-63db-4279-c5c5-11039f23df20" }, "outputs": [ { "data": { "text/plain": [ "array(['Elbows to Head From Mount ', 'Punch to Head At Distance ',\n", " 'Punches to Head In Clinch ', 'Punches to Head At Distance ',\n", " 'Punches to Head From Back Control ', 'Flying Knee Head ',\n", " 'Knees to Body At Distance ', 'Kick to Body At Distance ',\n", " 'Punches to Head From Guard ', 'Kick to Head At Distance ',\n", " 'Punch to Head On Ground ', 'Punches to Head On Ground ',\n", " 'Punch to Head In Clinch ', 'toCorner Stoppage',\n", " 'Punches to Head From Half Guard ', 'Knee to Head At Distance ',\n", " 'Kick to Head At DistanceWheel Kick', 'Spinning Back Kick Head ',\n", " 'Kick to Body At DistanceFront Kick',\n", " 'Elbows to Head From Half Guard ', 'Flying Knee Body ',\n", " 'to At DistanceKnee injury', 'to At Distance ',\n", " 'Kick to Leg At Distance ', 'Knee to Head In Clinch ',\n", " 'Punches to Head From Mount ', 'Kick to Body From Bottom ',\n", " 'Punch to Body At Distance ', 'Elbows to Head On Ground ',\n", " 'Knees to Head In Clinch ', 'toKnee Injury',\n", " 'Spinning Back Elbow to Head At Distance ',\n", " 'Elbows to Head From Back Control ', 'Elbows to Head At Distance ',\n", " 'Spinning Back Fist Head ', 'Elbows to Head From Crucifix ',\n", " 'Elbow to Head In Clinch ', 'toInjury',\n", " 'Kick to Head At DistanceFront kick',\n", " 'Kick to Head At DistanceWheel kick', 'toArm Injury ',\n", " 'Knee to Body On Ground ', 'Knees to Body In Clinch ',\n", " 'Elbows to Head In Clinch ', 'toStoppage Between Rounds',\n", " 'Punches to Body At Distance ',\n", " 'Kick to Head At DistanceFront Kick', 'Elbow to Head From Guard ',\n", " 'Kick to Leg At DistanceSide kick',\n", " 'Punches to Head From Bottom Guard ',\n", " 'Punches to Head From Crucifix ',\n", " 'Spinning Back Elbow to Head At DistanceSpinning Back Elbow',\n", " 'toLeg Injury', 'Punch to Body In Clinch ',\n", " 'Punch to Head From Bottom ', 'Knee to Body At Distance ',\n", " 'Slam to On Ground ', 'Elbow to Head In ClinchEar Injury',\n", " 'toRib injury', 'Elbows to Head From Guard ',\n", " 'toReferee Stoppage Between Rounds', 'Elbow to Head At Distance ',\n", " 'Punch to Head At DistanceNon-title fight for Figueiredo; missed weight',\n", " 'Kick to Head From Bottom GuardUpkick',\n", " 'Elbow to Head From Half Guard ', 'Spinning Back Kick Body ',\n", " 'Kick to Head At DistanceEye Injury to Zingano',\n", " 'Knee to Body In Clinch ', 'Kick to Head In Clinch ', 'to ',\n", " 'Punches to Head From Side Control ', 'Kicks to Body At Distance ',\n", " 'to From MountTechnical Submission',\n", " 'Punches to Head From Back ControlSubmission to Strikes',\n", " 'Punch to Head From Mount ', 'toReferee stoppage between rounds',\n", " 'Punch to Head From Guard ', 'Kick to Head At DistanceSwitch Kick',\n", " 'Punches to Head On GroundSubmission to Strikes', 'toArm Injury',\n", " 'to At DistanceShoulder Injury', 'Punches to From Back Control ',\n", " 'Elbows to Head From Side Control ',\n", " 'Kick to Head At DistanceHook Kick', 'Punches to From Mount ',\n", " 'Punch to In Clinch ', 'toFinger Injury',\n", " 'Kick to Head At DistanceSide Kick',\n", " 'Punch to Head From Half Guard ',\n", " 'Punches to Body From Half Guard ',\n", " 'Punches to Head From Side ControlSubmission to Strikes',\n", " 'toVerbal Submission - Arm Injury',\n", " 'Kick to Body From Back ControlVerbal Submission',\n", " 'toAnkle Injury', 'Elbows to Body On Ground ',\n", " 'Knee to Head In ClinchSubmission to Strikes',\n", " 'Knee to Body At DistanceSubmission to Strikes',\n", " 'Kicks to Leg At Distance ', 'Punches to Body In Clinch ',\n", " 'to On Ground ', 'Knees to Body On Ground ', 'toRib Injury',\n", " 'Punches to Body From Guard ',\n", " 'Elbows to Head From MountSubmission to Strikes',\n", " 'Elbows to Body On GroundSubmission to Strikes', 'toEye Injury',\n", " 'Elbows to Head From Side ControlSubmission to Strikes',\n", " 'Punches to Head At DistanceSubmission - Eye Injury',\n", " 'toShoulder Injury',\n", " 'Elbow to Head From Half GuardSubmission to Strikes',\n", " 'Punches to Head From MountSubmission to Strikes',\n", " 'Elbows to Head From Half GuardSubmission to Strikes',\n", " 'Elbows to Head From GuardSubmission to Strikes', 'toFatigue',\n", " 'Punches to Head From Half GuardSubmission to Strikes',\n", " 'Kicks to Leg At DistanceSubmission to Strikes',\n", " 'Knees to Head On GroundSubmission to Strikes',\n", " 'Punches to Head At DistanceSubmission to Strikes',\n", " 'Punches to Head From GuardSubmission to Strikes',\n", " 'Knees to Head On Ground ',\n", " 'Headbutts to Head On GroundSubmission to Strikes',\n", " 'Headbutts to Head From Side Control ',\n", " 'Headbutt to Head From Guard ',\n", " 'Knees to Head From Front Headlock ',\n", " 'Elbows to Head On GroundSubmission to Strikes',\n", " 'toSubmission to Strikes',\n", " 'Headbutts to Head From MountSubmission to Strikes'], dtype=object)" ] }, "execution_count": 100, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results[df_results['METHOD']=='KO/TKO ']['DETAILS'].unique()" ] }, { "cell_type": "code", "execution_count": 101, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 160 }, "id": "ENMYH6WVTWT1", "outputId": "55987ff4-dcb7-4bc3-8cc5-b5788a0182ff" }, "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", "
DATEEVENTBOUTWinnerWeightClassTittleWomen_fightMETHODTIME FORMATROUNDTIMETotalTimeREFEREEDETAILSURL
6897September 08, 1995UFC 7: The Brawl in BuffaloOnassis Parungao vs. Francesco MaturiOnassis ParungaoOpen Weight00KO/TKO[20]15:26326John McCarthytoSubmission to Strikeshttp://ufcstats.com/fight-details/e4fe950846b5...
\n", "
" ], "text/plain": [ " DATE EVENT \\\n", "6897 September 08, 1995 UFC 7: The Brawl in Buffalo \n", "\n", " BOUT Winner WeightClass \\\n", "6897 Onassis Parungao vs. Francesco Maturi Onassis Parungao Open Weight \n", "\n", " Tittle Women_fight METHOD TIME FORMAT ROUND TIME TotalTime \\\n", "6897 0 0 KO/TKO [20] 1 5:26 326 \n", "\n", " REFEREE DETAILS \\\n", "6897 John McCarthy toSubmission to Strikes \n", "\n", " URL \n", "6897 http://ufcstats.com/fight-details/e4fe950846b5... " ] }, "execution_count": 101, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results[df_results['DETAILS']=='toSubmission to Strikes']" ] }, { "cell_type": "code", "execution_count": 102, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 711 }, "id": "MCZOSnRBY_E6", "outputId": "96980bba-7f02-4506-f011-28cbc798f51c" }, "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", " \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", " \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", "
DATEEVENTBOUTWinnerWeightClassTittleWomen_fightMETHODTIME FORMATROUNDTIMETotalTimeREFEREEDETAILSURL
60December 10, 2022UFC 282: Blachowicz vs. AnkalaevTJ Brown vs. Erik SilvaTJ BrownFeatherweight00Submission[5, 5, 5]33:41821Mark SmithArm Triangle From Side Controlhttp://ufcstats.com/fight-details/2d9d966e0e8d...
86November 19, 2022UFC Fight Night: Nzechukwu vs. CutelabaNatalia Silva vs. Tereza BledaNatalia SilvaFlyweight01KO/TKO[5, 5, 5]31:27687Chris TognoniSpinning Back Kick Headhttp://ufcstats.com/fight-details/33719a2d9c69...
97November 12, 2022UFC 281: Adesanya vs. PereiraKarolina Kowalkiewicz vs. Silvana Gomez JuarezKarolina KowalkiewiczStrawweight01Decision - Unanimous[5, 5, 5]35:00900Marc GoddardMike Bell 28 - 29.Sal D'amato 28 - 29.Dave Tir...http://ufcstats.com/fight-details/ff2e4b411f69...
141October 01, 2022UFC Fight Night: Dern vs. YanJoaquim Silva vs. Jesse RonsonJoaquim SilvaLightweight00KO/TKO[5, 5, 5]23:08488Keith PetersonFlying Knee Headhttp://ufcstats.com/fight-details/ecc56a86a1ee...
194August 20, 2022UFC 278: Usman vs. EdwardsDaniel Da Silva vs. Victor AltamiranoVictor AltamiranoFlyweight00KO/TKO[5, 5, 5]13:39219Dave SeljestadPunches to Head From Guardhttp://ufcstats.com/fight-details/06d6cde74797...
................................................
6381May 27, 2006UFC 60: Hughes vs GracieBrandon Vera vs. Assuerio SilvaBrandon VeraHeavyweigh00Submission[5, 5, 5]12:39159John McCarthyGuillotine Choke From Bottom Guardhttp://ufcstats.com/fight-details/c66bd50ed1e7...
6422January 16, 2006UFC Fight Night 3Tim Sylvia vs. Assuerio SilvaTim SylviaHeavyweigh00Decision - Unanimous[5, 5, 5]35:00900John McCarthyAdalaide Byrd 27 - 30.Cecil Peoples 27 - 30.Da...http://ufcstats.com/fight-details/537012aa6fb2...
6713April 14, 2000UFC 25: Ultimate Japan 3Tito Ortiz vs. Wanderlei SilvaTito OrtizHeavyweigh10Decision - Unanimous[5, 5, 5, 5, 5]55:001500John McCarthy47 - 49.46 - 49.46 - 49.http://ufcstats.com/fight-details/0adfdf8f563b...
6752May 07, 1999UFC 20: Battle for the GoldWanderlei Silva vs. Tony PetarraWanderlei SilvaMiddleweight00KO/TKO[12, 3]12:53173Mario YamasakiKnees to Head In Clinchhttp://ufcstats.com/fight-details/c892b23ad8f2...
6771October 16, 1998UFC - Ultimate BrazilVitor Belfort vs. Wanderlei SilvaVitor BelfortMiddleweight00KO/TKO[12, 3]10:4444John McCarthyPunches to Head At Distancehttp://ufcstats.com/fight-details/3261bd16c10e...
\n", "

164 rows × 15 columns

\n", "
" ], "text/plain": [ " DATE EVENT \\\n", "60 December 10, 2022 UFC 282: Blachowicz vs. Ankalaev \n", "86 November 19, 2022 UFC Fight Night: Nzechukwu vs. Cutelaba \n", "97 November 12, 2022 UFC 281: Adesanya vs. Pereira \n", "141 October 01, 2022 UFC Fight Night: Dern vs. Yan \n", "194 August 20, 2022 UFC 278: Usman vs. Edwards \n", "... ... ... \n", "6381 May 27, 2006 UFC 60: Hughes vs Gracie \n", "6422 January 16, 2006 UFC Fight Night 3 \n", "6713 April 14, 2000 UFC 25: Ultimate Japan 3 \n", "6752 May 07, 1999 UFC 20: Battle for the Gold \n", "6771 October 16, 1998 UFC - Ultimate Brazil \n", "\n", " BOUT Winner \\\n", "60 TJ Brown vs. Erik Silva TJ Brown \n", "86 Natalia Silva vs. Tereza Bleda Natalia Silva \n", "97 Karolina Kowalkiewicz vs. Silvana Gomez Juarez Karolina Kowalkiewicz \n", "141 Joaquim Silva vs. Jesse Ronson Joaquim Silva \n", "194 Daniel Da Silva vs. Victor Altamirano Victor Altamirano \n", "... ... ... \n", "6381 Brandon Vera vs. Assuerio Silva Brandon Vera \n", "6422 Tim Sylvia vs. Assuerio Silva Tim Sylvia \n", "6713 Tito Ortiz vs. Wanderlei Silva Tito Ortiz \n", "6752 Wanderlei Silva vs. Tony Petarra Wanderlei Silva \n", "6771 Vitor Belfort vs. Wanderlei Silva Vitor Belfort \n", "\n", " WeightClass Tittle Women_fight METHOD \\\n", "60 Featherweight 0 0 Submission \n", "86 Flyweight 0 1 KO/TKO \n", "97 Strawweight 0 1 Decision - Unanimous \n", "141 Lightweight 0 0 KO/TKO \n", "194 Flyweight 0 0 KO/TKO \n", "... ... ... ... ... \n", "6381 Heavyweigh 0 0 Submission \n", "6422 Heavyweigh 0 0 Decision - Unanimous \n", "6713 Heavyweigh 1 0 Decision - Unanimous \n", "6752 Middleweight 0 0 KO/TKO \n", "6771 Middleweight 0 0 KO/TKO \n", "\n", " TIME FORMAT ROUND TIME TotalTime REFEREE \\\n", "60 [5, 5, 5] 3 3:41 821 Mark Smith \n", "86 [5, 5, 5] 3 1:27 687 Chris Tognoni \n", "97 [5, 5, 5] 3 5:00 900 Marc Goddard \n", "141 [5, 5, 5] 2 3:08 488 Keith Peterson \n", "194 [5, 5, 5] 1 3:39 219 Dave Seljestad \n", "... ... ... ... ... ... \n", "6381 [5, 5, 5] 1 2:39 159 John McCarthy \n", "6422 [5, 5, 5] 3 5:00 900 John McCarthy \n", "6713 [5, 5, 5, 5, 5] 5 5:00 1500 John McCarthy \n", "6752 [12, 3] 1 2:53 173 Mario Yamasaki \n", "6771 [12, 3] 1 0:44 44 John McCarthy \n", "\n", " DETAILS \\\n", "60 Arm Triangle From Side Control \n", "86 Spinning Back Kick Head \n", "97 Mike Bell 28 - 29.Sal D'amato 28 - 29.Dave Tir... \n", "141 Flying Knee Head \n", "194 Punches to Head From Guard \n", "... ... \n", "6381 Guillotine Choke From Bottom Guard \n", "6422 Adalaide Byrd 27 - 30.Cecil Peoples 27 - 30.Da... \n", "6713 47 - 49.46 - 49.46 - 49. \n", "6752 Knees to Head In Clinch \n", "6771 Punches to Head At Distance \n", "\n", " URL \n", "60 http://ufcstats.com/fight-details/2d9d966e0e8d... \n", "86 http://ufcstats.com/fight-details/33719a2d9c69... \n", "97 http://ufcstats.com/fight-details/ff2e4b411f69... \n", "141 http://ufcstats.com/fight-details/ecc56a86a1ee... \n", "194 http://ufcstats.com/fight-details/06d6cde74797... \n", "... ... \n", "6381 http://ufcstats.com/fight-details/c66bd50ed1e7... \n", "6422 http://ufcstats.com/fight-details/537012aa6fb2... \n", "6713 http://ufcstats.com/fight-details/0adfdf8f563b... \n", "6752 http://ufcstats.com/fight-details/c892b23ad8f2... \n", "6771 http://ufcstats.com/fight-details/3261bd16c10e... \n", "\n", "[164 rows x 15 columns]" ] }, "execution_count": 102, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_results[df_results['BOUT'].str.contains('Silva')]\n" ] }, { "cell_type": "code", "execution_count": 103, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "dKL3LsIk4_RP", "outputId": "2fb657aa-7b2a-412e-d5fb-cac85a8ec69c" }, "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", " \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", " \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", " \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", "
EVENTBOUTFIGHTERKD_fighterSUB.ATT_fighterREV._fighterCTRL_fighterSIG.STR._landed_fighterSIG.STR._attemps_fighterTOTAL STR._landed_fighter...CLINCH_landed_opponentCLINCH_attemps_opponentGROUND_landed_opponentGROUND_attemps_opponentHEIGHT_opponentWEIGHT_opponentREACH_opponentSTANCE_opponentAGE_opponentfightNo_opponent
0UFC 2: No Way OutFrank Hamaker vs. Thaddeus LusterFrank Hamaker0.03.01.002314...0.00.00.00.075.0210.0NaNNaNNaN1.0
1UFC 2: No Way OutFrank Hamaker vs. Thaddeus LusterThaddeus Luster0.00.00.00000...0.00.01.02.0NaNNaNNaNNaNNaN1.0
2UFC 2: No Way OutJason DeLucia vs. Scott BakerJason DeLucia0.05.04.003520...0.00.00.00.072.0210.0NaNNaNNaN1.0
3UFC 2: No Way OutJason DeLucia vs. Scott BakerScott Baker0.00.02.000214...0.00.01.01.071.0190.0NaNSouthpaw24.01.0
4UFC 2: No Way OutJohnny Rhodes vs. David LevickiDavid Levicki0.00.00.004595...1.01.09.015.072.0210.0NaNOrthodoxNaN1.0
..................................................................
13853UFC Fight Night: Lewis vs. SpivacTatsuro Taira vs. Jesus AguilarTatsuro Taira0.02.00.0229115...0.00.00.00.0NaNNaNNaNNaNNaN1.0
13854UFC Fight Night: Lewis vs. SpivacToshiomi Kazama vs. Rinya NakamuraRinya Nakamura2.00.00.03112511...0.00.00.00.0NaN135.0NaNNaN25.01.0
13855UFC Fight Night: Lewis vs. SpivacToshiomi Kazama vs. Rinya NakamuraToshiomi Kazama0.00.00.004104...0.00.01.01.0NaN135.0NaNNaN27.01.0
13856UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittAdam Fugitt0.00.00.0173213333...0.00.00.00.072.0170.0NaNNaN22.01.0
13857UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittYusaku Kinoshita0.00.00.01102411...4.04.06.07.073.0170.0NaNSouthpaw34.02.0
\n", "

13858 rows × 61 columns

\n", "
" ], "text/plain": [ " EVENT BOUT \\\n", "0 UFC 2: No Way Out Frank Hamaker vs. Thaddeus Luster \n", "1 UFC 2: No Way Out Frank Hamaker vs. Thaddeus Luster \n", "2 UFC 2: No Way Out Jason DeLucia vs. Scott Baker \n", "3 UFC 2: No Way Out Jason DeLucia vs. Scott Baker \n", "4 UFC 2: No Way Out Johnny Rhodes vs. David Levicki \n", "... ... ... \n", "13853 UFC Fight Night: Lewis vs. Spivac Tatsuro Taira vs. Jesus Aguilar \n", "13854 UFC Fight Night: Lewis vs. Spivac Toshiomi Kazama vs. Rinya Nakamura \n", "13855 UFC Fight Night: Lewis vs. Spivac Toshiomi Kazama vs. Rinya Nakamura \n", "13856 UFC Fight Night: Lewis vs. Spivac Yusaku Kinoshita vs. Adam Fugitt \n", "13857 UFC Fight Night: Lewis vs. Spivac Yusaku Kinoshita vs. Adam Fugitt \n", "\n", " FIGHTER KD_fighter SUB.ATT_fighter REV._fighter \\\n", "0 Frank Hamaker 0.0 3.0 1.0 \n", "1 Thaddeus Luster 0.0 0.0 0.0 \n", "2 Jason DeLucia 0.0 5.0 4.0 \n", "3 Scott Baker 0.0 0.0 2.0 \n", "4 David Levicki 0.0 0.0 0.0 \n", "... ... ... ... ... \n", "13853 Tatsuro Taira 0.0 2.0 0.0 \n", "13854 Rinya Nakamura 2.0 0.0 0.0 \n", "13855 Toshiomi Kazama 0.0 0.0 0.0 \n", "13856 Adam Fugitt 0.0 0.0 0.0 \n", "13857 Yusaku Kinoshita 0.0 0.0 0.0 \n", "\n", " CTRL_fighter SIG.STR._landed_fighter SIG.STR._attemps_fighter \\\n", "0 0 2 3 \n", "1 0 0 0 \n", "2 0 3 5 \n", "3 0 0 2 \n", "4 0 4 5 \n", "... ... ... ... \n", "13853 229 1 1 \n", "13854 3 11 25 \n", "13855 0 4 10 \n", "13856 173 21 33 \n", "13857 1 10 24 \n", "\n", " TOTAL STR._landed_fighter ... CLINCH_landed_opponent \\\n", "0 14 ... 0.0 \n", "1 0 ... 0.0 \n", "2 20 ... 0.0 \n", "3 14 ... 0.0 \n", "4 95 ... 1.0 \n", "... ... ... ... \n", "13853 5 ... 0.0 \n", "13854 11 ... 0.0 \n", "13855 4 ... 0.0 \n", "13856 33 ... 0.0 \n", "13857 11 ... 4.0 \n", "\n", " CLINCH_attemps_opponent GROUND_landed_opponent \\\n", "0 0.0 0.0 \n", "1 0.0 1.0 \n", "2 0.0 0.0 \n", "3 0.0 1.0 \n", "4 1.0 9.0 \n", "... ... ... \n", "13853 0.0 0.0 \n", "13854 0.0 0.0 \n", "13855 0.0 1.0 \n", "13856 0.0 0.0 \n", "13857 4.0 6.0 \n", "\n", " GROUND_attemps_opponent HEIGHT_opponent WEIGHT_opponent \\\n", "0 0.0 75.0 210.0 \n", "1 2.0 NaN NaN \n", "2 0.0 72.0 210.0 \n", "3 1.0 71.0 190.0 \n", "4 15.0 72.0 210.0 \n", "... ... ... ... \n", "13853 0.0 NaN NaN \n", "13854 0.0 NaN 135.0 \n", "13855 1.0 NaN 135.0 \n", "13856 0.0 72.0 170.0 \n", "13857 7.0 73.0 170.0 \n", "\n", " REACH_opponent STANCE_opponent AGE_opponent fightNo_opponent \n", "0 NaN NaN NaN 1.0 \n", "1 NaN NaN NaN 1.0 \n", "2 NaN NaN NaN 1.0 \n", "3 NaN Southpaw 24.0 1.0 \n", "4 NaN Orthodox NaN 1.0 \n", "... ... ... ... ... \n", "13853 NaN NaN NaN 1.0 \n", "13854 NaN NaN 25.0 1.0 \n", "13855 NaN NaN 27.0 1.0 \n", "13856 NaN NaN 22.0 1.0 \n", "13857 NaN Southpaw 34.0 2.0 \n", "\n", "[13858 rows x 61 columns]" ] }, "execution_count": 103, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total" ] }, { "cell_type": "code", "execution_count": 104, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "EVENT False\n", "BOUT False\n", "FIGHTER False\n", "KD_fighter False\n", "SUB.ATT_fighter False\n", " ... \n", "WEIGHT_opponent True\n", "REACH_opponent True\n", "STANCE_opponent True\n", "AGE_opponent True\n", "fightNo_opponent True\n", "Length: 61, dtype: bool" ] }, "execution_count": 104, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.isna().any()" ] }, { "cell_type": "code", "execution_count": 105, "metadata": { "id": "gHgL0OI60z2P" }, "outputs": [], "source": [ "df_total = df_total.merge(df_results, on=['EVENT','BOUT'], how='left')" ] }, { "cell_type": "code", "execution_count": 106, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Q5E3xfB2DqL4", "outputId": "bc210640-9850-4555-9edc-20fd83c6a3f5" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Int64Index: 13860 entries, 0 to 13859\n", "Data columns (total 74 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 13860 non-null object \n", " 1 BOUT 13860 non-null object \n", " 2 FIGHTER 13860 non-null object \n", " 3 KD_fighter 13860 non-null float64 \n", " 4 SUB.ATT_fighter 13860 non-null float64 \n", " 5 REV._fighter 13860 non-null float64 \n", " 6 CTRL_fighter 13860 non-null int32 \n", " 7 SIG.STR._landed_fighter 13860 non-null int32 \n", " 8 SIG.STR._attemps_fighter 13860 non-null int32 \n", " 9 TOTAL STR._landed_fighter 13860 non-null int32 \n", " 10 TOTAL STR._attemps_fighter 13860 non-null int32 \n", " 11 TD_landed_fighter 13860 non-null int32 \n", " 12 TD_attemps_fighter 13860 non-null int32 \n", " 13 HEAD_landed_fighter 13860 non-null int32 \n", " 14 HEAD_attemps_fighter 13860 non-null int32 \n", " 15 BODY_landed_fighter 13860 non-null int32 \n", " 16 BODY_attemps_fighter 13860 non-null int32 \n", " 17 LEG_landed_fighter 13860 non-null int32 \n", " 18 LEG_attemps_fighter 13860 non-null int32 \n", " 19 DISTANCE_landed_fighter 13860 non-null int32 \n", " 20 DISTANCE_attemps_fighter 13860 non-null int32 \n", " 21 CLINCH_landed_fighter 13860 non-null int32 \n", " 22 CLINCH_attemps_fighter 13860 non-null int32 \n", " 23 GROUND_landed_fighter 13860 non-null int32 \n", " 24 GROUND_attemps_fighter 13860 non-null int32 \n", " 25 OPPONENT 13860 non-null object \n", " 26 DATE_fighter 13860 non-null datetime64[ns]\n", " 27 HEIGHT_fighter 13796 non-null float64 \n", " 28 WEIGHT_fighter 13837 non-null float64 \n", " 29 REACH_fighter 12475 non-null float64 \n", " 30 STANCE_fighter 13673 non-null object \n", " 31 AGE_fighter 13603 non-null float64 \n", " 32 fightNo_fighter 13860 non-null int64 \n", " 33 KD_opponent 13851 non-null float64 \n", " 34 SUB.ATT_opponent 13851 non-null float64 \n", " 35 REV._opponent 13851 non-null float64 \n", " 36 CTRL_opponent 13851 non-null float64 \n", " 37 SIG.STR._landed_opponent 13851 non-null float64 \n", " 38 SIG.STR._attemps_opponent 13851 non-null float64 \n", " 39 TOTAL STR._landed_opponent 13851 non-null float64 \n", " 40 TOTAL STR._attemps_opponent 13851 non-null float64 \n", " 41 TD_landed_opponent 13851 non-null float64 \n", " 42 TD_attemps_opponent 13851 non-null float64 \n", " 43 HEAD_landed_opponent 13851 non-null float64 \n", " 44 HEAD_attemps_opponent 13851 non-null float64 \n", " 45 BODY_landed_opponent 13851 non-null float64 \n", " 46 BODY_attemps_opponent 13851 non-null float64 \n", " 47 LEG_landed_opponent 13851 non-null float64 \n", " 48 LEG_attemps_opponent 13851 non-null float64 \n", " 49 DISTANCE_landed_opponent 13851 non-null float64 \n", " 50 DISTANCE_attemps_opponent 13851 non-null float64 \n", " 51 CLINCH_landed_opponent 13851 non-null float64 \n", " 52 CLINCH_attemps_opponent 13851 non-null float64 \n", " 53 GROUND_landed_opponent 13851 non-null float64 \n", " 54 GROUND_attemps_opponent 13851 non-null float64 \n", " 55 HEIGHT_opponent 13787 non-null float64 \n", " 56 WEIGHT_opponent 13828 non-null float64 \n", " 57 REACH_opponent 12466 non-null float64 \n", " 58 STANCE_opponent 13664 non-null object \n", " 59 AGE_opponent 13594 non-null float64 \n", " 60 fightNo_opponent 13851 non-null float64 \n", " 61 DATE 13860 non-null object \n", " 62 Winner 13860 non-null object \n", " 63 WeightClass 13860 non-null object \n", " 64 Tittle 13860 non-null int64 \n", " 65 Women_fight 13860 non-null int64 \n", " 66 METHOD 13860 non-null object \n", " 67 TIME FORMAT 13860 non-null object \n", " 68 ROUND 13860 non-null int64 \n", " 69 TIME 13860 non-null object \n", " 70 TotalTime 13860 non-null int64 \n", " 71 REFEREE 13796 non-null object \n", " 72 DETAILS 13722 non-null object \n", " 73 URL 13860 non-null object \n", "dtypes: datetime64[ns](1), float64(34), int32(19), int64(5), object(15)\n", "memory usage: 6.9+ MB\n" ] } ], "source": [ "df_total.info()" ] }, { "cell_type": "code", "execution_count": 107, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "EVENT False\n", "BOUT False\n", "FIGHTER False\n", "KD_fighter False\n", "SUB.ATT_fighter False\n", " ... \n", "TIME False\n", "TotalTime False\n", "REFEREE True\n", "DETAILS True\n", "URL False\n", "Length: 74, dtype: bool" ] }, "execution_count": 107, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.isna().any()" ] }, { "cell_type": "code", "execution_count": 108, "metadata": { "id": "3dEbX5TkD05l" }, "outputs": [], "source": [ "df_total.loc[:,'Win'] = (df_total['Winner'].str.strip() == df_total['FIGHTER'].str.strip()).astype(int)\n", "df_total.loc[:,'DRAW'] = (df_total['Winner'].str.strip() == 'Draw').astype(int)\n", "df_total.loc[:,'No_contest'] = (df_total['Winner'].str.strip() == 'NC').astype(int)\n" ] }, { "cell_type": "code", "execution_count": 109, "metadata": { "id": "2ssWXQ2UHLjD" }, "outputs": [], "source": [ "df_total= df_total[['EVENT', 'BOUT','DATE_fighter','WeightClass', 'Tittle', 'Women_fight',\n", " 'METHOD', 'TIME FORMAT', 'ROUND', 'TIME', 'TotalTime', 'REFEREE',\n", " 'DETAILS','URL','FIGHTER','Win', 'DRAW', 'No_contest', 'HEIGHT_fighter', 'WEIGHT_fighter', 'REACH_fighter',\n", " 'STANCE_fighter', 'AGE_fighter', 'fightNo_fighter', 'OPPONENT', 'HEIGHT_opponent',\n", " 'WEIGHT_opponent', 'REACH_opponent', 'STANCE_opponent', 'AGE_opponent',\n", " 'fightNo_opponent', 'KD_fighter', 'SUB.ATT_fighter',\n", " 'REV._fighter', 'CTRL_fighter', 'SIG.STR._landed_fighter',\n", " 'SIG.STR._attemps_fighter', 'TOTAL STR._landed_fighter',\n", " 'TOTAL STR._attemps_fighter', 'TD_landed_fighter', 'TD_attemps_fighter',\n", " 'HEAD_landed_fighter', 'HEAD_attemps_fighter', 'BODY_landed_fighter',\n", " 'BODY_attemps_fighter', 'LEG_landed_fighter', 'LEG_attemps_fighter',\n", " 'DISTANCE_landed_fighter', 'DISTANCE_attemps_fighter',\n", " 'CLINCH_landed_fighter', 'CLINCH_attemps_fighter',\n", " 'GROUND_landed_fighter', 'GROUND_attemps_fighter', 'KD_opponent',\n", " 'SUB.ATT_opponent', 'REV._opponent', 'CTRL_opponent',\n", " 'SIG.STR._landed_opponent', 'SIG.STR._attemps_opponent',\n", " 'TOTAL STR._landed_opponent', 'TOTAL STR._attemps_opponent',\n", " 'TD_landed_opponent', 'TD_attemps_opponent', 'HEAD_landed_opponent',\n", " 'HEAD_attemps_opponent', 'BODY_landed_opponent',\n", " 'BODY_attemps_opponent', 'LEG_landed_opponent', 'LEG_attemps_opponent',\n", " 'DISTANCE_landed_opponent', 'DISTANCE_attemps_opponent',\n", " 'CLINCH_landed_opponent', 'CLINCH_attemps_opponent',\n", " 'GROUND_landed_opponent', 'GROUND_attemps_opponent']]" ] }, { "cell_type": "code", "execution_count": 110, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 612 }, "id": "u9OKmyzv14c5", "outputId": "ca4945d3-d672-452a-a12b-70b99821e47c" }, "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", " \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", "
EVENTBOUTDATE_fighterWeightClassTittleWomen_fightMETHODTIME FORMATROUNDTIME...BODY_landed_opponentBODY_attemps_opponentLEG_landed_opponentLEG_attemps_opponentDISTANCE_landed_opponentDISTANCE_attemps_opponentCLINCH_landed_opponentCLINCH_attemps_opponentGROUND_landed_opponentGROUND_attemps_opponent
0UFC 2: No Way OutFrank Hamaker vs. Thaddeus Luster1994-03-11Open Weight00Submission[0]14:52...0.00.00.00.00.00.00.00.00.00.0
1UFC 2: No Way OutFrank Hamaker vs. Thaddeus Luster1994-03-11Open Weight00Submission[0]14:52...0.00.00.00.01.01.00.00.01.02.0
2UFC 2: No Way OutJason DeLucia vs. Scott Baker1994-03-11Open Weight00Submission[0]16:41...0.00.00.00.00.02.00.00.00.00.0
3UFC 2: No Way OutJason DeLucia vs. Scott Baker1994-03-11Open Weight00Submission[0]16:41...1.02.01.01.02.04.00.00.01.01.0
4UFC 2: No Way OutJohnny Rhodes vs. David Levicki1994-03-11Open Weight00KO/TKO[0]112:13...1.01.01.01.01.01.01.01.09.015.0
\n", "

5 rows × 75 columns

\n", "
" ], "text/plain": [ " EVENT BOUT DATE_fighter \\\n", "0 UFC 2: No Way Out Frank Hamaker vs. Thaddeus Luster 1994-03-11 \n", "1 UFC 2: No Way Out Frank Hamaker vs. Thaddeus Luster 1994-03-11 \n", "2 UFC 2: No Way Out Jason DeLucia vs. Scott Baker 1994-03-11 \n", "3 UFC 2: No Way Out Jason DeLucia vs. Scott Baker 1994-03-11 \n", "4 UFC 2: No Way Out Johnny Rhodes vs. David Levicki 1994-03-11 \n", "\n", " WeightClass Tittle Women_fight METHOD TIME FORMAT ROUND TIME \\\n", "0 Open Weight 0 0 Submission [0] 1 4:52 \n", "1 Open Weight 0 0 Submission [0] 1 4:52 \n", "2 Open Weight 0 0 Submission [0] 1 6:41 \n", "3 Open Weight 0 0 Submission [0] 1 6:41 \n", "4 Open Weight 0 0 KO/TKO [0] 1 12:13 \n", "\n", " ... BODY_landed_opponent BODY_attemps_opponent LEG_landed_opponent \\\n", "0 ... 0.0 0.0 0.0 \n", "1 ... 0.0 0.0 0.0 \n", "2 ... 0.0 0.0 0.0 \n", "3 ... 1.0 2.0 1.0 \n", "4 ... 1.0 1.0 1.0 \n", "\n", " LEG_attemps_opponent DISTANCE_landed_opponent DISTANCE_attemps_opponent \\\n", "0 0.0 0.0 0.0 \n", "1 0.0 1.0 1.0 \n", "2 0.0 0.0 2.0 \n", "3 1.0 2.0 4.0 \n", "4 1.0 1.0 1.0 \n", "\n", " CLINCH_landed_opponent CLINCH_attemps_opponent GROUND_landed_opponent \\\n", "0 0.0 0.0 0.0 \n", "1 0.0 0.0 1.0 \n", "2 0.0 0.0 0.0 \n", "3 0.0 0.0 1.0 \n", "4 1.0 1.0 9.0 \n", "\n", " GROUND_attemps_opponent \n", "0 0.0 \n", "1 2.0 \n", "2 0.0 \n", "3 1.0 \n", "4 15.0 \n", "\n", "[5 rows x 75 columns]" ] }, "execution_count": 110, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.head()" ] }, { "cell_type": "code", "execution_count": 111, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "P8a65DCdaSjG", "outputId": "de30c16f-5112-457a-ad39-85197712dc82" }, "outputs": [], "source": [ "df_total['METHOD'] = df_total['METHOD'].apply(lambda x: 'Decision' if 'Decision' in x else x.strip())\n", "#df_total['METHOD'] = df_total['METHOD'].apply(lambda x: 'KO/TKO' if 'TKO' in x else x.strip())" ] }, { "cell_type": "code", "execution_count": 112, "metadata": { "id": "_ftOAt41h6FC" }, "outputs": [], "source": [ "ground = ['submission', 'guard', 'control', 'mount', 'crucifix']\n", "clinch = ['clinch']\n", "a = 'Punches to Head From GuardSubmission to Strikes'" ] }, { "cell_type": "code", "execution_count": 113, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "eOdOSV7ZjY_M", "outputId": "d6966b29-98b6-422c-8a5f-26ba211fa387" }, "outputs": [ { "data": { "text/plain": [ "2" ] }, "execution_count": 113, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.sum([1 if x in a.lower() else 0 for x in ground])" ] }, { "cell_type": "code", "execution_count": 114, "metadata": { "id": "4An6TXEplmLT" }, "outputs": [], "source": [ "def split_TKO(detail):\n", " lower = detail.lower()\n", " ground = ['submission', 'guard', 'control', 'mount', 'crucifix', 'ground']\n", " distance = ['kick', 'distance', 'fist', 'knee', 'elbow']\n", " clinch = ['clinch']\n", " injury = ['injury']\n", " if np.sum([1 if x in lower else 0 for x in ground]) > 0:\n", " return 'KO/TKO - ground' \n", " elif np.sum([1 if x in lower else 0 for x in clinch]) > 0:\n", " return 'KO/TKO - clinch'\n", " elif np.sum([1 if x in lower else 0 for x in distance]) > 0:\n", " return 'KO/TKO - distance'\n", " elif np.sum([1 if x in lower else 0 for x in injury]) > 0:\n", " return 'KO/TKO - injury'\n", " else:\n", " return 'KO/TKO - other'" ] }, { "cell_type": "code", "execution_count": 115, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 36 }, "id": "na-FyDjbtKrS", "outputId": "c9fc8df1-abf5-486a-d1a3-b523beeb50ab" }, "outputs": [ { "data": { "text/plain": [ "'KO/TKO - ground'" ] }, "execution_count": 115, "metadata": {}, "output_type": "execute_result" } ], "source": [ "split_TKO('Punches to Head From GuardSubmission to Strikes')" ] }, { "cell_type": "code", "execution_count": 116, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "KEBFeWR1q5_d", "outputId": "efd86668-3487-47e8-f78f-eb62e4785474" }, "outputs": [ { "data": { "text/plain": [ "Index(['EVENT', 'BOUT', 'DATE_fighter', 'WeightClass', 'Tittle', 'Women_fight',\n", " 'METHOD', 'TIME FORMAT', 'ROUND', 'TIME', 'TotalTime', 'REFEREE',\n", " 'DETAILS', 'URL', 'FIGHTER', 'Win', 'DRAW', 'No_contest',\n", " 'HEIGHT_fighter', 'WEIGHT_fighter', 'REACH_fighter', 'STANCE_fighter',\n", " 'AGE_fighter', 'fightNo_fighter', 'OPPONENT', 'HEIGHT_opponent',\n", " 'WEIGHT_opponent', 'REACH_opponent', 'STANCE_opponent', 'AGE_opponent',\n", " 'fightNo_opponent', 'KD_fighter', 'SUB.ATT_fighter', 'REV._fighter',\n", " 'CTRL_fighter', 'SIG.STR._landed_fighter', 'SIG.STR._attemps_fighter',\n", " 'TOTAL STR._landed_fighter', 'TOTAL STR._attemps_fighter',\n", " 'TD_landed_fighter', 'TD_attemps_fighter', 'HEAD_landed_fighter',\n", " 'HEAD_attemps_fighter', 'BODY_landed_fighter', 'BODY_attemps_fighter',\n", " 'LEG_landed_fighter', 'LEG_attemps_fighter', 'DISTANCE_landed_fighter',\n", " 'DISTANCE_attemps_fighter', 'CLINCH_landed_fighter',\n", " 'CLINCH_attemps_fighter', 'GROUND_landed_fighter',\n", " 'GROUND_attemps_fighter', 'KD_opponent', 'SUB.ATT_opponent',\n", " 'REV._opponent', 'CTRL_opponent', 'SIG.STR._landed_opponent',\n", " 'SIG.STR._attemps_opponent', 'TOTAL STR._landed_opponent',\n", " 'TOTAL STR._attemps_opponent', 'TD_landed_opponent',\n", " 'TD_attemps_opponent', 'HEAD_landed_opponent', 'HEAD_attemps_opponent',\n", " 'BODY_landed_opponent', 'BODY_attemps_opponent', 'LEG_landed_opponent',\n", " 'LEG_attemps_opponent', 'DISTANCE_landed_opponent',\n", " 'DISTANCE_attemps_opponent', 'CLINCH_landed_opponent',\n", " 'CLINCH_attemps_opponent', 'GROUND_landed_opponent',\n", " 'GROUND_attemps_opponent'],\n", " dtype='object')" ] }, "execution_count": 116, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.columns" ] }, { "cell_type": "code", "execution_count": 117, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "NNIDy1QPskyV", "outputId": "7049fe94-ddaa-4088-a846-dd66585168c3" }, "outputs": [ { "data": { "text/plain": [ "array(['Submission', 'KO/TKO', \"TKO - Doctor's Stoppage\", 'Other',\n", " 'Decision', 'Overturned', 'DQ', 'Could Not Continue'], dtype=object)" ] }, "execution_count": 117, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total['METHOD'].unique()" ] }, { "cell_type": "code", "execution_count": 118, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "uqlbP-WvtTUe", "outputId": "a0f02f93-d610-4a1e-e36d-755d6c616a4b" }, "outputs": [ { "data": { "text/plain": [ "0 Keylock From Half Guard \n", "1 Keylock From Half Guard \n", "2 Triangle Choke From Mount \n", "3 Triangle Choke From Mount \n", "4 Punches to Head From GuardSubmission to Strikes\n", " ... \n", "13855 Triangle Armbar From Bottom Guard \n", "13856 Punch to Head At Distance \n", "13857 Punch to Head At Distance \n", "13858 Elbows to Head From Mount \n", "13859 Elbows to Head From Mount \n", "Name: DETAILS, Length: 13860, dtype: object" ] }, "execution_count": 118, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total['DETAILS']" ] }, { "cell_type": "code", "execution_count": 119, "metadata": { "id": "gUg1He6XjMhe" }, "outputs": [], "source": [ "df_total['METHOD'] = df_total.apply(lambda row: split_TKO(row['DETAILS']) if row['METHOD'] =='KO/TKO' else row['METHOD'], axis=1)" ] }, { "cell_type": "code", "execution_count": 120, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "f2z6Zze7zVcZ", "outputId": "2df17cf4-04bb-4ab6-80c0-edbcd2a080a3" }, "outputs": [ { "data": { "text/plain": [ "array(['toCorner Stoppage', 'toFatigue',\n", " 'toReferee stoppage between rounds', 'Punch to Head From Bottom ',\n", " 'to ', 'toReferee Stoppage Between Rounds',\n", " 'toStoppage Between Rounds'], dtype=object)" ] }, "execution_count": 120, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total[df_total['METHOD']=='KO/TKO - other']['DETAILS'].unique()" ] }, { "cell_type": "code", "execution_count": 121, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "NO8ZKGf7rQ17", "outputId": "a2d8783d-1c02-4ef4-82f1-e2f958cece86" }, "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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
METHODDETAILS
13738KO/TKO - distancePunches to Head At Distance
13739KO/TKO - distancePunches to Head At Distance
13740KO/TKO - clinchPunch to Head In Clinch
13741KO/TKO - clinchPunch to Head In Clinch
13744KO/TKO - groundPunches to Head On Ground
13745KO/TKO - groundPunches to Head On Ground
13746KO/TKO - distancePunch to Head At Distance
13747KO/TKO - distancePunch to Head At Distance
13754KO/TKO - distancePunches to Head At Distance
13755KO/TKO - distancePunches to Head At Distance
13758KO/TKO - distanceKick to Head At Distance
13759KO/TKO - distanceKick to Head At Distance
13760KO/TKO - distancePunch to Head At Distance
13761KO/TKO - distancePunch to Head At Distance
13768KO/TKO - groundPunch to Head On Ground
13769KO/TKO - groundPunch to Head On Ground
13772KO/TKO - distancePunch to Head At Distance
13773KO/TKO - distancePunch to Head At Distance
13786KO/TKO - groundPunches to Head From Guard
13787KO/TKO - groundPunches to Head From Guard
13788KO/TKO - distancePunches to Head At Distance
13789KO/TKO - distancePunches to Head At Distance
13792KO/TKO - distancePunch to Head At Distance
13793KO/TKO - distancePunch to Head At Distance
13800KO/TKO - distanceKick to Body At Distance
13801KO/TKO - distanceKick to Body At Distance
13804KO/TKO - distancePunch to Head At Distance
13805KO/TKO - distancePunch to Head At Distance
13806TKO - Doctor's StoppageEye Injury
13807TKO - Doctor's StoppageEye Injury
13814KO/TKO - distancePunch to Head At Distance
13815KO/TKO - distancePunch to Head At Distance
13816KO/TKO - distanceFlying Knee Head
13817KO/TKO - distanceFlying Knee Head
13824KO/TKO - distancePunches to Head At Distance
13825KO/TKO - distancePunches to Head At Distance
13826KO/TKO - clinchPunches to Head In Clinch
13827KO/TKO - clinchPunches to Head In Clinch
13828KO/TKO - distanceKnees to Body At Distance
13829KO/TKO - distanceKnees to Body At Distance
13830KO/TKO - groundPunches to Head From Back Control
13831KO/TKO - groundPunches to Head From Back Control
13842KO/TKO - groundElbows to Head From Mount
13843KO/TKO - groundElbows to Head From Mount
13844KO/TKO - groundElbows to Head From Mount
13845KO/TKO - groundElbows to Head From Mount
13856KO/TKO - distancePunch to Head At Distance
13857KO/TKO - distancePunch to Head At Distance
13858KO/TKO - groundElbows to Head From Mount
13859KO/TKO - groundElbows to Head From Mount
\n", "
" ], "text/plain": [ " METHOD DETAILS\n", "13738 KO/TKO - distance Punches to Head At Distance \n", "13739 KO/TKO - distance Punches to Head At Distance \n", "13740 KO/TKO - clinch Punch to Head In Clinch \n", "13741 KO/TKO - clinch Punch to Head In Clinch \n", "13744 KO/TKO - ground Punches to Head On Ground \n", "13745 KO/TKO - ground Punches to Head On Ground \n", "13746 KO/TKO - distance Punch to Head At Distance \n", "13747 KO/TKO - distance Punch to Head At Distance \n", "13754 KO/TKO - distance Punches to Head At Distance \n", "13755 KO/TKO - distance Punches to Head At Distance \n", "13758 KO/TKO - distance Kick to Head At Distance \n", "13759 KO/TKO - distance Kick to Head At Distance \n", "13760 KO/TKO - distance Punch to Head At Distance \n", "13761 KO/TKO - distance Punch to Head At Distance \n", "13768 KO/TKO - ground Punch to Head On Ground \n", "13769 KO/TKO - ground Punch to Head On Ground \n", "13772 KO/TKO - distance Punch to Head At Distance \n", "13773 KO/TKO - distance Punch to Head At Distance \n", "13786 KO/TKO - ground Punches to Head From Guard \n", "13787 KO/TKO - ground Punches to Head From Guard \n", "13788 KO/TKO - distance Punches to Head At Distance \n", "13789 KO/TKO - distance Punches to Head At Distance \n", "13792 KO/TKO - distance Punch to Head At Distance \n", "13793 KO/TKO - distance Punch to Head At Distance \n", "13800 KO/TKO - distance Kick to Body At Distance \n", "13801 KO/TKO - distance Kick to Body At Distance \n", "13804 KO/TKO - distance Punch to Head At Distance \n", "13805 KO/TKO - distance Punch to Head At Distance \n", "13806 TKO - Doctor's Stoppage Eye Injury\n", "13807 TKO - Doctor's Stoppage Eye Injury\n", "13814 KO/TKO - distance Punch to Head At Distance \n", "13815 KO/TKO - distance Punch to Head At Distance \n", "13816 KO/TKO - distance Flying Knee Head \n", "13817 KO/TKO - distance Flying Knee Head \n", "13824 KO/TKO - distance Punches to Head At Distance \n", "13825 KO/TKO - distance Punches to Head At Distance \n", "13826 KO/TKO - clinch Punches to Head In Clinch \n", "13827 KO/TKO - clinch Punches to Head In Clinch \n", "13828 KO/TKO - distance Knees to Body At Distance \n", "13829 KO/TKO - distance Knees to Body At Distance \n", "13830 KO/TKO - ground Punches to Head From Back Control \n", "13831 KO/TKO - ground Punches to Head From Back Control \n", "13842 KO/TKO - ground Elbows to Head From Mount \n", "13843 KO/TKO - ground Elbows to Head From Mount \n", "13844 KO/TKO - ground Elbows to Head From Mount \n", "13845 KO/TKO - ground Elbows to Head From Mount \n", "13856 KO/TKO - distance Punch to Head At Distance \n", "13857 KO/TKO - distance Punch to Head At Distance \n", "13858 KO/TKO - ground Elbows to Head From Mount \n", "13859 KO/TKO - ground Elbows to Head From Mount " ] }, "execution_count": 121, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.loc[df_total['METHOD'].str.contains('KO'),['METHOD', 'DETAILS']].tail(50)" ] }, { "cell_type": "code", "execution_count": 122, "metadata": { "id": "XBFtGNJK-AwW" }, "outputs": [], "source": [ "df_total = df_total.rename(columns={\"DATE_fighter\": \"DATE_Event\"})" ] }, { "cell_type": "code", "execution_count": 123, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "L10tjDJYBJKc", "outputId": "ee82616f-6d87-48bd-a1e3-6707eb24c340" }, "outputs": [ { "data": { "text/plain": [ "array([nan, 72., 75., 74., 76., 70., 73., 77., 68., 78., 67., 79., 69.,\n", " 80., 71., 64., 66., 82., 81., 84., 63., 65., 62., 60., 83., 61.,\n", " 58., 59.])" ] }, "execution_count": 123, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total['REACH_fighter'].unique()" ] }, { "cell_type": "code", "execution_count": 124, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "dLH3no1T_bXT", "outputId": "77a166c9-4148-4e0e-9aba-4ad2c9d28e73" }, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
HEIGHT_fighterWEIGHT_fighterREACH_fighterSTANCE_fighterAGE_fighter
0NaNNaNNaNNaNNaN
175.0210.0NaNNaNNaN
271.0190.0NaNSouthpaw24.0
372.0210.0NaNNaNNaN
477.0275.0NaNNaNNaN
..................
1385071.0250.073.0Southpaw36.0
1385175.0249.078.0Orthodox37.0
13852NaN125.0NaNNaNNaN
13853NaN125.0NaNNaNNaN
13854NaNNaNNaNNaNNaN
\n", "

13855 rows × 5 columns

\n", "
" ], "text/plain": [ " HEIGHT_fighter WEIGHT_fighter REACH_fighter STANCE_fighter \\\n", "0 NaN NaN NaN NaN \n", "1 75.0 210.0 NaN NaN \n", "2 71.0 190.0 NaN Southpaw \n", "3 72.0 210.0 NaN NaN \n", "4 77.0 275.0 NaN NaN \n", "... ... ... ... ... \n", "13850 71.0 250.0 73.0 Southpaw \n", "13851 75.0 249.0 78.0 Orthodox \n", "13852 NaN 125.0 NaN NaN \n", "13853 NaN 125.0 NaN NaN \n", "13854 NaN NaN NaN NaN \n", "\n", " AGE_fighter \n", "0 NaN \n", "1 NaN \n", "2 24.0 \n", "3 NaN \n", "4 NaN \n", "... ... \n", "13850 36.0 \n", "13851 37.0 \n", "13852 NaN \n", "13853 NaN \n", "13854 NaN \n", "\n", "[13855 rows x 5 columns]" ] }, "execution_count": 124, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.iloc[:-5,18:23]" ] }, { "cell_type": "code", "execution_count": 125, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "VdaQ3DYy5Pm6", "outputId": "24bbf189-121c-49df-823d-8278fcf1f0b0" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Int64Index: 13860 entries, 0 to 13859\n", "Data columns (total 75 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 13860 non-null object \n", " 1 BOUT 13860 non-null object \n", " 2 DATE_Event 13860 non-null datetime64[ns]\n", " 3 WeightClass 13860 non-null object \n", " 4 Tittle 13860 non-null int64 \n", " 5 Women_fight 13860 non-null int64 \n", " 6 METHOD 13860 non-null object \n", " 7 TIME FORMAT 13860 non-null object \n", " 8 ROUND 13860 non-null int64 \n", " 9 TIME 13860 non-null object \n", " 10 TotalTime 13860 non-null int64 \n", " 11 REFEREE 13796 non-null object \n", " 12 DETAILS 13722 non-null object \n", " 13 URL 13860 non-null object \n", " 14 FIGHTER 13860 non-null object \n", " 15 Win 13860 non-null int32 \n", " 16 DRAW 13860 non-null int32 \n", " 17 No_contest 13860 non-null int32 \n", " 18 HEIGHT_fighter 13796 non-null float64 \n", " 19 WEIGHT_fighter 13837 non-null float64 \n", " 20 REACH_fighter 12475 non-null float64 \n", " 21 STANCE_fighter 13673 non-null object \n", " 22 AGE_fighter 13603 non-null float64 \n", " 23 fightNo_fighter 13860 non-null int64 \n", " 24 OPPONENT 13860 non-null object \n", " 25 HEIGHT_opponent 13787 non-null float64 \n", " 26 WEIGHT_opponent 13828 non-null float64 \n", " 27 REACH_opponent 12466 non-null float64 \n", " 28 STANCE_opponent 13664 non-null object \n", " 29 AGE_opponent 13594 non-null float64 \n", " 30 fightNo_opponent 13851 non-null float64 \n", " 31 KD_fighter 13860 non-null float64 \n", " 32 SUB.ATT_fighter 13860 non-null float64 \n", " 33 REV._fighter 13860 non-null float64 \n", " 34 CTRL_fighter 13860 non-null int32 \n", " 35 SIG.STR._landed_fighter 13860 non-null int32 \n", " 36 SIG.STR._attemps_fighter 13860 non-null int32 \n", " 37 TOTAL STR._landed_fighter 13860 non-null int32 \n", " 38 TOTAL STR._attemps_fighter 13860 non-null int32 \n", " 39 TD_landed_fighter 13860 non-null int32 \n", " 40 TD_attemps_fighter 13860 non-null int32 \n", " 41 HEAD_landed_fighter 13860 non-null int32 \n", " 42 HEAD_attemps_fighter 13860 non-null int32 \n", " 43 BODY_landed_fighter 13860 non-null int32 \n", " 44 BODY_attemps_fighter 13860 non-null int32 \n", " 45 LEG_landed_fighter 13860 non-null int32 \n", " 46 LEG_attemps_fighter 13860 non-null int32 \n", " 47 DISTANCE_landed_fighter 13860 non-null int32 \n", " 48 DISTANCE_attemps_fighter 13860 non-null int32 \n", " 49 CLINCH_landed_fighter 13860 non-null int32 \n", " 50 CLINCH_attemps_fighter 13860 non-null int32 \n", " 51 GROUND_landed_fighter 13860 non-null int32 \n", " 52 GROUND_attemps_fighter 13860 non-null int32 \n", " 53 KD_opponent 13851 non-null float64 \n", " 54 SUB.ATT_opponent 13851 non-null float64 \n", " 55 REV._opponent 13851 non-null float64 \n", " 56 CTRL_opponent 13851 non-null float64 \n", " 57 SIG.STR._landed_opponent 13851 non-null float64 \n", " 58 SIG.STR._attemps_opponent 13851 non-null float64 \n", " 59 TOTAL STR._landed_opponent 13851 non-null float64 \n", " 60 TOTAL STR._attemps_opponent 13851 non-null float64 \n", " 61 TD_landed_opponent 13851 non-null float64 \n", " 62 TD_attemps_opponent 13851 non-null float64 \n", " 63 HEAD_landed_opponent 13851 non-null float64 \n", " 64 HEAD_attemps_opponent 13851 non-null float64 \n", " 65 BODY_landed_opponent 13851 non-null float64 \n", " 66 BODY_attemps_opponent 13851 non-null float64 \n", " 67 LEG_landed_opponent 13851 non-null float64 \n", " 68 LEG_attemps_opponent 13851 non-null float64 \n", " 69 DISTANCE_landed_opponent 13851 non-null float64 \n", " 70 DISTANCE_attemps_opponent 13851 non-null float64 \n", " 71 CLINCH_landed_opponent 13851 non-null float64 \n", " 72 CLINCH_attemps_opponent 13851 non-null float64 \n", " 73 GROUND_landed_opponent 13851 non-null float64 \n", " 74 GROUND_attemps_opponent 13851 non-null float64 \n", "dtypes: datetime64[ns](1), float64(34), int32(22), int64(5), object(13)\n", "memory usage: 6.9+ MB\n" ] } ], "source": [ "df_total.info()" ] }, { "cell_type": "code", "execution_count": 126, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "EVENT 0\n", "BOUT 0\n", "DATE_Event 0\n", "WeightClass 0\n", "Tittle 0\n", " ..\n", "DISTANCE_attemps_opponent 9\n", "CLINCH_landed_opponent 9\n", "CLINCH_attemps_opponent 9\n", "GROUND_landed_opponent 9\n", "GROUND_attemps_opponent 9\n", "Length: 75, dtype: int64" ] }, "execution_count": 126, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.isna().sum()" ] }, { "cell_type": "code", "execution_count": 127, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ksOTmSYE6t-O", "outputId": "695ede02-5240-4a3e-c0d4-3f17bd9f74ab" }, "outputs": [ { "data": { "text/plain": [ "Index(['EVENT', 'BOUT', 'DATE_Event', 'WeightClass', 'Tittle', 'Women_fight',\n", " 'METHOD', 'TIME FORMAT', 'ROUND', 'TIME', 'TotalTime', 'REFEREE',\n", " 'DETAILS', 'URL', 'FIGHTER', 'Win', 'DRAW', 'No_contest',\n", " 'HEIGHT_fighter', 'WEIGHT_fighter', 'REACH_fighter', 'STANCE_fighter',\n", " 'AGE_fighter', 'fightNo_fighter', 'OPPONENT', 'HEIGHT_opponent',\n", " 'WEIGHT_opponent', 'REACH_opponent', 'STANCE_opponent', 'AGE_opponent',\n", " 'fightNo_opponent', 'KD_fighter', 'SUB.ATT_fighter', 'REV._fighter',\n", " 'CTRL_fighter', 'SIG.STR._landed_fighter', 'SIG.STR._attemps_fighter',\n", " 'TOTAL STR._landed_fighter', 'TOTAL STR._attemps_fighter',\n", " 'TD_landed_fighter', 'TD_attemps_fighter', 'HEAD_landed_fighter',\n", " 'HEAD_attemps_fighter', 'BODY_landed_fighter', 'BODY_attemps_fighter',\n", " 'LEG_landed_fighter', 'LEG_attemps_fighter', 'DISTANCE_landed_fighter',\n", " 'DISTANCE_attemps_fighter', 'CLINCH_landed_fighter',\n", " 'CLINCH_attemps_fighter', 'GROUND_landed_fighter',\n", " 'GROUND_attemps_fighter', 'KD_opponent', 'SUB.ATT_opponent',\n", " 'REV._opponent', 'CTRL_opponent', 'SIG.STR._landed_opponent',\n", " 'SIG.STR._attemps_opponent', 'TOTAL STR._landed_opponent',\n", " 'TOTAL STR._attemps_opponent', 'TD_landed_opponent',\n", " 'TD_attemps_opponent', 'HEAD_landed_opponent', 'HEAD_attemps_opponent',\n", " 'BODY_landed_opponent', 'BODY_attemps_opponent', 'LEG_landed_opponent',\n", " 'LEG_attemps_opponent', 'DISTANCE_landed_opponent',\n", " 'DISTANCE_attemps_opponent', 'CLINCH_landed_opponent',\n", " 'CLINCH_attemps_opponent', 'GROUND_landed_opponent',\n", " 'GROUND_attemps_opponent'],\n", " dtype='object')" ] }, "execution_count": 127, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.columns" ] }, { "cell_type": "code", "execution_count": 128, "metadata": { "id": "UM9uDWz39eXo" }, "outputs": [], "source": [ "cols_to_sum = ['Win', 'DRAW', 'No_contest', 'TotalTime','KD_fighter', 'SUB.ATT_fighter', 'REV._fighter',\n", " 'CTRL_fighter', 'SIG.STR._landed_fighter', 'SIG.STR._attemps_fighter',\n", " 'TOTAL STR._landed_fighter', 'TOTAL STR._attemps_fighter',\n", " 'TD_landed_fighter', 'TD_attemps_fighter', 'HEAD_landed_fighter',\n", " 'HEAD_attemps_fighter', 'BODY_landed_fighter', 'BODY_attemps_fighter',\n", " 'LEG_landed_fighter', 'LEG_attemps_fighter', 'DISTANCE_landed_fighter',\n", " 'DISTANCE_attemps_fighter', 'CLINCH_landed_fighter',\n", " 'CLINCH_attemps_fighter', 'GROUND_landed_fighter',\n", " 'GROUND_attemps_fighter', 'KD_opponent', 'SUB.ATT_opponent',\n", " 'REV._opponent', 'CTRL_opponent', 'SIG.STR._landed_opponent',\n", " 'SIG.STR._attemps_opponent', 'TOTAL STR._landed_opponent',\n", " 'TOTAL STR._attemps_opponent', 'TD_landed_opponent',\n", " 'TD_attemps_opponent', 'HEAD_landed_opponent', 'HEAD_attemps_opponent',\n", " 'BODY_landed_opponent', 'BODY_attemps_opponent', 'LEG_landed_opponent',\n", " 'LEG_attemps_opponent', 'DISTANCE_landed_opponent',\n", " 'DISTANCE_attemps_opponent', 'CLINCH_landed_opponent',\n", " 'CLINCH_attemps_opponent', 'GROUND_landed_opponent',\n", " 'GROUND_attemps_opponent']" ] }, { "cell_type": "code", "execution_count": 129, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "N5YHqVRg-UJs", "outputId": "84aa609a-8622-42c6-8e59-aa363ccc0d49" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "HEIGHT_fighter HEIGHT\n", "WEIGHT_fighter WEIGHT\n", "REACH_fighter REACH\n", "AGE_fighter AGE\n", "fightNo_fighter fightNo\n", "KD_fighter KD\n", "SUB.ATT_fighter SUB.ATT\n", "REV._fighter REV.\n", "CTRL_fighter CTRL\n", "SIG.STR._landed_fighter SIG.STR._landed\n", "SIG.STR._attemps_fighter SIG.STR._attemps\n", "TOTAL STR._landed_fighter TOTAL STR._landed\n", "TOTAL STR._attemps_fighter TOTAL STR._attemps\n", "TD_landed_fighter TD_landed\n", "TD_attemps_fighter TD_attemps\n", "HEAD_landed_fighter HEAD_landed\n", "HEAD_attemps_fighter HEAD_attemps\n", "BODY_landed_fighter BODY_landed\n", "BODY_attemps_fighter BODY_attemps\n", "LEG_landed_fighter LEG_landed\n", "LEG_attemps_fighter LEG_attemps\n", "DISTANCE_landed_fighter DISTANCE_landed\n", "DISTANCE_attemps_fighter DISTANCE_attemps\n", "CLINCH_landed_fighter CLINCH_landed\n", "CLINCH_attemps_fighter CLINCH_attemps\n", "GROUND_landed_fighter GROUND_landed\n", "GROUND_attemps_fighter GROUND_attemps\n" ] } ], "source": [ "for col in list(df_total.columns):\n", " if '_fighter' in col:\n", " col_prefix = col.replace('_fighter','' )\n", " if not col == 'STANCE_fighter':\n", " print(col, col_prefix)\n", " df_total.loc[:,col_prefix+'_diff'] = df_total[col].astype(float) - df_total[col_prefix +'_opponent'].astype(float)" ] }, { "cell_type": "code", "execution_count": 130, "metadata": { "id": "3aNlJ6FdbcMn" }, "outputs": [], "source": [ "def forma(fighter_name, datum):\n", " vysledek=''\n", " skore = 0\n", " koef =0.5\n", " result = ['W' if x==1 else 'L' for x in df_total['Win'][(df_total['FIGHTER']==fighter_name) & (df_total['DATE_Event']\n", "Int64Index: 13860 entries, 0 to 13859\n", "Data columns (total 104 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 EVENT 13860 non-null object \n", " 1 BOUT 13860 non-null object \n", " 2 DATE_Event 13860 non-null datetime64[ns]\n", " 3 WeightClass 13860 non-null object \n", " 4 Tittle 13860 non-null int64 \n", " 5 Women_fight 13860 non-null int64 \n", " 6 METHOD 13860 non-null object \n", " 7 TIME FORMAT 13860 non-null object \n", " 8 ROUND 13860 non-null int64 \n", " 9 TIME 13860 non-null object \n", " 10 TotalTime 13860 non-null int64 \n", " 11 REFEREE 13796 non-null object \n", " 12 DETAILS 13722 non-null object \n", " 13 URL 13860 non-null object \n", " 14 FIGHTER 13860 non-null object \n", " 15 Win 13860 non-null int32 \n", " 16 DRAW 13860 non-null int32 \n", " 17 No_contest 13860 non-null int32 \n", " 18 HEIGHT_fighter 13796 non-null float64 \n", " 19 WEIGHT_fighter 13837 non-null float64 \n", " 20 REACH_fighter 12475 non-null float64 \n", " 21 STANCE_fighter 13673 non-null object \n", " 22 AGE_fighter 13603 non-null float64 \n", " 23 fightNo_fighter 13860 non-null int64 \n", " 24 OPPONENT 13860 non-null object \n", " 25 HEIGHT_opponent 13787 non-null float64 \n", " 26 WEIGHT_opponent 13828 non-null float64 \n", " 27 REACH_opponent 12466 non-null float64 \n", " 28 STANCE_opponent 13664 non-null object \n", " 29 AGE_opponent 13594 non-null float64 \n", " 30 fightNo_opponent 13851 non-null float64 \n", " 31 KD_fighter 13860 non-null float64 \n", " 32 SUB.ATT_fighter 13860 non-null float64 \n", " 33 REV._fighter 13860 non-null float64 \n", " 34 CTRL_fighter 13860 non-null int32 \n", " 35 SIG.STR._landed_fighter 13860 non-null int32 \n", " 36 SIG.STR._attemps_fighter 13860 non-null int32 \n", " 37 TOTAL STR._landed_fighter 13860 non-null int32 \n", " 38 TOTAL STR._attemps_fighter 13860 non-null int32 \n", " 39 TD_landed_fighter 13860 non-null int32 \n", " 40 TD_attemps_fighter 13860 non-null int32 \n", " 41 HEAD_landed_fighter 13860 non-null int32 \n", " 42 HEAD_attemps_fighter 13860 non-null int32 \n", " 43 BODY_landed_fighter 13860 non-null int32 \n", " 44 BODY_attemps_fighter 13860 non-null int32 \n", " 45 LEG_landed_fighter 13860 non-null int32 \n", " 46 LEG_attemps_fighter 13860 non-null int32 \n", " 47 DISTANCE_landed_fighter 13860 non-null int32 \n", " 48 DISTANCE_attemps_fighter 13860 non-null int32 \n", " 49 CLINCH_landed_fighter 13860 non-null int32 \n", " 50 CLINCH_attemps_fighter 13860 non-null int32 \n", " 51 GROUND_landed_fighter 13860 non-null int32 \n", " 52 GROUND_attemps_fighter 13860 non-null int32 \n", " 53 KD_opponent 13851 non-null float64 \n", " 54 SUB.ATT_opponent 13851 non-null float64 \n", " 55 REV._opponent 13851 non-null float64 \n", " 56 CTRL_opponent 13851 non-null float64 \n", " 57 SIG.STR._landed_opponent 13851 non-null float64 \n", " 58 SIG.STR._attemps_opponent 13851 non-null float64 \n", " 59 TOTAL STR._landed_opponent 13851 non-null float64 \n", " 60 TOTAL STR._attemps_opponent 13851 non-null float64 \n", " 61 TD_landed_opponent 13851 non-null float64 \n", " 62 TD_attemps_opponent 13851 non-null float64 \n", " 63 HEAD_landed_opponent 13851 non-null float64 \n", " 64 HEAD_attemps_opponent 13851 non-null float64 \n", " 65 BODY_landed_opponent 13851 non-null float64 \n", " 66 BODY_attemps_opponent 13851 non-null float64 \n", " 67 LEG_landed_opponent 13851 non-null float64 \n", " 68 LEG_attemps_opponent 13851 non-null float64 \n", " 69 DISTANCE_landed_opponent 13851 non-null float64 \n", " 70 DISTANCE_attemps_opponent 13851 non-null float64 \n", " 71 CLINCH_landed_opponent 13851 non-null float64 \n", " 72 CLINCH_attemps_opponent 13851 non-null float64 \n", " 73 GROUND_landed_opponent 13851 non-null float64 \n", " 74 GROUND_attemps_opponent 13851 non-null float64 \n", " 75 HEIGHT_diff 13741 non-null float64 \n", " 76 WEIGHT_diff 13809 non-null float64 \n", " 77 REACH_diff 11613 non-null float64 \n", " 78 AGE_diff 13423 non-null float64 \n", " 79 fightNo_diff 13851 non-null float64 \n", " 80 KD_diff 13851 non-null float64 \n", " 81 SUB.ATT_diff 13851 non-null float64 \n", " 82 REV._diff 13851 non-null float64 \n", " 83 CTRL_diff 13851 non-null float64 \n", " 84 SIG.STR._landed_diff 13851 non-null float64 \n", " 85 SIG.STR._attemps_diff 13851 non-null float64 \n", " 86 TOTAL STR._landed_diff 13851 non-null float64 \n", " 87 TOTAL STR._attemps_diff 13851 non-null float64 \n", " 88 TD_landed_diff 13851 non-null float64 \n", " 89 TD_attemps_diff 13851 non-null float64 \n", " 90 HEAD_landed_diff 13851 non-null float64 \n", " 91 HEAD_attemps_diff 13851 non-null float64 \n", " 92 BODY_landed_diff 13851 non-null float64 \n", " 93 BODY_attemps_diff 13851 non-null float64 \n", " 94 LEG_landed_diff 13851 non-null float64 \n", " 95 LEG_attemps_diff 13851 non-null float64 \n", " 96 DISTANCE_landed_diff 13851 non-null float64 \n", " 97 DISTANCE_attemps_diff 13851 non-null float64 \n", " 98 CLINCH_landed_diff 13851 non-null float64 \n", " 99 CLINCH_attemps_diff 13851 non-null float64 \n", " 100 GROUND_landed_diff 13851 non-null float64 \n", " 101 GROUND_attemps_diff 13851 non-null float64 \n", " 102 form_skore_fighter 13860 non-null float64 \n", " 103 form_skore_opponent 13860 non-null float64 \n", "dtypes: datetime64[ns](1), float64(63), int32(22), int64(5), object(13)\n", "memory usage: 9.9+ MB\n" ] } ], "source": [ "df_total.info(verbose=True, show_counts=True)" ] }, { "cell_type": "code", "execution_count": 133, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 363 }, "id": "LClH41xub8C9", "outputId": "77af563b-b9a5-4d5a-a83a-d0edf7f54525" }, "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", "
FIGHTERform_skore_fighter
13850Blagoy Ivanov0.1
13851Marcin Tybura0.7
13852HyunSung Park0.0
13853SeungGuk Choi0.0
13854Jesus Aguilar0.0
13855Tatsuro Taira0.9
13856Rinya Nakamura0.0
13857Toshiomi Kazama0.0
13858Adam Fugitt-0.5
13859Yusaku Kinoshita0.0
\n", "
" ], "text/plain": [ " FIGHTER form_skore_fighter\n", "13850 Blagoy Ivanov 0.1\n", "13851 Marcin Tybura 0.7\n", "13852 HyunSung Park 0.0\n", "13853 SeungGuk Choi 0.0\n", "13854 Jesus Aguilar 0.0\n", "13855 Tatsuro Taira 0.9\n", "13856 Rinya Nakamura 0.0\n", "13857 Toshiomi Kazama 0.0\n", "13858 Adam Fugitt -0.5\n", "13859 Yusaku Kinoshita 0.0" ] }, "execution_count": 133, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total[['FIGHTER', 'form_skore_fighter']].tail(10)" ] }, { "cell_type": "code", "execution_count": 134, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "TGNrlc1unJ84", "outputId": "f63adb6a-36a4-431c-91cd-3768bd3d7589" }, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DecisionOtherWin-strikingWin-ground
00001
10001
20001
30001
40001
...............
138550001
138560010
138570010
138580001
138590001
\n", "

13860 rows × 4 columns

\n", "
" ], "text/plain": [ " Decision Other Win-striking Win-ground\n", "0 0 0 0 1\n", "1 0 0 0 1\n", "2 0 0 0 1\n", "3 0 0 0 1\n", "4 0 0 0 1\n", "... ... ... ... ...\n", "13855 0 0 0 1\n", "13856 0 0 1 0\n", "13857 0 0 1 0\n", "13858 0 0 0 1\n", "13859 0 0 0 1\n", "\n", "[13860 rows x 4 columns]" ] }, "execution_count": 134, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dummies = pd.get_dummies(df_total['METHOD'])\n", "dummies['Other'] = dummies['Other'] + dummies['Could Not Continue'] + dummies['DQ'] + dummies['KO/TKO - injury'] + dummies['KO/TKO - other'] + dummies['Overturned'] + dummies['TKO - Doctor\\'s Stoppage']\n", "dummies = dummies.drop(['Could Not Continue', 'DQ', 'KO/TKO - injury', 'KO/TKO - other', 'Overturned','TKO - Doctor\\'s Stoppage' ], axis = 1)\n", "dummies['Win-striking'] = dummies['KO/TKO - distance'] + dummies['KO/TKO - clinch']\n", "dummies['Win-ground'] = dummies['Submission'] + dummies['KO/TKO - ground']\n", "dummies = dummies.drop(['KO/TKO - distance', 'KO/TKO - clinch', 'Submission','KO/TKO - ground'],axis=1)\n", "dummies" ] }, { "cell_type": "code", "execution_count": 135, "metadata": { "scrolled": true }, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
FIGHTERLost_DecisionLost_OtherLost-strikingLost-ground
0AJ Dobson1000
1AJ Fletcher2000
2Aalon Cruz0002
3Aaron Brink0001
4Aaron Phillips2001
..................
2212Zhang Lipeng2000
2213Zhang Tiequan2010
2214Zhang Weili1010
2215Zubaira Tukhugov3000
2216Zviad Lazishvili1000
\n", "

2217 rows × 5 columns

\n", "
" ], "text/plain": [ " FIGHTER Lost_Decision Lost_Other Lost-striking Lost-ground\n", "0 AJ Dobson 1 0 0 0\n", "1 AJ Fletcher 2 0 0 0\n", "2 Aalon Cruz 0 0 0 2\n", "3 Aaron Brink 0 0 0 1\n", "4 Aaron Phillips 2 0 0 1\n", "... ... ... ... ... ...\n", "2212 Zhang Lipeng 2 0 0 0\n", "2213 Zhang Tiequan 2 0 1 0\n", "2214 Zhang Weili 1 0 1 0\n", "2215 Zubaira Tukhugov 3 0 0 0\n", "2216 Zviad Lazishvili 1 0 0 0\n", "\n", "[2217 rows x 5 columns]" ] }, "execution_count": 135, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_method_win = df_total.loc[df_total['Win']==1,['FIGHTER', 'Win']].join(dummies).groupby('FIGHTER').sum().reset_index()\n", "df_method_win = df_method_win.drop('Win',axis=1)\n", "df_method_win.rename(columns = {'Decision':'Win_Decision', 'Other':'Win_Other'}, inplace = True)\n", "df_method_win\n", "df_method_losts = df_total.loc[df_total['Win']==0,['FIGHTER', 'Win']].join(dummies).groupby('FIGHTER').sum().reset_index()\n", "df_method_losts = df_method_losts.drop('Win',axis=1)\n", "df_method_losts.rename(columns = {'Decision':'Lost_Decision', 'Other':'Lost_Other', 'Win-striking':'Lost-striking', 'Win-ground': 'Lost-ground'}, inplace = True)\n", "df_method_losts" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 136, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2329" ] }, "execution_count": 136, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_total['FIGHTER'].unique())" ] }, { "cell_type": "code", "execution_count": 137, "metadata": {}, "outputs": [], "source": [ "df_total = df_total.fillna(0)" ] }, { "cell_type": "code", "execution_count": 138, "metadata": { "id": "22ckzPcf7_gu" }, "outputs": [], "source": [ "fighters_total_df = df_total.pivot_table(index=['FIGHTER', 'HEIGHT_fighter', 'WEIGHT_fighter', 'REACH_fighter', 'STANCE_fighter'], values=cols_to_sum, aggfunc=np.sum)[cols_to_sum].reset_index()" ] }, { "cell_type": "code", "execution_count": 139, "metadata": {}, "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", " \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", " \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", " \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", "
FIGHTERHEIGHT_fighterWEIGHT_fighterREACH_fighterSTANCE_fighterWinDRAWNo_contestTotalTimeKD_fighter...BODY_landed_opponentBODY_attemps_opponentLEG_landed_opponentLEG_attemps_opponentDISTANCE_landed_opponentDISTANCE_attemps_opponentCLINCH_landed_opponentCLINCH_attemps_opponentGROUND_landed_opponentGROUND_attemps_opponent
0AJ Dobson73.0185.076.0Orthodox0009000.0...9.09.01.01.029.057.04.07.047.064.0
1AJ Fletcher70.0170.067.0Switch00018000.0...33.042.016.018.0116.0240.013.021.040.054.0
2Aalon Cruz72.0145.078.0Switch0001850.0...1.02.02.02.09.014.07.08.049.070.0
3Aaron Brink75.0205.00.0Orthodox000550.0...0.00.01.01.02.02.00.02.00.00.0
4Aaron Phillips69.0135.071.0Southpaw00022490.0...21.030.010.013.025.060.031.040.073.0113.0
..................................................................
2325Zhang Lipeng71.0155.071.0Southpaw20036000.0...16.034.048.064.048.0146.043.056.022.043.0
2326Zhang Tiequan68.0155.069.0Orthodox10021800.0...13.018.03.03.046.0112.01.02.033.047.0
2327Zhang Weili64.0115.063.0Switch70059542.0...75.0103.0106.0147.0337.0784.040.045.026.035.0
2328Zubaira Tukhugov68.0145.068.0Orthodox50058623.0...62.0113.070.0100.0264.0777.08.017.05.05.0
2329Zviad Lazishvili66.0135.069.0Orthodox0009000.0...14.019.013.015.092.0188.00.00.00.00.0
\n", "

2330 rows × 53 columns

\n", "
" ], "text/plain": [ " FIGHTER HEIGHT_fighter WEIGHT_fighter REACH_fighter \\\n", "0 AJ Dobson 73.0 185.0 76.0 \n", "1 AJ Fletcher 70.0 170.0 67.0 \n", "2 Aalon Cruz 72.0 145.0 78.0 \n", "3 Aaron Brink 75.0 205.0 0.0 \n", "4 Aaron Phillips 69.0 135.0 71.0 \n", "... ... ... ... ... \n", "2325 Zhang Lipeng 71.0 155.0 71.0 \n", "2326 Zhang Tiequan 68.0 155.0 69.0 \n", "2327 Zhang Weili 64.0 115.0 63.0 \n", "2328 Zubaira Tukhugov 68.0 145.0 68.0 \n", "2329 Zviad Lazishvili 66.0 135.0 69.0 \n", "\n", " STANCE_fighter Win DRAW No_contest TotalTime KD_fighter ... \\\n", "0 Orthodox 0 0 0 900 0.0 ... \n", "1 Switch 0 0 0 1800 0.0 ... \n", "2 Switch 0 0 0 185 0.0 ... \n", "3 Orthodox 0 0 0 55 0.0 ... \n", "4 Southpaw 0 0 0 2249 0.0 ... \n", "... ... ... ... ... ... ... ... \n", "2325 Southpaw 2 0 0 3600 0.0 ... \n", "2326 Orthodox 1 0 0 2180 0.0 ... \n", "2327 Switch 7 0 0 5954 2.0 ... \n", "2328 Orthodox 5 0 0 5862 3.0 ... \n", "2329 Orthodox 0 0 0 900 0.0 ... \n", "\n", " BODY_landed_opponent BODY_attemps_opponent LEG_landed_opponent \\\n", "0 9.0 9.0 1.0 \n", "1 33.0 42.0 16.0 \n", "2 1.0 2.0 2.0 \n", "3 0.0 0.0 1.0 \n", "4 21.0 30.0 10.0 \n", "... ... ... ... \n", "2325 16.0 34.0 48.0 \n", "2326 13.0 18.0 3.0 \n", "2327 75.0 103.0 106.0 \n", "2328 62.0 113.0 70.0 \n", "2329 14.0 19.0 13.0 \n", "\n", " LEG_attemps_opponent DISTANCE_landed_opponent \\\n", "0 1.0 29.0 \n", "1 18.0 116.0 \n", "2 2.0 9.0 \n", "3 1.0 2.0 \n", "4 13.0 25.0 \n", "... ... ... \n", "2325 64.0 48.0 \n", "2326 3.0 46.0 \n", "2327 147.0 337.0 \n", "2328 100.0 264.0 \n", "2329 15.0 92.0 \n", "\n", " DISTANCE_attemps_opponent CLINCH_landed_opponent \\\n", "0 57.0 4.0 \n", "1 240.0 13.0 \n", "2 14.0 7.0 \n", "3 2.0 0.0 \n", "4 60.0 31.0 \n", "... ... ... \n", "2325 146.0 43.0 \n", "2326 112.0 1.0 \n", "2327 784.0 40.0 \n", "2328 777.0 8.0 \n", "2329 188.0 0.0 \n", "\n", " CLINCH_attemps_opponent GROUND_landed_opponent GROUND_attemps_opponent \n", "0 7.0 47.0 64.0 \n", "1 21.0 40.0 54.0 \n", "2 8.0 49.0 70.0 \n", "3 2.0 0.0 0.0 \n", "4 40.0 73.0 113.0 \n", "... ... ... ... \n", "2325 56.0 22.0 43.0 \n", "2326 2.0 33.0 47.0 \n", "2327 45.0 26.0 35.0 \n", "2328 17.0 5.0 5.0 \n", "2329 0.0 0.0 0.0 \n", "\n", "[2330 rows x 53 columns]" ] }, "execution_count": 139, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fighters_total_df" ] }, { "cell_type": "code", "execution_count": 140, "metadata": { "id": "WIPptJM5BYXU" }, "outputs": [], "source": [ "fighters_total_df['Fights'] = fighters_total_df['FIGHTER'].apply(lambda x: df_total['FIGHTER'].tolist().count(x))" ] }, { "cell_type": "code", "execution_count": 141, "metadata": { "id": "3TiS4nV2EbJv" }, "outputs": [], "source": [ "fighters_total_df['Lost'] = fighters_total_df['Fights'] - fighters_total_df['Win'] - fighters_total_df['DRAW'] - fighters_total_df['No_contest']" ] }, { "cell_type": "code", "execution_count": 142, "metadata": { "id": "htkTmj-BDk3B" }, "outputs": [], "source": [ "fighters_total_df = fighters_total_df[['FIGHTER', 'HEIGHT_fighter', 'WEIGHT_fighter', 'REACH_fighter',\n", " 'STANCE_fighter', 'Fights', 'Win', 'DRAW', 'Lost','No_contest' , 'TotalTime',\n", " 'KD_fighter', 'SUB.ATT_fighter', 'REV._fighter', 'CTRL_fighter',\n", " 'SIG.STR._landed_fighter', 'SIG.STR._attemps_fighter',\n", " 'TOTAL STR._landed_fighter', 'TOTAL STR._attemps_fighter',\n", " 'TD_landed_fighter', 'TD_attemps_fighter', 'HEAD_landed_fighter',\n", " 'HEAD_attemps_fighter', 'BODY_landed_fighter', 'BODY_attemps_fighter',\n", " 'LEG_landed_fighter', 'LEG_attemps_fighter', 'DISTANCE_landed_fighter',\n", " 'DISTANCE_attemps_fighter', 'CLINCH_landed_fighter',\n", " 'CLINCH_attemps_fighter', 'GROUND_landed_fighter',\n", " 'GROUND_attemps_fighter', 'KD_opponent', 'SUB.ATT_opponent',\n", " 'REV._opponent', 'CTRL_opponent', 'SIG.STR._landed_opponent',\n", " 'SIG.STR._attemps_opponent', 'TOTAL STR._landed_opponent',\n", " 'TOTAL STR._attemps_opponent', 'TD_landed_opponent',\n", " 'TD_attemps_opponent', 'HEAD_landed_opponent', 'HEAD_attemps_opponent',\n", " 'BODY_landed_opponent', 'BODY_attemps_opponent', 'LEG_landed_opponent',\n", " 'LEG_attemps_opponent', 'DISTANCE_landed_opponent',\n", " 'DISTANCE_attemps_opponent', 'CLINCH_landed_opponent',\n", " 'CLINCH_attemps_opponent', 'GROUND_landed_opponent',\n", " 'GROUND_attemps_opponent']]" ] }, { "cell_type": "code", "execution_count": 143, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 627 }, "id": "xDk05MTmFAim", "outputId": "00e0d145-8432-4bae-e61a-ef0b53dd2208" }, "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", " \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", " \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", " \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", "
FIGHTERHEIGHT_fighterWEIGHT_fighterREACH_fighterSTANCE_fighterFightsWinDRAWLostNo_contest...BODY_landed_opponentBODY_attemps_opponentLEG_landed_opponentLEG_attemps_opponentDISTANCE_landed_opponentDISTANCE_attemps_opponentCLINCH_landed_opponentCLINCH_attemps_opponentGROUND_landed_opponentGROUND_attemps_opponent
1044Jim Miller68.0155.071.0Southpaw40240151...244.0343.0111.0148.0799.02238.0162.0241.0174.0281.0
130Andrei Arlovski75.0240.077.0Orthodox39230151...204.0297.0223.0256.0904.02329.0156.0242.0158.0235.0
629Donald Cerrone73.0170.073.0Orthodox38230141...444.0668.0312.0379.01558.03375.0211.0305.056.088.0
1018Jeremy Stephens69.0145.071.0Orthodox34150181...210.0307.0261.0316.0939.02448.0108.0158.0142.0228.0
430Clay Guida67.0155.070.0Orthodox34180160...195.0277.092.0115.0847.02643.0189.0263.0114.0138.0
..................................................................
1310Kleydson Rodrigues66.0125.067.0Orthodox10010...18.025.011.013.045.092.07.010.019.025.0
1312Koji Kitao79.0350.00.0Southpaw10010...0.00.01.01.02.02.00.00.01.01.0
1317Kristian Rothaermel72.0205.00.0Open Stance10010...0.00.01.01.01.04.00.00.09.013.0
1318Kristof Midoux73.0220.00.0Orthodox10010...0.00.00.00.00.03.00.00.025.049.0
2329Zviad Lazishvili66.0135.069.0Orthodox10010...14.019.013.015.092.0188.00.00.00.00.0
\n", "

2330 rows × 55 columns

\n", "
" ], "text/plain": [ " FIGHTER HEIGHT_fighter WEIGHT_fighter REACH_fighter \\\n", "1044 Jim Miller 68.0 155.0 71.0 \n", "130 Andrei Arlovski 75.0 240.0 77.0 \n", "629 Donald Cerrone 73.0 170.0 73.0 \n", "1018 Jeremy Stephens 69.0 145.0 71.0 \n", "430 Clay Guida 67.0 155.0 70.0 \n", "... ... ... ... ... \n", "1310 Kleydson Rodrigues 66.0 125.0 67.0 \n", "1312 Koji Kitao 79.0 350.0 0.0 \n", "1317 Kristian Rothaermel 72.0 205.0 0.0 \n", "1318 Kristof Midoux 73.0 220.0 0.0 \n", "2329 Zviad Lazishvili 66.0 135.0 69.0 \n", "\n", " STANCE_fighter Fights Win DRAW Lost No_contest ... \\\n", "1044 Southpaw 40 24 0 15 1 ... \n", "130 Orthodox 39 23 0 15 1 ... \n", "629 Orthodox 38 23 0 14 1 ... \n", "1018 Orthodox 34 15 0 18 1 ... \n", "430 Orthodox 34 18 0 16 0 ... \n", "... ... ... ... ... ... ... ... \n", "1310 Orthodox 1 0 0 1 0 ... \n", "1312 Southpaw 1 0 0 1 0 ... \n", "1317 Open Stance 1 0 0 1 0 ... \n", "1318 Orthodox 1 0 0 1 0 ... \n", "2329 Orthodox 1 0 0 1 0 ... \n", "\n", " BODY_landed_opponent BODY_attemps_opponent LEG_landed_opponent \\\n", "1044 244.0 343.0 111.0 \n", "130 204.0 297.0 223.0 \n", "629 444.0 668.0 312.0 \n", "1018 210.0 307.0 261.0 \n", "430 195.0 277.0 92.0 \n", "... ... ... ... \n", "1310 18.0 25.0 11.0 \n", "1312 0.0 0.0 1.0 \n", "1317 0.0 0.0 1.0 \n", "1318 0.0 0.0 0.0 \n", "2329 14.0 19.0 13.0 \n", "\n", " LEG_attemps_opponent DISTANCE_landed_opponent \\\n", "1044 148.0 799.0 \n", "130 256.0 904.0 \n", "629 379.0 1558.0 \n", "1018 316.0 939.0 \n", "430 115.0 847.0 \n", "... ... ... \n", "1310 13.0 45.0 \n", "1312 1.0 2.0 \n", "1317 1.0 1.0 \n", "1318 0.0 0.0 \n", "2329 15.0 92.0 \n", "\n", " DISTANCE_attemps_opponent CLINCH_landed_opponent \\\n", "1044 2238.0 162.0 \n", "130 2329.0 156.0 \n", "629 3375.0 211.0 \n", "1018 2448.0 108.0 \n", "430 2643.0 189.0 \n", "... ... ... \n", "1310 92.0 7.0 \n", "1312 2.0 0.0 \n", "1317 4.0 0.0 \n", "1318 3.0 0.0 \n", "2329 188.0 0.0 \n", "\n", " CLINCH_attemps_opponent GROUND_landed_opponent GROUND_attemps_opponent \n", "1044 241.0 174.0 281.0 \n", "130 242.0 158.0 235.0 \n", "629 305.0 56.0 88.0 \n", "1018 158.0 142.0 228.0 \n", "430 263.0 114.0 138.0 \n", "... ... ... ... \n", "1310 10.0 19.0 25.0 \n", "1312 0.0 1.0 1.0 \n", "1317 0.0 9.0 13.0 \n", "1318 0.0 25.0 49.0 \n", "2329 0.0 0.0 0.0 \n", "\n", "[2330 rows x 55 columns]" ] }, "execution_count": 143, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fighters_total_df.sort_values('Fights', ascending=False)" ] }, { "cell_type": "code", "execution_count": 144, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\spravce\\AppData\\Local\\Temp\\ipykernel_81028\\2484977330.py:1: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " fighters_total_df.loc[:,\"form_skore_fighter\"] = fighters_total_df.apply(lambda x:forma(x.FIGHTER, df_total[\"DATE_Event\"].max())[1], axis=1).astype(float)\n" ] } ], "source": [ "fighters_total_df.loc[:,\"form_skore_fighter\"] = fighters_total_df.apply(lambda x:forma(x.FIGHTER, df_total[\"DATE_Event\"].max())[1], axis=1).astype(float)" ] }, { "cell_type": "code", "execution_count": 145, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "NOtjEAYYDJUo", "outputId": "4fbd935a-3087-4d48-8668-b677260e40eb" }, "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", " \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", "
FIGHTERHEIGHT_fighterWEIGHT_fighterREACH_fighterSTANCE_fighterFightsWinDRAWLostNo_contest...BODY_attemps_opponentLEG_landed_opponentLEG_attemps_opponentDISTANCE_landed_opponentDISTANCE_attemps_opponentCLINCH_landed_opponentCLINCH_attemps_opponentGROUND_landed_opponentGROUND_attemps_opponentform_skore_fighter
2325Zhang Lipeng71.0155.071.0Southpaw42020...34.048.064.048.0146.043.056.022.043.0-0.4
2326Zhang Tiequan68.0155.069.0Orthodox41030...18.03.03.046.0112.01.02.033.047.0-1.0
2327Zhang Weili64.0115.063.0Switch97020...103.0106.0147.0337.0784.040.045.026.035.00.5
2328Zubaira Tukhugov68.0145.068.0Orthodox85030...113.070.0100.0264.0777.08.017.05.05.00.1
2329Zviad Lazishvili66.0135.069.0Orthodox10010...19.013.015.092.0188.00.00.00.00.0-0.5
\n", "

5 rows × 56 columns

\n", "
" ], "text/plain": [ " FIGHTER HEIGHT_fighter WEIGHT_fighter REACH_fighter \\\n", "2325 Zhang Lipeng 71.0 155.0 71.0 \n", "2326 Zhang Tiequan 68.0 155.0 69.0 \n", "2327 Zhang Weili 64.0 115.0 63.0 \n", "2328 Zubaira Tukhugov 68.0 145.0 68.0 \n", "2329 Zviad Lazishvili 66.0 135.0 69.0 \n", "\n", " STANCE_fighter Fights Win DRAW Lost No_contest ... \\\n", "2325 Southpaw 4 2 0 2 0 ... \n", "2326 Orthodox 4 1 0 3 0 ... \n", "2327 Switch 9 7 0 2 0 ... \n", "2328 Orthodox 8 5 0 3 0 ... \n", "2329 Orthodox 1 0 0 1 0 ... \n", "\n", " BODY_attemps_opponent LEG_landed_opponent LEG_attemps_opponent \\\n", "2325 34.0 48.0 64.0 \n", "2326 18.0 3.0 3.0 \n", "2327 103.0 106.0 147.0 \n", "2328 113.0 70.0 100.0 \n", "2329 19.0 13.0 15.0 \n", "\n", " DISTANCE_landed_opponent DISTANCE_attemps_opponent \\\n", "2325 48.0 146.0 \n", "2326 46.0 112.0 \n", "2327 337.0 784.0 \n", "2328 264.0 777.0 \n", "2329 92.0 188.0 \n", "\n", " CLINCH_landed_opponent CLINCH_attemps_opponent GROUND_landed_opponent \\\n", "2325 43.0 56.0 22.0 \n", "2326 1.0 2.0 33.0 \n", "2327 40.0 45.0 26.0 \n", "2328 8.0 17.0 5.0 \n", "2329 0.0 0.0 0.0 \n", "\n", " GROUND_attemps_opponent form_skore_fighter \n", "2325 43.0 -0.4 \n", "2326 47.0 -1.0 \n", "2327 35.0 0.5 \n", "2328 5.0 0.1 \n", "2329 0.0 -0.5 \n", "\n", "[5 rows x 56 columns]" ] }, "execution_count": 145, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fighters_total_df.tail()" ] }, { "cell_type": "code", "execution_count": 146, "metadata": {}, "outputs": [], "source": [ "from datetime import date\n", "today = date.today()\n", "df_skills = fighters_total_df.copy()\n", "df_skills = df_skills.merge(df_method_win,on='FIGHTER', how='left')" ] }, { "cell_type": "code", "execution_count": 147, "metadata": {}, "outputs": [], "source": [ "df_skills = df_skills.merge(df_method_losts,on='FIGHTER', how='left')\n", "from datetime import date\n", "\n", "today = date.today()\n", "df_fighter_tott['AGE'] = (pd.to_datetime(today) - pd.to_datetime(df_fighter_tott['DOB'])).astype('\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", " \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", " \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", " \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", "
FIGHTERHEIGHT_fighterWEIGHT_fighterREACH_fighterSTANCE_fighterFightsWinDRAWLostNo_contest...form_skore_fighterWin_DecisionWin_OtherWin-strikingWin-groundLost_DecisionLost_OtherLost-strikingLost-groundAGE
0AJ Dobson73.0185.076.0Orthodox10010...-0.50.00.00.00.01.00.00.00.031.0
1AJ Fletcher70.0170.067.0Switch20020...-0.90.00.00.00.02.00.00.00.025.0
2Aalon Cruz72.0145.078.0Switch20020...-0.90.00.00.00.00.00.00.02.033.0
3Aaron Brink75.0205.00.0Orthodox10010...-0.50.00.00.00.00.00.00.01.048.0
4Aaron Phillips69.0135.071.0Southpaw30030...-1.20.00.00.00.02.00.00.01.033.0
..................................................................
2327Zhang Lipeng71.0155.071.0Southpaw42020...-0.42.00.00.00.02.00.00.00.032.0
2328Zhang Tiequan68.0155.069.0Orthodox41030...-1.00.00.00.01.02.00.01.00.044.0
2329Zhang Weili64.0115.063.0Switch97020...0.53.00.02.02.01.00.01.00.033.0
2330Zubaira Tukhugov68.0145.068.0Orthodox85030...0.13.00.01.01.03.00.00.00.032.0
2331Zviad Lazishvili66.0135.069.0Orthodox10010...-0.50.00.00.00.01.00.00.00.031.0
\n", "

2332 rows × 65 columns

\n", "" ], "text/plain": [ " FIGHTER HEIGHT_fighter WEIGHT_fighter REACH_fighter \\\n", "0 AJ Dobson 73.0 185.0 76.0 \n", "1 AJ Fletcher 70.0 170.0 67.0 \n", "2 Aalon Cruz 72.0 145.0 78.0 \n", "3 Aaron Brink 75.0 205.0 0.0 \n", "4 Aaron Phillips 69.0 135.0 71.0 \n", "... ... ... ... ... \n", "2327 Zhang Lipeng 71.0 155.0 71.0 \n", "2328 Zhang Tiequan 68.0 155.0 69.0 \n", "2329 Zhang Weili 64.0 115.0 63.0 \n", "2330 Zubaira Tukhugov 68.0 145.0 68.0 \n", "2331 Zviad Lazishvili 66.0 135.0 69.0 \n", "\n", " STANCE_fighter Fights Win DRAW Lost No_contest ... \\\n", "0 Orthodox 1 0 0 1 0 ... \n", "1 Switch 2 0 0 2 0 ... \n", "2 Switch 2 0 0 2 0 ... \n", "3 Orthodox 1 0 0 1 0 ... \n", "4 Southpaw 3 0 0 3 0 ... \n", "... ... ... ... ... ... ... ... \n", "2327 Southpaw 4 2 0 2 0 ... \n", "2328 Orthodox 4 1 0 3 0 ... \n", "2329 Switch 9 7 0 2 0 ... \n", "2330 Orthodox 8 5 0 3 0 ... \n", "2331 Orthodox 1 0 0 1 0 ... \n", "\n", " form_skore_fighter Win_Decision Win_Other Win-striking Win-ground \\\n", "0 -0.5 0.0 0.0 0.0 0.0 \n", "1 -0.9 0.0 0.0 0.0 0.0 \n", "2 -0.9 0.0 0.0 0.0 0.0 \n", "3 -0.5 0.0 0.0 0.0 0.0 \n", "4 -1.2 0.0 0.0 0.0 0.0 \n", "... ... ... ... ... ... \n", "2327 -0.4 2.0 0.0 0.0 0.0 \n", "2328 -1.0 0.0 0.0 0.0 1.0 \n", "2329 0.5 3.0 0.0 2.0 2.0 \n", "2330 0.1 3.0 0.0 1.0 1.0 \n", "2331 -0.5 0.0 0.0 0.0 0.0 \n", "\n", " Lost_Decision Lost_Other Lost-striking Lost-ground AGE \n", "0 1.0 0.0 0.0 0.0 31.0 \n", "1 2.0 0.0 0.0 0.0 25.0 \n", "2 0.0 0.0 0.0 2.0 33.0 \n", "3 0.0 0.0 0.0 1.0 48.0 \n", "4 2.0 0.0 0.0 1.0 33.0 \n", "... ... ... ... ... ... \n", "2327 2.0 0.0 0.0 0.0 32.0 \n", "2328 2.0 0.0 1.0 0.0 44.0 \n", "2329 1.0 0.0 1.0 0.0 33.0 \n", "2330 3.0 0.0 0.0 0.0 32.0 \n", "2331 1.0 0.0 0.0 0.0 31.0 \n", "\n", "[2332 rows x 65 columns]" ] }, "execution_count": 148, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_skills" ] }, { "cell_type": "code", "execution_count": 149, "metadata": {}, "outputs": [], "source": [ "percentil_fight =4\n", "df_skills['fights_coef'] = (df_skills['Fights'] - percentil_fight)/ (df_skills['Lost-ground']+1)\n", "df_skills['lost_ground_rat'] = (df_skills['Lost-ground']/df_skills['Fights'])\n", "df_skills['coef_zada'] = (df_skills['CTRL_opponent']/df_skills['TotalTime'])\n", "df_skills['ground_def_skill'] = (30*(1-df_skills['coef_zada']))+(30*(1-df_skills['lost_ground_rat']))+df_skills['fights_coef']+10\n", "\n", "df_skills['fights_coef_gr_att'] = (df_skills['Fights'] - percentil_fight)/ (df_skills['Fights'] - df_skills['Win-ground']+1)\n", "df_skills['win_ground_rat'] = (df_skills['Win-ground']/df_skills['Fights'])\n", "df_skills['coef_kontrola'] = (df_skills['CTRL_fighter']/df_skills['TotalTime'])\n", "df_skills['ground_att_skill'] = (45*df_skills['coef_kontrola'])+(45*(df_skills['win_ground_rat']))+12*df_skills['fights_coef_gr_att']+20\n", "\n", "df_skills['fights_coef_str_def'] = (df_skills['Fights'])/ (df_skills['Lost-striking']+1)\n", "df_skills['lost_str_rat'] = (df_skills['Lost-striking']/df_skills['Fights'])\n", "df_skills['coef_nohy'] = (df_skills['TotalTime'] - df_skills['CTRL_fighter'] - df_skills['CTRL_opponent'])/df_skills['TotalTime']\n", "df_skills['stand_def_skill'] = (40*(df_skills['coef_nohy']))+(40*(1-df_skills['lost_str_rat']))+df_skills['fights_coef_str_def']\n", "\n", "df_skills['fights_coef_str_att'] = (df_skills['Fights'] - percentil_fight)/ (df_skills['Fights'] - df_skills['Win-striking']+1)\n", "df_skills['win_ground_rat'] = (df_skills['Win-striking']/df_skills['Fights'])\n", "df_skills['coef_nohy'] = (df_skills['TotalTime'] - df_skills['CTRL_fighter'] - df_skills['CTRL_opponent'])/df_skills['TotalTime']\n", "df_skills['stand_att_skill'] = (45*df_skills['coef_nohy'])+(45*(df_skills['win_ground_rat']))+12*df_skills['fights_coef_str_att']+20\n", "\n", "df_skills['fights_coef_stamina'] = (df_skills['Fights']-4)/ (df_skills['Lost']+1)\n", "df_skills['avg_time'] = (df_skills['TotalTime']/df_skills['Fights']/300)\n", "df_skills['win_dec_rat'] = (df_skills['Win_Decision']/df_skills['Fights'])\n", "df_skills['stamina'] = 5*df_skills['fights_coef_stamina'] + df_skills['avg_time'] +40*df_skills['win_dec_rat']+25\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "id": "RN4xFKKjFmsF" }, "source": [ "# **df_pro_model**" ] }, { "cell_type": "code", "execution_count": 150, "metadata": { "id": "LuGM7qqrFrZ8" }, "outputs": [], "source": [ "cols_to_sum = ['Win', 'DRAW', 'No_contest', 'TotalTime','KD_fighter', 'SUB.ATT_fighter', 'REV._fighter',\n", " 'CTRL_fighter', 'SIG.STR._landed_fighter', 'SIG.STR._attemps_fighter',\n", " 'TOTAL STR._landed_fighter', 'TOTAL STR._attemps_fighter',\n", " 'TD_landed_fighter', 'TD_attemps_fighter', 'HEAD_landed_fighter',\n", " 'HEAD_attemps_fighter', 'BODY_landed_fighter', 'BODY_attemps_fighter',\n", " 'LEG_landed_fighter', 'LEG_attemps_fighter', 'DISTANCE_landed_fighter',\n", " 'DISTANCE_attemps_fighter', 'CLINCH_landed_fighter',\n", " 'CLINCH_attemps_fighter', 'GROUND_landed_fighter',\n", " 'GROUND_attemps_fighter', 'KD_opponent', 'SUB.ATT_opponent',\n", " 'REV._opponent', 'CTRL_opponent', 'SIG.STR._landed_opponent',\n", " 'SIG.STR._attemps_opponent', 'TOTAL STR._landed_opponent',\n", " 'TOTAL STR._attemps_opponent', 'TD_landed_opponent',\n", " 'TD_attemps_opponent', 'HEAD_landed_opponent', 'HEAD_attemps_opponent',\n", " 'BODY_landed_opponent', 'BODY_attemps_opponent', 'LEG_landed_opponent',\n", " 'LEG_attemps_opponent', 'DISTANCE_landed_opponent',\n", " 'DISTANCE_attemps_opponent', 'CLINCH_landed_opponent',\n", " 'CLINCH_attemps_opponent', 'GROUND_landed_opponent',\n", " 'GROUND_attemps_opponent']" ] }, { "cell_type": "code", "execution_count": 151, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 488 }, "id": "CktEalpYH9gg", "outputId": "3bc95bb7-5c15-437f-acac-0cef0cec1cd9" }, "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", " \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", " \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", " \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", "
WinDRAWNo_contestTotalTimeKD_fighterSUB.ATT_fighterREV._fighterCTRL_fighterSIG.STR._landed_fighterSIG.STR._attemps_fighter...BODY_landed_opponentBODY_attemps_opponentLEG_landed_opponentLEG_attemps_opponentDISTANCE_landed_opponentDISTANCE_attemps_opponentCLINCH_landed_opponentCLINCH_attemps_opponentGROUND_landed_opponentGROUND_attemps_opponent
0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
1NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
2NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
3NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
..................................................................
138552.00.00.01459.01.05.02.0796.079.0123.0...8.012.01.02.021.057.03.03.04.04.0
13856NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
13857NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
138580.00.00.0669.00.00.00.0111.064.0113.0...7.09.02.02.064.0127.012.017.07.07.0
13859NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", "

13860 rows × 48 columns

\n", "
" ], "text/plain": [ " Win DRAW No_contest TotalTime KD_fighter SUB.ATT_fighter \\\n", "0 NaN NaN NaN NaN NaN NaN \n", "1 NaN NaN NaN NaN NaN NaN \n", "2 NaN NaN NaN NaN NaN NaN \n", "3 NaN NaN NaN NaN NaN NaN \n", "4 NaN NaN NaN NaN NaN NaN \n", "... ... ... ... ... ... ... \n", "13855 2.0 0.0 0.0 1459.0 1.0 5.0 \n", "13856 NaN NaN NaN NaN NaN NaN \n", "13857 NaN NaN NaN NaN NaN NaN \n", "13858 0.0 0.0 0.0 669.0 0.0 0.0 \n", "13859 NaN NaN NaN NaN NaN NaN \n", "\n", " REV._fighter CTRL_fighter SIG.STR._landed_fighter \\\n", "0 NaN NaN NaN \n", "1 NaN NaN NaN \n", "2 NaN NaN NaN \n", "3 NaN NaN NaN \n", "4 NaN NaN NaN \n", "... ... ... ... \n", "13855 2.0 796.0 79.0 \n", "13856 NaN NaN NaN \n", "13857 NaN NaN NaN \n", "13858 0.0 111.0 64.0 \n", "13859 NaN NaN NaN \n", "\n", " SIG.STR._attemps_fighter ... BODY_landed_opponent \\\n", "0 NaN ... NaN \n", "1 NaN ... NaN \n", "2 NaN ... NaN \n", "3 NaN ... NaN \n", "4 NaN ... NaN \n", "... ... ... ... \n", "13855 123.0 ... 8.0 \n", "13856 NaN ... NaN \n", "13857 NaN ... NaN \n", "13858 113.0 ... 7.0 \n", "13859 NaN ... NaN \n", "\n", " BODY_attemps_opponent LEG_landed_opponent LEG_attemps_opponent \\\n", "0 NaN NaN NaN \n", "1 NaN NaN NaN \n", "2 NaN NaN NaN \n", "3 NaN NaN NaN \n", "4 NaN NaN NaN \n", "... ... ... ... \n", "13855 12.0 1.0 2.0 \n", "13856 NaN NaN NaN \n", "13857 NaN NaN NaN \n", "13858 9.0 2.0 2.0 \n", "13859 NaN NaN NaN \n", "\n", " DISTANCE_landed_opponent DISTANCE_attemps_opponent \\\n", "0 NaN NaN \n", "1 NaN NaN \n", "2 NaN NaN \n", "3 NaN NaN \n", "4 NaN NaN \n", "... ... ... \n", "13855 21.0 57.0 \n", "13856 NaN NaN \n", "13857 NaN NaN \n", "13858 64.0 127.0 \n", "13859 NaN NaN \n", "\n", " CLINCH_landed_opponent CLINCH_attemps_opponent \\\n", "0 NaN NaN \n", "1 NaN NaN \n", "2 NaN NaN \n", "3 NaN NaN \n", "4 NaN NaN \n", "... ... ... \n", "13855 3.0 3.0 \n", "13856 NaN NaN \n", "13857 NaN NaN \n", "13858 12.0 17.0 \n", "13859 NaN NaN \n", "\n", " GROUND_landed_opponent GROUND_attemps_opponent \n", "0 NaN NaN \n", "1 NaN NaN \n", "2 NaN NaN \n", "3 NaN NaN \n", "4 NaN NaN \n", "... ... ... \n", "13855 4.0 4.0 \n", "13856 NaN NaN \n", "13857 NaN NaN \n", "13858 7.0 7.0 \n", "13859 NaN NaN \n", "\n", "[13860 rows x 48 columns]" ] }, "execution_count": 151, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total.groupby('FIGHTER')[cols_to_sum].transform(lambda x: x.shift(1).cumsum())" ] }, { "cell_type": "code", "execution_count": 152, "metadata": { "id": "cObIZYumMV7Q" }, "outputs": [], "source": [ "df_pre_comp = df_total[['EVENT','BOUT', 'FIGHTER','OPPONENT','METHOD','Win','Women_fight','ROUND','HEIGHT_diff','REACH_diff','AGE_diff','form_skore_fighter', 'form_skore_opponent','fightNo_fighter','fightNo_opponent']]" ] }, { "cell_type": "code", "execution_count": 153, "metadata": { "id": "KKYE6Ph1OyiT" }, "outputs": [], "source": [ "df_pre_comp = df_pre_comp.join(df_total.groupby('FIGHTER')[cols_to_sum].transform(lambda x: x.shift(1).cumsum()),rsuffix='_tot')" ] }, { "cell_type": "code", "execution_count": 154, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 525 }, "id": "yfU1mX0LPyi2", "outputId": "2b8b8103-fec4-43d7-c4da-48d4f8a39f24", "scrolled": true }, "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", " \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", "
EVENTBOUTFIGHTEROPPONENTMETHODWinWomen_fightROUNDHEIGHT_diffREACH_diff...BODY_landed_opponentBODY_attemps_opponentLEG_landed_opponentLEG_attemps_opponentDISTANCE_landed_opponentDISTANCE_attemps_opponentCLINCH_landed_opponentCLINCH_attemps_opponentGROUND_landed_opponentGROUND_attemps_opponent
13855UFC Fight Night: Lewis vs. SpivacTatsuro Taira vs. Jesus AguilarTatsuro TairaJesus AguilarSubmission1010.00.0...8.012.01.02.021.057.03.03.04.04.0
13856UFC Fight Night: Lewis vs. SpivacToshiomi Kazama vs. Rinya NakamuraRinya NakamuraToshiomi KazamaKO/TKO - distance1010.00.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
13857UFC Fight Night: Lewis vs. SpivacToshiomi Kazama vs. Rinya NakamuraToshiomi KazamaRinya NakamuraKO/TKO - distance0010.00.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
13858UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittAdam FugittYusaku KinoshitaKO/TKO - ground1011.00.0...7.09.02.02.064.0127.012.017.07.07.0
13859UFC Fight Night: Lewis vs. SpivacYusaku Kinoshita vs. Adam FugittYusaku KinoshitaAdam FugittKO/TKO - ground001-1.00.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", "

5 rows × 63 columns

\n", "
" ], "text/plain": [ " EVENT BOUT \\\n", "13855 UFC Fight Night: Lewis vs. Spivac Tatsuro Taira vs. Jesus Aguilar \n", "13856 UFC Fight Night: Lewis vs. Spivac Toshiomi Kazama vs. Rinya Nakamura \n", "13857 UFC Fight Night: Lewis vs. Spivac Toshiomi Kazama vs. Rinya Nakamura \n", "13858 UFC Fight Night: Lewis vs. Spivac Yusaku Kinoshita vs. Adam Fugitt \n", "13859 UFC Fight Night: Lewis vs. Spivac Yusaku Kinoshita vs. Adam Fugitt \n", "\n", " FIGHTER OPPONENT METHOD Win \\\n", "13855 Tatsuro Taira Jesus Aguilar Submission 1 \n", "13856 Rinya Nakamura Toshiomi Kazama KO/TKO - distance 1 \n", "13857 Toshiomi Kazama Rinya Nakamura KO/TKO - distance 0 \n", "13858 Adam Fugitt Yusaku Kinoshita KO/TKO - ground 1 \n", "13859 Yusaku Kinoshita Adam Fugitt KO/TKO - ground 0 \n", "\n", " Women_fight ROUND HEIGHT_diff REACH_diff ... BODY_landed_opponent \\\n", "13855 0 1 0.0 0.0 ... 8.0 \n", "13856 0 1 0.0 0.0 ... NaN \n", "13857 0 1 0.0 0.0 ... NaN \n", "13858 0 1 1.0 0.0 ... 7.0 \n", "13859 0 1 -1.0 0.0 ... NaN \n", "\n", " BODY_attemps_opponent LEG_landed_opponent LEG_attemps_opponent \\\n", "13855 12.0 1.0 2.0 \n", "13856 NaN NaN NaN \n", "13857 NaN NaN NaN \n", "13858 9.0 2.0 2.0 \n", "13859 NaN NaN NaN \n", "\n", " DISTANCE_landed_opponent DISTANCE_attemps_opponent \\\n", "13855 21.0 57.0 \n", "13856 NaN NaN \n", "13857 NaN NaN \n", "13858 64.0 127.0 \n", "13859 NaN NaN \n", "\n", " CLINCH_landed_opponent CLINCH_attemps_opponent \\\n", "13855 3.0 3.0 \n", "13856 NaN NaN \n", "13857 NaN NaN \n", "13858 12.0 17.0 \n", "13859 NaN NaN \n", "\n", " GROUND_landed_opponent GROUND_attemps_opponent \n", "13855 4.0 4.0 \n", "13856 NaN NaN \n", "13857 NaN NaN \n", "13858 7.0 7.0 \n", "13859 NaN NaN \n", "\n", "[5 rows x 63 columns]" ] }, "execution_count": 154, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_pre_comp.tail()" ] }, { "cell_type": "code", "execution_count": 155, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "hwa2wkMLfpFw", "outputId": "b3cd056b-e74f-41cc-ab0e-dee869ef353e" }, "outputs": [ { "data": { "text/plain": [ "4448 1\n", "4704 3\n", "5604 1\n", "5792 1\n", "6080 2\n", "6533 2\n", "6962 1\n", "7156 2\n", "7574 5\n", "7772 2\n", "9582 4\n", "10890 1\n", "11850 2\n", "12310 1\n", "Name: ROUND, dtype: int64" ] }, "execution_count": 155, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_pre_comp[df_pre_comp['FIGHTER']=='Conor McGregor']['ROUND']" ] }, { "cell_type": "code", "execution_count": 156, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "sj8suPOnIOvX", "outputId": "358a837f-9357-4085-b515-316adfffa536" }, "outputs": [ { "data": { "text/plain": [ "EVENT 0\n", "HEIGHT_diff 0\n", "GROUND_attemps_opponent 0\n", "GROUND_landed_opponent 0\n", "CLINCH_attemps_opponent 0\n", " ..\n", "AGE_opponent 0\n", "STANCE_opponent 0\n", "REACH_opponent 0\n", "form_skore_fighter 0\n", "form_skore_opponent 0\n", "Length: 104, dtype: int64" ] }, "execution_count": 156, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_total[df_total['FIGHTER']=='David Abbott'].isna().sum().sort_values()" ] }, { "cell_type": "code", "execution_count": 157, "metadata": { "id": "mBPsSUN3tUHk" }, "outputs": [], "source": [ "df_fighter_tott.to_csv('fighter_details.csv',index=False)\n", "fighters_total_df.to_csv('fighter_total_stats.csv',index=False)\n", "df_total.to_csv('fight_with_stats.csv',index=False)\n", "df_pre_comp.to_csv('fight_with_stats_precomp.csv',index=False)\n", "df_results.to_csv('fight_result.csv',index=False)\n", "df_skills.to_csv('df_skills.csv',index=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.9.13" } }, "nbformat": 4, "nbformat_minor": 1 }