{ "cells": [ { "cell_type": "markdown", "id": "bf489cf1-2ba6-4b39-bcad-dfb9ef56588e", "metadata": {}, "source": [ "# Scrape FPL Website and Optimise Team" ] }, { "cell_type": "code", "execution_count": null, "id": "5f201372-0b43-464d-9f83-b91ade6abe7e", "metadata": { "tags": [] }, "outputs": [], "source": [ "import penaltyblog as pb" ] }, { "cell_type": "markdown", "id": "afead965-639f-4b6e-963b-023144a43a48", "metadata": {}, "source": [ "## Get the current active gameweek number" ] }, { "cell_type": "code", "execution_count": 2, "id": "c1b341b9-863e-47d1-8070-b0052d215c48", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "16" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "current_gameweek = pb.fpl.get_current_gameweek()\n", "current_gameweek" ] }, { "cell_type": "markdown", "id": "1cc903c3-f2ea-4b17-b118-e01f4fb66838", "metadata": {}, "source": [ "## Get the weekly events\n", "\n", "This contains information on who the most captainied player was for each week week, what chips were played, what the highest score was etc" ] }, { "cell_type": "code", "execution_count": 3, "id": "de134ad7-7d9c-473e-84c0-4be34c50b6c9", "metadata": { "tags": [] }, "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", "
idnamedeadline_timerelease_timeaverage_entry_scorefinisheddata_checkedhighest_scoring_entrydeadline_time_epochdeadline_time_game_offset...ranked_countoverrideschip_playsmost_selectedmost_transferred_intop_elementtop_element_infotransfers_mademost_captainedmost_vice_captained
01Gameweek 12024-08-16 17:30:00+00:00None57TrueTrue3546234.017238294000...8597356{'rules': {}, 'scoring': {}, 'element_types': ...[{'chip_name': 'bboost', 'num_played': 144974}...401.027.0328.0{'id': 328, 'points': 14}0351.0351.0
12Gameweek 22024-08-24 10:00:00+00:00None69TrueTrue9442126.017244936000...9543353{'rules': {}, 'scoring': {}, 'element_types': ...[{'chip_name': 'bboost', 'num_played': 118782}...401.0594.0177.0{'id': 177, 'points': 20}13364453351.0401.0
23Gameweek 32024-08-31 10:00:00+00:00None64TrueTrue430195.017250984000...9912161{'rules': {}, 'scoring': {}, 'element_types': ...[{'chip_name': 'bboost', 'num_played': 87334},...351.0177.0328.0{'id': 328, 'points': 17}23723836351.0328.0
34Gameweek 42024-09-14 10:00:00+00:00None51TrueTrue3560750.017263080000...10178753{'rules': {}, 'scoring': {}, 'element_types': ...[{'chip_name': 'bboost', 'num_played': 83637},...351.0129.0185.0{'id': 185, 'points': 15}25930392351.0328.0
45Gameweek 52024-09-21 10:00:00+00:00None58TrueTrue1773336.017269128000...10279610{'rules': {}, 'scoring': {}, 'element_types': ...[{'chip_name': 'bboost', 'num_played': 66447},...351.058.0180.0{'id': 180, 'points': 16}13036058351.0351.0
\n", "

5 rows × 29 columns

\n", "
" ], "text/plain": [ " id name deadline_time release_time average_entry_score \\\n", "0 1 Gameweek 1 2024-08-16 17:30:00+00:00 None 57 \n", "1 2 Gameweek 2 2024-08-24 10:00:00+00:00 None 69 \n", "2 3 Gameweek 3 2024-08-31 10:00:00+00:00 None 64 \n", "3 4 Gameweek 4 2024-09-14 10:00:00+00:00 None 51 \n", "4 5 Gameweek 5 2024-09-21 10:00:00+00:00 None 58 \n", "\n", " finished data_checked highest_scoring_entry deadline_time_epoch \\\n", "0 True True 3546234.0 1723829400 \n", "1 True True 9442126.0 1724493600 \n", "2 True True 430195.0 1725098400 \n", "3 True True 3560750.0 1726308000 \n", "4 True True 1773336.0 1726912800 \n", "\n", " deadline_time_game_offset ... ranked_count \\\n", "0 0 ... 8597356 \n", "1 0 ... 9543353 \n", "2 0 ... 9912161 \n", "3 0 ... 10178753 \n", "4 0 ... 10279610 \n", "\n", " overrides \\\n", "0 {'rules': {}, 'scoring': {}, 'element_types': ... \n", "1 {'rules': {}, 'scoring': {}, 'element_types': ... \n", "2 {'rules': {}, 'scoring': {}, 'element_types': ... \n", "3 {'rules': {}, 'scoring': {}, 'element_types': ... \n", "4 {'rules': {}, 'scoring': {}, 'element_types': ... \n", "\n", " chip_plays most_selected \\\n", "0 [{'chip_name': 'bboost', 'num_played': 144974}... 401.0 \n", "1 [{'chip_name': 'bboost', 'num_played': 118782}... 401.0 \n", "2 [{'chip_name': 'bboost', 'num_played': 87334},... 351.0 \n", "3 [{'chip_name': 'bboost', 'num_played': 83637},... 351.0 \n", "4 [{'chip_name': 'bboost', 'num_played': 66447},... 351.0 \n", "\n", " most_transferred_in top_element top_element_info \\\n", "0 27.0 328.0 {'id': 328, 'points': 14} \n", "1 594.0 177.0 {'id': 177, 'points': 20} \n", "2 177.0 328.0 {'id': 328, 'points': 17} \n", "3 129.0 185.0 {'id': 185, 'points': 15} \n", "4 58.0 180.0 {'id': 180, 'points': 16} \n", "\n", " transfers_made most_captained most_vice_captained \n", "0 0 351.0 351.0 \n", "1 13364453 351.0 401.0 \n", "2 23723836 351.0 328.0 \n", "3 25930392 351.0 328.0 \n", "4 13036058 351.0 351.0 \n", "\n", "[5 rows x 29 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "info = pb.fpl.get_gameweek_info()\n", "info.head()" ] }, { "cell_type": "markdown", "id": "9ec99fba-afd4-479b-af86-bdfbd19937cc", "metadata": {}, "source": [ "## Get Player Name to ID mappings " ] }, { "cell_type": "code", "execution_count": 4, "id": "f703862b-f8f6-4748-8c97-54cc672ece97", "metadata": { "tags": [] }, "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", "
first_namesecond_nameweb_nameid
0FábioFerreira VieiraFábio Vieira1
1GabrielFernando de JesusG.Jesus2
2Gabrieldos Santos MagalhãesGabriel3
3KaiHavertzHavertz4
4KarlHeinHein5
\n", "
" ], "text/plain": [ " first_name second_name web_name id\n", "0 Fábio Ferreira Vieira Fábio Vieira 1\n", "1 Gabriel Fernando de Jesus G.Jesus 2\n", "2 Gabriel dos Santos Magalhães Gabriel 3\n", "3 Kai Havertz Havertz 4\n", "4 Karl Hein Hein 5" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mappings = pb.fpl.get_player_id_mappings()\n", "mappings.head()" ] }, { "cell_type": "markdown", "id": "062c4777-6a7f-491d-9b9e-4151149a86b8", "metadata": { "tags": [] }, "source": [ "## Get the player data\n", "\n", "This contains information on each player, e.g. total score, total minutes played, form, current price etc" ] }, { "cell_type": "code", "execution_count": 5, "id": "5f3e96ad-1fe6-492c-a1c4-f27b8701f9cc", "metadata": { "tags": [] }, "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", "
can_transactcan_selectchance_of_playing_next_roundchance_of_playing_this_roundcodecost_change_eventcost_change_event_fallcost_change_startcost_change_start_falldreamteam_count...points_per_game_rank_typeselected_rankselected_rank_typestarts_per_90clean_sheets_per_90positionposition_shortteam_idteam_nameteam_name_short
0TrueFalse0.00.043809800-110...3106362780.000.00MidfielderMID1ArsenalARS
1TrueTrue100.0100.020565100-220...49214370.740.37ForwardFWD1ArsenalARS
2TrueTrue75.075.0226597002-22...41351.080.33DefenderDEF1ArsenalARS
3TrueTrue100.0100.021984700-111...1437101.010.29ForwardFWD1ArsenalARS
4TrueFalse0.00.046374800000...58558680.000.00GoalkeeperGKP1ArsenalARS
\n", "

5 rows × 96 columns

\n", "
" ], "text/plain": [ " can_transact can_select chance_of_playing_next_round \\\n", "0 True False 0.0 \n", "1 True True 100.0 \n", "2 True True 75.0 \n", "3 True True 100.0 \n", "4 True False 0.0 \n", "\n", " chance_of_playing_this_round code cost_change_event \\\n", "0 0.0 438098 0 \n", "1 100.0 205651 0 \n", "2 75.0 226597 0 \n", "3 100.0 219847 0 \n", "4 0.0 463748 0 \n", "\n", " cost_change_event_fall cost_change_start cost_change_start_fall \\\n", "0 0 -1 1 \n", "1 0 -2 2 \n", "2 0 2 -2 \n", "3 0 -1 1 \n", "4 0 0 0 \n", "\n", " dreamteam_count ... points_per_game_rank_type selected_rank \\\n", "0 0 ... 310 636 \n", "1 0 ... 49 214 \n", "2 2 ... 4 13 \n", "3 1 ... 14 37 \n", "4 0 ... 58 558 \n", "\n", " selected_rank_type starts_per_90 clean_sheets_per_90 position \\\n", "0 278 0.00 0.00 Midfielder \n", "1 37 0.74 0.37 Forward \n", "2 5 1.08 0.33 Defender \n", "3 10 1.01 0.29 Forward \n", "4 68 0.00 0.00 Goalkeeper \n", "\n", " position_short team_id team_name team_name_short \n", "0 MID 1 Arsenal ARS \n", "1 FWD 1 Arsenal ARS \n", "2 DEF 1 Arsenal ARS \n", "3 FWD 1 Arsenal ARS \n", "4 GKP 1 Arsenal ARS \n", "\n", "[5 rows x 96 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "players = pb.fpl.get_player_data()\n", "players.head()" ] }, { "cell_type": "markdown", "id": "42988cb5-c27d-4754-89e8-ca66a041313e", "metadata": { "tags": [] }, "source": [ "## Let's extract the data for Oleksandr Zinchenko from the data frame" ] }, { "cell_type": "code", "execution_count": 6, "id": "b8e4635e-1420-4cb4-882c-41a905cb7044", "metadata": { "tags": [] }, "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", "
can_transactcan_selectchance_of_playing_next_roundchance_of_playing_this_roundcodecost_change_eventcost_change_event_fallcost_change_startcost_change_start_falldreamteam_count...points_per_game_rank_typeselected_rankselected_rank_typestarts_per_90clean_sheets_per_90positionposition_shortteam_idteam_nameteam_name_short
20TrueTrue75.0100.020632500-220...50204820.770.77DefenderDEF1ArsenalARS
\n", "

1 rows × 96 columns

\n", "
" ], "text/plain": [ " can_transact can_select chance_of_playing_next_round \\\n", "20 True True 75.0 \n", "\n", " chance_of_playing_this_round code cost_change_event \\\n", "20 100.0 206325 0 \n", "\n", " cost_change_event_fall cost_change_start cost_change_start_fall \\\n", "20 0 -2 2 \n", "\n", " dreamteam_count ... points_per_game_rank_type selected_rank \\\n", "20 0 ... 50 204 \n", "\n", " selected_rank_type starts_per_90 clean_sheets_per_90 position \\\n", "20 82 0.77 0.77 Defender \n", "\n", " position_short team_id team_name team_name_short \n", "20 DEF 1 Arsenal ARS \n", "\n", "[1 rows x 96 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "zincs = mappings.query(\"web_name == 'Zinchenko'\")\n", "zincs_id = zincs[\"id\"].iloc[0]\n", "players.query(\"id == @zincs_id\")" ] }, { "cell_type": "markdown", "id": "0f091655-3cd9-4c3c-bfe8-397f245cb96e", "metadata": { "tags": [] }, "source": [ "## Now extract the data about goalkeepers" ] }, { "cell_type": "code", "execution_count": 7, "id": "0895da76-2e03-4f6f-9618-278897d48909", "metadata": { "tags": [] }, "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", "
idfirst_namesecond_namepositiontotal_pointsminutes
466383AndréOnanaGoalkeeper651350
536443MatzSelsGoalkeeper621350
1115DavidRaya MartinGoalkeeper581350
276235JordanPickfordGoalkeeper581260
234201DeanHendersonGoalkeeper531350
\n", "
" ], "text/plain": [ " id first_name second_name position total_points minutes\n", "466 383 André Onana Goalkeeper 65 1350\n", "536 443 Matz Sels Goalkeeper 62 1350\n", "11 15 David Raya Martin Goalkeeper 58 1350\n", "276 235 Jordan Pickford Goalkeeper 58 1260\n", "234 201 Dean Henderson Goalkeeper 53 1350" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "players.query(\"position_short == 'GKP'\")[\n", " [\"id\", \"first_name\", \"second_name\", \"position\", \"total_points\", \"minutes\"]\n", "].sort_values(\"total_points\", ascending=False).head()" ] }, { "cell_type": "markdown", "id": "836a5e8b-f7b7-427b-9468-139b177592c9", "metadata": {}, "source": [ "## Get Zinchenko's history by week for current season" ] }, { "cell_type": "code", "execution_count": 8, "id": "e9b7be83-5242-44ca-9cfc-2d77810d0a6e", "metadata": { "tags": [] }, "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", "
elementfixtureopponent_teamtotal_pointswas_homekickoff_timeteam_h_scoreteam_a_scoreroundmodified...startsexpected_goalsexpected_assistsexpected_goal_involvementsexpected_goals_concededvaluetransfers_balanceselectedtransfers_intransfers_out
0252206True2024-08-17 14:00:00+00:00201False...10.000.040.040.325.0023022300
1251120False2024-08-24 16:30:00+00:00022False...00.000.000.000.005.0236133128064600322390
2252151True2024-08-31 11:30:00+00:00113False...00.000.000.000.285.0-560482643081658472632
32539180False2024-09-15 13:00:00+00:00014False...00.000.000.000.004.9-45776227563985255628
42547130False2024-09-22 15:30:00+00:00225False...00.000.000.000.004.9-44677184385117345850
52551110True2024-09-28 14:00:00+00:00426False...00.000.000.000.004.8-4009814488216440262
62561170True2024-10-05 14:00:00+00:00317False...00.000.000.000.004.8-239351215408424019
7257130False2024-10-19 16:30:00+00:00208False...00.000.000.000.004.8-993711209510310040
82581120True2024-10-27 16:30:00+00:00229False...00.000.000.000.004.8-151911148810542573
92596151False2024-11-02 12:30:00+00:001010False...00.000.010.010.084.8-151511091618593374
102510360False2024-11-10 16:30:00+00:001111False...00.000.000.000.004.8-171110986911322843
1125111161True2024-11-23 15:00:00+00:003012False...00.000.000.000.174.8-92810988817062634
1225129191False2024-11-30 17:30:00+00:002513False...00.000.020.020.744.8-80710962610861893
1325131145True2024-12-04 20:15:00+00:002014False...10.060.010.070.144.8-11181089149602078
142514590False2024-12-08 14:00:00+00:001115False...00.000.000.000.004.8294011277443791439
\n", "

15 rows × 37 columns

\n", "
" ], "text/plain": [ " element fixture opponent_team total_points was_home \\\n", "0 25 2 20 6 True \n", "1 25 11 2 0 False \n", "2 25 21 5 1 True \n", "3 25 39 18 0 False \n", "4 25 47 13 0 False \n", "5 25 51 11 0 True \n", "6 25 61 17 0 True \n", "7 25 71 3 0 False \n", "8 25 81 12 0 True \n", "9 25 96 15 1 False \n", "10 25 103 6 0 False \n", "11 25 111 16 1 True \n", "12 25 129 19 1 False \n", "13 25 131 14 5 True \n", "14 25 145 9 0 False \n", "\n", " kickoff_time team_h_score team_a_score round modified \\\n", "0 2024-08-17 14:00:00+00:00 2 0 1 False \n", "1 2024-08-24 16:30:00+00:00 0 2 2 False \n", "2 2024-08-31 11:30:00+00:00 1 1 3 False \n", "3 2024-09-15 13:00:00+00:00 0 1 4 False \n", "4 2024-09-22 15:30:00+00:00 2 2 5 False \n", "5 2024-09-28 14:00:00+00:00 4 2 6 False \n", "6 2024-10-05 14:00:00+00:00 3 1 7 False \n", "7 2024-10-19 16:30:00+00:00 2 0 8 False \n", "8 2024-10-27 16:30:00+00:00 2 2 9 False \n", "9 2024-11-02 12:30:00+00:00 1 0 10 False \n", "10 2024-11-10 16:30:00+00:00 1 1 11 False \n", "11 2024-11-23 15:00:00+00:00 3 0 12 False \n", "12 2024-11-30 17:30:00+00:00 2 5 13 False \n", "13 2024-12-04 20:15:00+00:00 2 0 14 False \n", "14 2024-12-08 14:00:00+00:00 1 1 15 False \n", "\n", " ... starts expected_goals expected_assists expected_goal_involvements \\\n", "0 ... 1 0.00 0.04 0.04 \n", "1 ... 0 0.00 0.00 0.00 \n", "2 ... 0 0.00 0.00 0.00 \n", "3 ... 0 0.00 0.00 0.00 \n", "4 ... 0 0.00 0.00 0.00 \n", "5 ... 0 0.00 0.00 0.00 \n", "6 ... 0 0.00 0.00 0.00 \n", "7 ... 0 0.00 0.00 0.00 \n", "8 ... 0 0.00 0.00 0.00 \n", "9 ... 0 0.00 0.01 0.01 \n", "10 ... 0 0.00 0.00 0.00 \n", "11 ... 0 0.00 0.00 0.00 \n", "12 ... 0 0.00 0.02 0.02 \n", "13 ... 1 0.06 0.01 0.07 \n", "14 ... 0 0.00 0.00 0.00 \n", "\n", " expected_goals_conceded value transfers_balance selected transfers_in \\\n", "0 0.32 5.0 0 230223 0 \n", "1 0.00 5.0 23613 312806 46003 \n", "2 0.28 5.0 -56048 264308 16584 \n", "3 0.00 4.9 -45776 227563 9852 \n", "4 0.00 4.9 -44677 184385 1173 \n", "5 0.00 4.8 -40098 144882 164 \n", "6 0.00 4.8 -23935 121540 84 \n", "7 0.00 4.8 -9937 112095 103 \n", "8 0.00 4.8 -1519 111488 1054 \n", "9 0.08 4.8 -1515 110916 1859 \n", "10 0.00 4.8 -1711 109869 1132 \n", "11 0.17 4.8 -928 109888 1706 \n", "12 0.74 4.8 -807 109626 1086 \n", "13 0.14 4.8 -1118 108914 960 \n", "14 0.00 4.8 2940 112774 4379 \n", "\n", " transfers_out \n", "0 0 \n", "1 22390 \n", "2 72632 \n", "3 55628 \n", "4 45850 \n", "5 40262 \n", "6 24019 \n", "7 10040 \n", "8 2573 \n", "9 3374 \n", "10 2843 \n", "11 2634 \n", "12 1893 \n", "13 2078 \n", "14 1439 \n", "\n", "[15 rows x 37 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "history = pb.fpl.get_player_history(zincs_id)\n", "history" ] }, { "cell_type": "markdown", "id": "86fe2b45-9529-4a20-bbc4-1fb580afa1a1", "metadata": {}, "source": [ "## Fetch the current top 50 ranked FPL teams" ] }, { "cell_type": "code", "execution_count": 9, "id": "39b1f868-79b9-4c56-8559-7be7e3b5c1e6", "metadata": { "tags": [] }, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idevent_totalplayer_nameranklast_rankrank_sorttotalentryentry_namehas_played
05646397761yassine hilmi111111467901123ALLA ALLAHTrue
15094123769Ayoub NACIR 🇲🇦25211016251129BB GW1True
2406940573Niels Pretorius31331097649015Holy BoehlyTrue
32094854175Dani Lio messi 🇪🇹316410973094856LIVTrue
46359787867Ollie Stannard57510957550131hazardous behaviourTrue
55829719979abdallah ali ali635610946987961abdo abdoTrue
61525590576Johnny Rouge733710912315419Obi Wan - Kenobi NilTrue
73380931078abdullah alanazi844810894684786ugly squadTrue
83317909667Doug Yellowley919910884605389The Notorious D.U.GTrue
96028969266Abdullah AlGhfeli9171010887203284Jürgen KloppTrue
101735616166Sion Nierada9151110882607470Snoop Udogie DoggTrue
11422778154Mustafa YNWA124121087673745مصطفى فؤادTrue
121365566554Pipat Boss1231310872085641Pipat FCTrue
134058847660Dara Bbat1281410875478789BurnDemAllTrue
14547239758abdul hendricks156151086865299Pep a pigTrue
15199790359Auwal SG1611161086322707ASGTrue
16638543750Harry Jones1721710861001923Kobs on the JobTrue
171073215775Kostadin Chinov18501810851661563Debel lebeDTrue
1810250192Erin Robinson1926419108418949Erin’s XITrue
193387558789Elijah Lamb201992010844693003Neville Wears PradaTrue
20502923457Brendan Sylvester219211084797171Bukayo's SadzaTrue
216348078082Medo Styen221052210837537842الاسطيTrue
22104947358Harrison Lenihan2312231083172621Max O’DearyTrue
237243263860Alex Hirkjolen2492410838448461BlueberriesTrue
24694907161vjeran horvat25212510811091388StudentgrađaninTrue
254899032567Derek SHANKS26392610806085606Que Salah SalahTrue
262268217564Thanan Nuannukun27312710793328748ยอดทีมUnitedTrue
271238554976JAMIE WALKER28852810791901957KobbieManUTrue
28507975877Ignaz Vrobel29104291079805343OlympiqueCliftonHillTrue
294154850476Innocent Kalukuta29893010795554108Kaluno CityTrue
301266014574Radhi Alqaisi31793110781941895The SeniorsTrue
31567938759Kristijan Anicic3122321078897442Stella RosaTrue
32659758155Adrian Wagstyl33143310781035135AWTrue
33394095167Fahad Al kharafi🇰🇼🇰🇼🇰🇼🇰🇼🇰🇼3447341078628608I AM PANDATrue
344725996769Mahmoud Ibrahim356335107759750037OoOdaTrue
35127077565marwen fathallah3642361077206983back of the NetoTrue
36131682693You guy My guy.37606371076214203Gus@lito.True
377063757Charlie Shepherd382438107513609Charlie’s teamTrue
386746828355Andrew Warriner38203910757948422NYC WhitesTrue
3911493361Mohamed elkabiri383740107520899Elkabiri mohamedTrue
401567080964the Big studio Ug41454110752370962Big FootballTrue
411340063369hossam Mohamed41744210752048395H&MTrue
421570491574Remon Radany411094310752375847Remon FCTrue
43456458688Yaser Hameed41440441075726395The Leader YaserTrue
44236326953Tom Warlow4517451075378441TAAnnihilationTrue
457324199359Agustio Faizy46304610758531841Muthe #1 SSKTrue
46292629765James White4753471075468901Joelinton EnjoyerTrue
473976128862Andrew Monaghan48404810745400771The VampiresTrue
483469456285Sarah Henshaw493514910744793916Fly me to the MunizTrue
49398320859Oluchukwu Obiyo4931501074634991Vee FcTrue
\n", "
" ], "text/plain": [ " id event_total player_name rank last_rank \\\n", "0 56463977 61 yassine hilmi 1 1 \n", "1 50941237 69 Ayoub NACIR 🇲🇦 2 5 \n", "2 4069405 73 Niels Pretorius 3 13 \n", "3 20948541 75 Dani Lio messi 🇪🇹 3 16 \n", "4 63597878 67 Ollie Stannard 5 7 \n", "5 58297199 79 abdallah ali ali 6 35 \n", "6 15255905 76 Johnny Rouge 7 33 \n", "7 33809310 78 abdullah alanazi 8 44 \n", "8 33179096 67 Doug Yellowley 9 19 \n", "9 60289692 66 Abdullah AlGhfeli 9 17 \n", "10 17356161 66 Sion Nierada 9 15 \n", "11 4227781 54 Mustafa YNWA 12 4 \n", "12 13655665 54 Pipat Boss 12 3 \n", "13 40588476 60 Dara Bbat 12 8 \n", "14 5472397 58 abdul hendricks 15 6 \n", "15 1997903 59 Auwal SG 16 11 \n", "16 6385437 50 Harry Jones 17 2 \n", "17 10732157 75 Kostadin Chinov 18 50 \n", "18 102501 92 Erin Robinson 19 264 \n", "19 33875587 89 Elijah Lamb 20 199 \n", "20 5029234 57 Brendan Sylvester 21 9 \n", "21 63480780 82 Medo Styen 22 105 \n", "22 1049473 58 Harrison Lenihan 23 12 \n", "23 72432638 60 Alex Hirkjolen 24 9 \n", "24 6949071 61 vjeran horvat 25 21 \n", "25 48990325 67 Derek SHANKS 26 39 \n", "26 22682175 64 Thanan Nuannukun 27 31 \n", "27 12385549 76 JAMIE WALKER 28 85 \n", "28 5079758 77 Ignaz Vrobel 29 104 \n", "29 41548504 76 Innocent Kalukuta 29 89 \n", "30 12660145 74 Radhi Alqaisi 31 79 \n", "31 5679387 59 Kristijan Anicic 31 22 \n", "32 6597581 55 Adrian Wagstyl 33 14 \n", "33 3940951 67 Fahad Al kharafi🇰🇼🇰🇼🇰🇼🇰🇼🇰🇼 34 47 \n", "34 47259967 69 Mahmoud Ibrahim 35 63 \n", "35 1270775 65 marwen fathallah 36 42 \n", "36 1316826 93 You guy My guy. 37 606 \n", "37 70637 57 Charlie Shepherd 38 24 \n", "38 67468283 55 Andrew Warriner 38 20 \n", "39 114933 61 Mohamed elkabiri 38 37 \n", "40 15670809 64 the Big studio Ug 41 45 \n", "41 13400633 69 hossam Mohamed 41 74 \n", "42 15704915 74 Remon Radany 41 109 \n", "43 4564586 88 Yaser Hameed 41 440 \n", "44 2363269 53 Tom Warlow 45 17 \n", "45 73241993 59 Agustio Faizy 46 30 \n", "46 2926297 65 James White 47 53 \n", "47 39761288 62 Andrew Monaghan 48 40 \n", "48 34694562 85 Sarah Henshaw 49 351 \n", "49 3983208 59 Oluchukwu Obiyo 49 31 \n", "\n", " rank_sort total entry entry_name has_played \n", "0 1 1114 6790112 3ALLA ALLAH True \n", "1 2 1101 6251129 BB GW1 True \n", "2 3 1097 649015 Holy Boehly True \n", "3 4 1097 3094856 LIV True \n", "4 5 1095 7550131 hazardous behaviour True \n", "5 6 1094 6987961 abdo abdo True \n", "6 7 1091 2315419 Obi Wan - Kenobi Nil True \n", "7 8 1089 4684786 ugly squad True \n", "8 9 1088 4605389 The Notorious D.U.G True \n", "9 10 1088 7203284 Jürgen Klopp True \n", "10 11 1088 2607470 Snoop Udogie Dogg True \n", "11 12 1087 673745 مصطفى فؤاد True \n", "12 13 1087 2085641 Pipat FC True \n", "13 14 1087 5478789 BurnDemAll True \n", "14 15 1086 865299 Pep a pig True \n", "15 16 1086 322707 ASG True \n", "16 17 1086 1001923 Kobs on the Job True \n", "17 18 1085 1661563 Debel lebeD True \n", "18 19 1084 18949 Erin’s XI True \n", "19 20 1084 4693003 Neville Wears Prada True \n", "20 21 1084 797171 Bukayo's Sadza True \n", "21 22 1083 7537842 الاسطي True \n", "22 23 1083 172621 Max O’Deary True \n", "23 24 1083 8448461 Blueberries True \n", "24 25 1081 1091388 Studentgrađanin True \n", "25 26 1080 6085606 Que Salah Salah True \n", "26 27 1079 3328748 ยอดทีมUnited True \n", "27 28 1079 1901957 KobbieManU True \n", "28 29 1079 805343 OlympiqueCliftonHill True \n", "29 30 1079 5554108 Kaluno City True \n", "30 31 1078 1941895 The Seniors True \n", "31 32 1078 897442 Stella Rosa True \n", "32 33 1078 1035135 AW True \n", "33 34 1078 628608 I AM PANDA True \n", "34 35 1077 5975003 7OoOda True \n", "35 36 1077 206983 back of the Neto True \n", "36 37 1076 214203 Gus@lito. True \n", "37 38 1075 13609 Charlie’s team True \n", "38 39 1075 7948422 NYC Whites True \n", "39 40 1075 20899 Elkabiri mohamed True \n", "40 41 1075 2370962 Big Football True \n", "41 42 1075 2048395 H&M True \n", "42 43 1075 2375847 Remon FC True \n", "43 44 1075 726395 The Leader Yaser True \n", "44 45 1075 378441 TAAnnihilation True \n", "45 46 1075 8531841 Muthe #1 SSK True \n", "46 47 1075 468901 Joelinton Enjoyer True \n", "47 48 1074 5400771 The Vampires True \n", "48 49 1074 4793916 Fly me to the Muniz True \n", "49 50 1074 634991 Vee Fc True " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pb.fpl.get_rankings(1)" ] }, { "cell_type": "markdown", "id": "973f539c-d91b-4782-9f0d-954649358344", "metadata": {}, "source": [ "## Fetch the FPL teams ranked 51-100" ] }, { "cell_type": "code", "execution_count": 10, "id": "89b650c0-e122-46dc-9602-d6a0e344be1f", "metadata": { "tags": [] }, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idevent_totalplayer_nameranklast_rankrank_sorttotalentryentry_namehas_played
03263358055Max Littleproud51235110744538028Levenshulme UtdTrue
12025372983Harrison Smith523145210733002723chicken tika masalaTrue
2856572566Bu Hussain53685310731338837Bu Hussain (BH)True
32074922464Abd Alwahhab Mohammad54605410723068916ربك كريمTrue
43568326171Come On You Surds551135510724906982Van de Ven DiagramsTrue
52405820671Chris Tabor551135610723506521Marginal BainesTrue
64839407569Einar Birkir Einarsson55835710726045876Saga ClubTrue
7619332370bakri ahmed5899581072972797najmTrue
8682544961Peter Amante-Roberts59485910711071595ZlatansZanyZerglingsTrue
9283083682Reidar Buskenes60359601071453429VeiholmenTrue
103421211855Ray Andre61286110714735236Turkish De LigtTrue
11145365374Mohamed Hosny61163621071235899الكابتن مدحت فقوسةTrue
12495408869Patrick O'Loghlen63106631070785876XhakaboomTrue
13399531761Simon Baker6457641070636988MarescapetovictoryTrue
142947728173james delaney641636510704134522Holy BoehlyTrue
153407300190Edward Campbell668016610704717706Saka PotatoesTrue
161044823852Jack Brennan67276710701620838Hakuna MatetaTrue
1791387361Stephen Blakemore6758681070150191Womp, womp.True
18742760955Karim Radi69366910701166488Flying Dutchman ��☠True
19889353273Joe O’Callaghan701767010691389327Mo ProblemTrue
203182109466Matt Stephenson71857110694435464B’croft Big Bears FCTrue
21716374657Eric Scott72407210691125100The DifferenceTrue
22161437253youssif mohamed7329731069261538VENOOMTrue
23118486474Matt Biemans73211741069194081Team BiemansTrue
2472650284Allan Omanovic73507751069120291BullyboyTrue
251048913461Harry Nielsen76657610681627092HarryberryTrue
26248645166Jake Poplawski7794771068398230Feel Wood IncTrue
27621981767Chris Moss77113781068976142Eze Does ItTrue
28668289464David Marco77797910681048988freepogbaTrue
292432400850Paras Poudel80268010683541677Ne FunkTrue
303427055270Anna Bowman801518110684742695Yoro wizard HarryTrue
31363344891David Cooney82988821068580349The40YearOldVirgilTrue
321794467107Dale Williams823213831068290231Harlows DreamersTrue
333601100585Haksbk 3lafekra846438410674946679True
34912054772Alex Lindholm851968510671424600AlexTrue
35571744175المهلهل ….86266861067903279الكشافTrue
36188699971Ciarán Rowland86180871067305054Rainy Night in SzoboTrue
37372865158Robb Lacey8655881067595633Trust the Process ;)True
382992084Mikołaj Ćwirko896188910675924ŚwiryTrue
39524228274salim Arbi90260901067830613Salim MadridTrue
40460357160Max Matthews9173911066732660Mount Kilman-jaroTrue
416065015365Mohammed Hassan921079210667241449محمد حسنTrue
426113107164souhaib Algérie93909310667291676Khenchela team �True
43254559171Emil Appleson93199941066407494Endo’s MenTrue
44502313075klimis xanthopoulos95286951066796202MakisTrue
4521315174Mohammed Haji9526496106636655ســـرێـــشــمــەیــیTrue
466230239773David Ionescu972479710667415805SlotMeOutTrue
47508691181Rafael Mathisen97494981066806467FK MatfisenTrue
48786409268Craig Davis971519910661233020MemyselfandiTrue
49247246155Thomas Lawlor100461001066395942T90 LWRTrue
\n", "
" ], "text/plain": [ " id event_total player_name rank last_rank rank_sort \\\n", "0 32633580 55 Max Littleproud 51 23 51 \n", "1 20253729 83 Harrison Smith 52 314 52 \n", "2 8565725 66 Bu Hussain 53 68 53 \n", "3 20749224 64 Abd Alwahhab Mohammad 54 60 54 \n", "4 35683261 71 Come On You Surds 55 113 55 \n", "5 24058206 71 Chris Tabor 55 113 56 \n", "6 48394075 69 Einar Birkir Einarsson 55 83 57 \n", "7 6193323 70 bakri ahmed 58 99 58 \n", "8 6825449 61 Peter Amante-Roberts 59 48 59 \n", "9 2830836 82 Reidar Buskenes 60 359 60 \n", "10 34212118 55 Ray Andre 61 28 61 \n", "11 1453653 74 Mohamed Hosny 61 163 62 \n", "12 4954088 69 Patrick O'Loghlen 63 106 63 \n", "13 3995317 61 Simon Baker 64 57 64 \n", "14 29477281 73 james delaney 64 163 65 \n", "15 34073001 90 Edward Campbell 66 801 66 \n", "16 10448238 52 Jack Brennan 67 27 67 \n", "17 913873 61 Stephen Blakemore 67 58 68 \n", "18 7427609 55 Karim Radi 69 36 69 \n", "19 8893532 73 Joe O’Callaghan 70 176 70 \n", "20 31821094 66 Matt Stephenson 71 85 71 \n", "21 7163746 57 Eric Scott 72 40 72 \n", "22 1614372 53 youssif mohamed 73 29 73 \n", "23 1184864 74 Matt Biemans 73 211 74 \n", "24 726502 84 Allan Omanovic 73 507 75 \n", "25 10489134 61 Harry Nielsen 76 65 76 \n", "26 2486451 66 Jake Poplawski 77 94 77 \n", "27 6219817 67 Chris Moss 77 113 78 \n", "28 6682894 64 David Marco 77 79 79 \n", "29 24324008 50 Paras Poudel 80 26 80 \n", "30 34270552 70 Anna Bowman 80 151 81 \n", "31 3633448 91 David Cooney 82 988 82 \n", "32 1794467 107 Dale Williams 82 3213 83 \n", "33 36011005 85 Haksbk 3lafekra 84 643 84 \n", "34 9120547 72 Alex Lindholm 85 196 85 \n", "35 5717441 75 المهلهل …. 86 266 86 \n", "36 1886999 71 Ciarán Rowland 86 180 87 \n", "37 3728651 58 Robb Lacey 86 55 88 \n", "38 29920 84 Mikołaj Ćwirko 89 618 89 \n", "39 5242282 74 salim Arbi 90 260 90 \n", "40 4603571 60 Max Matthews 91 73 91 \n", "41 60650153 65 Mohammed Hassan 92 107 92 \n", "42 61131071 64 souhaib Algérie 93 90 93 \n", "43 2545591 71 Emil Appleson 93 199 94 \n", "44 5023130 75 klimis xanthopoulos 95 286 95 \n", "45 213151 74 Mohammed Haji 95 264 96 \n", "46 62302397 73 David Ionescu 97 247 97 \n", "47 5086911 81 Rafael Mathisen 97 494 98 \n", "48 7864092 68 Craig Davis 97 151 99 \n", "49 2472461 55 Thomas Lawlor 100 46 100 \n", "\n", " total entry entry_name has_played \n", "0 1074 4538028 Levenshulme Utd True \n", "1 1073 3002723 chicken tika masala True \n", "2 1073 1338837 Bu Hussain (BH) True \n", "3 1072 3068916 ربك كريم True \n", "4 1072 4906982 Van de Ven Diagrams True \n", "5 1072 3506521 Marginal Baines True \n", "6 1072 6045876 Saga Club True \n", "7 1072 972797 najm True \n", "8 1071 1071595 ZlatansZanyZerglings True \n", "9 1071 453429 Veiholmen True \n", "10 1071 4735236 Turkish De Ligt True \n", "11 1071 235899 الكابتن مدحت فقوسة True \n", "12 1070 785876 Xhakaboom True \n", "13 1070 636988 Marescapetovictory True \n", "14 1070 4134522 Holy Boehly True \n", "15 1070 4717706 Saka Potatoes True \n", "16 1070 1620838 Hakuna Mateta True \n", "17 1070 150191 Womp, womp. True \n", "18 1070 1166488 Flying Dutchman ��☠ True \n", "19 1069 1389327 Mo Problem True \n", "20 1069 4435464 B’croft Big Bears FC True \n", "21 1069 1125100 The Difference True \n", "22 1069 261538 VENOOM True \n", "23 1069 194081 Team Biemans True \n", "24 1069 120291 Bullyboy True \n", "25 1068 1627092 Harryberry True \n", "26 1068 398230 Feel Wood Inc True \n", "27 1068 976142 Eze Does It True \n", "28 1068 1048988 freepogba True \n", "29 1068 3541677 Ne Funk True \n", "30 1068 4742695 Yoro wizard Harry True \n", "31 1068 580349 The40YearOldVirgil True \n", "32 1068 290231 Harlows Dreamers True \n", "33 1067 4946679 � True \n", "34 1067 1424600 Alex True \n", "35 1067 903279 الكشاف True \n", "36 1067 305054 Rainy Night in Szobo True \n", "37 1067 595633 Trust the Process ;) True \n", "38 1067 5924 Świry True \n", "39 1067 830613 Salim Madrid True \n", "40 1066 732660 Mount Kilman-jaro True \n", "41 1066 7241449 محمد حسن True \n", "42 1066 7291676 Khenchela team � True \n", "43 1066 407494 Endo’s Men True \n", "44 1066 796202 Makis True \n", "45 1066 36655 ســـرێـــشــمــەیــی True \n", "46 1066 7415805 SlotMeOut True \n", "47 1066 806467 FK Matfisen True \n", "48 1066 1233020 Memyselfandi True \n", "49 1066 395942 T90 LWR True " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pb.fpl.get_rankings(2)" ] }, { "cell_type": "markdown", "id": "9b423bbf-48ef-4278-8dbc-af0d89f51dc2", "metadata": { "tags": [] }, "source": [ "## Fetch a team's player picks by gameweek" ] }, { "cell_type": "code", "execution_count": 11, "id": "55a4bdf3-48eb-4cd9-a267-3cf3701d5c94", "metadata": { "tags": [] }, "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", "
team_idactive_chipeventpointstotal_pointsrankrank_sortoverall_rankvaluebank...player_pick_7player_pick_8player_pick_9player_pick_10player_pick_11player_pick_12player_pick_13player_pick_14captain_idis_vice_captain
04975559None15555489540850336494895408100.07.5...1640158824752044216401372
\n", "

1 rows × 34 columns

\n", "
" ], "text/plain": [ " team_id active_chip event points total_points rank rank_sort \\\n", "0 4975559 None 1 55 55 4895408 5033649 \n", "\n", " overall_rank value bank ... player_pick_7 player_pick_8 \\\n", "0 4895408 100.0 7.5 ... 16 401 \n", "\n", " player_pick_9 player_pick_10 player_pick_11 player_pick_12 player_pick_13 \\\n", "0 58 82 47 520 44 \n", "\n", " player_pick_14 captain_id is_vice_captain \n", "0 216 401 372 \n", "\n", "[1 rows x 34 columns]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "team_id = 4975559\n", "pb.fpl.get_entry_picks_by_gameweek(team_id, 1)" ] }, { "cell_type": "markdown", "id": "1517513d-f430-4dd5-bb31-f6b589f559d5", "metadata": {}, "source": [ "### Get entry's transfer history for this season" ] }, { "cell_type": "code", "execution_count": 12, "id": "52a75a61-5af4-43ef-a316-2e322515d3cf", "metadata": { "tags": [] }, "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", "
player_id_inplayer_in_costplayer_id_outplayer_out_costentryeventtime
0827.71807.94975559112024-11-08 21:58:38.532929+00:00
12525.72206.0497555992024-10-24 19:07:47.537012+00:00
21807.948.2497555992024-10-24 19:07:47.536831+00:00
3785.65147.4497555992024-10-24 19:07:47.536620+00:00
44916.73987.3497555992024-10-24 19:07:47.536384+00:00
5997.63177.4497555992024-10-24 19:07:47.536209+00:00
618210.9195.6497555992024-10-24 19:07:47.536018+00:00
7884.54224.5497555992024-10-24 19:07:47.535831+00:00
81624.63695.0497555992024-10-24 19:07:47.535638+00:00
95734.5444.5497555992024-10-24 19:07:47.535371+00:00
101454.5186.0497555992024-10-24 19:07:47.535179+00:00
111524.54135.0497555992024-10-24 19:07:47.534961+00:00
122354.8475.0497555992024-10-24 19:07:47.534506+00:00
134224.55204.4497555982024-10-18 07:13:38.487428+00:00
1448.2827.5497555972024-10-04 18:12:04.665563+00:00
15827.54018.3497555962024-09-28 06:41:03.727840+00:00
162206.01295.6497555962024-09-28 06:41:03.721162+00:00
175147.53426.6497555952024-09-20 17:50:08.943188+00:00
183277.71366.6497555942024-09-14 09:54:52.300593+00:00
191295.7827.5497555942024-09-13 16:21:03.307871+00:00
201366.6166.4497555942024-09-13 16:21:03.299689+00:00
21195.62165.0497555932024-08-31 08:32:51.029245+00:00
2235115.0589.0497555922024-08-24 08:46:07.977426+00:00
233426.63726.5497555922024-08-24 08:46:07.973476+00:00
\n", "
" ], "text/plain": [ " player_id_in player_in_cost player_id_out player_out_cost entry \\\n", "0 82 7.7 180 7.9 4975559 \n", "1 252 5.7 220 6.0 4975559 \n", "2 180 7.9 4 8.2 4975559 \n", "3 78 5.6 514 7.4 4975559 \n", "4 491 6.7 398 7.3 4975559 \n", "5 99 7.6 317 7.4 4975559 \n", "6 182 10.9 19 5.6 4975559 \n", "7 88 4.5 422 4.5 4975559 \n", "8 162 4.6 369 5.0 4975559 \n", "9 573 4.5 44 4.5 4975559 \n", "10 145 4.5 18 6.0 4975559 \n", "11 152 4.5 413 5.0 4975559 \n", "12 235 4.8 47 5.0 4975559 \n", "13 422 4.5 520 4.4 4975559 \n", "14 4 8.2 82 7.5 4975559 \n", "15 82 7.5 401 8.3 4975559 \n", "16 220 6.0 129 5.6 4975559 \n", "17 514 7.5 342 6.6 4975559 \n", "18 327 7.7 136 6.6 4975559 \n", "19 129 5.7 82 7.5 4975559 \n", "20 136 6.6 16 6.4 4975559 \n", "21 19 5.6 216 5.0 4975559 \n", "22 351 15.0 58 9.0 4975559 \n", "23 342 6.6 372 6.5 4975559 \n", "\n", " event time \n", "0 11 2024-11-08 21:58:38.532929+00:00 \n", "1 9 2024-10-24 19:07:47.537012+00:00 \n", "2 9 2024-10-24 19:07:47.536831+00:00 \n", "3 9 2024-10-24 19:07:47.536620+00:00 \n", "4 9 2024-10-24 19:07:47.536384+00:00 \n", "5 9 2024-10-24 19:07:47.536209+00:00 \n", "6 9 2024-10-24 19:07:47.536018+00:00 \n", "7 9 2024-10-24 19:07:47.535831+00:00 \n", "8 9 2024-10-24 19:07:47.535638+00:00 \n", "9 9 2024-10-24 19:07:47.535371+00:00 \n", "10 9 2024-10-24 19:07:47.535179+00:00 \n", "11 9 2024-10-24 19:07:47.534961+00:00 \n", "12 9 2024-10-24 19:07:47.534506+00:00 \n", "13 8 2024-10-18 07:13:38.487428+00:00 \n", "14 7 2024-10-04 18:12:04.665563+00:00 \n", "15 6 2024-09-28 06:41:03.727840+00:00 \n", "16 6 2024-09-28 06:41:03.721162+00:00 \n", "17 5 2024-09-20 17:50:08.943188+00:00 \n", "18 4 2024-09-14 09:54:52.300593+00:00 \n", "19 4 2024-09-13 16:21:03.307871+00:00 \n", "20 4 2024-09-13 16:21:03.299689+00:00 \n", "21 3 2024-08-31 08:32:51.029245+00:00 \n", "22 2 2024-08-24 08:46:07.977426+00:00 \n", "23 2 2024-08-24 08:46:07.973476+00:00 " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pb.fpl.get_entry_transfers(team_id)" ] }, { "cell_type": "markdown", "id": "5b076cac-4ce3-4e7f-a27c-b06337a74985", "metadata": { "tags": [] }, "source": [ "### Get optimal fantasy football squad for a budget of £100m" ] }, { "cell_type": "code", "execution_count": 13, "id": "9303fa20-3306-4d13-9f2b-06ed9c989d23", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "{'status': 'Optimal', 'total_points': 1170.0, 'total_price': np.float64(99.6)}" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "optimiser_results, team = pb.fpl.optimise_team(budget=100)\n", "\n", "optimiser_results" ] }, { "cell_type": "code", "execution_count": 14, "id": "249401f1-c4e9-447a-add5-0aec81a1ee37", "metadata": { "tags": [] }, "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", "
idfull_nameteampositionpricetotal_points
0383André OnanaMUNGKP5.265
1443Matz SelsNFOGKP4.762
2339Virgil van DijkLIVDEF6.464
33Gabriel dos Santos MagalhãesARSDEF6.260
4422Ola AinaNFODEF4.958
5238Ashley YoungEVEDEF4.657
6211Daniel MuñozCRYDEF4.750
7328Mohamed SalahLIVMID13.3151
8182Cole PalmerCHEMID11.1125
999Bryan MbeumoBREMID7.696
10247Alex IwobiFULMID5.776
11230Dwight McNeilEVEMID5.465
12447Chris WoodNFOFWD6.588
13541Matheus Santos Carneiro Da CunhaWOLFWD7.180
14110Yoane WissaBREFWD6.273
\n", "
" ], "text/plain": [ " id full_name team position price total_points\n", "0 383 André Onana MUN GKP 5.2 65\n", "1 443 Matz Sels NFO GKP 4.7 62\n", "2 339 Virgil van Dijk LIV DEF 6.4 64\n", "3 3 Gabriel dos Santos Magalhães ARS DEF 6.2 60\n", "4 422 Ola Aina NFO DEF 4.9 58\n", "5 238 Ashley Young EVE DEF 4.6 57\n", "6 211 Daniel Muñoz CRY DEF 4.7 50\n", "7 328 Mohamed Salah LIV MID 13.3 151\n", "8 182 Cole Palmer CHE MID 11.1 125\n", "9 99 Bryan Mbeumo BRE MID 7.6 96\n", "10 247 Alex Iwobi FUL MID 5.7 76\n", "11 230 Dwight McNeil EVE MID 5.4 65\n", "12 447 Chris Wood NFO FWD 6.5 88\n", "13 541 Matheus Santos Carneiro Da Cunha WOL FWD 7.1 80\n", "14 110 Yoane Wissa BRE FWD 6.2 73" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "team" ] }, { "cell_type": "markdown", "id": "a930704d-7395-4327-86dd-f36023c874a0", "metadata": { "tags": [] }, "source": [ "### Get optimal fantasy football first eleven if playing 3-5-2 if spending £85m" ] }, { "cell_type": "code", "execution_count": 15, "id": "5448ff5f-cd9f-4691-a8e2-56556c735cf3", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "{'status': 'Optimal', 'total_points': 966.0, 'total_price': np.float64(84.5)}" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "optimiser_results, team = pb.fpl.optimise_team(formation=\"1-3-5-2\", budget=85)\n", "\n", "optimiser_results" ] }, { "cell_type": "code", "execution_count": 16, "id": "d583b570-74f8-4a2d-848b-8a9b4292d774", "metadata": { "tags": [] }, "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", "
idfull_nameteampositionpricetotal_points
0383André OnanaMUNGKP5.265
1339Virgil van DijkLIVDEF6.464
23Gabriel dos Santos MagalhãesARSDEF6.260
3422Ola AinaNFODEF4.958
4328Mohamed SalahLIVMID13.3151
5182Cole PalmerCHEMID11.1125
617Bukayo SakaARSMID10.5103
799Bryan MbeumoBREMID7.696
8247Alex IwobiFULMID5.776
9447Chris WoodNFOFWD6.588
10541Matheus Santos Carneiro Da CunhaWOLFWD7.180
\n", "
" ], "text/plain": [ " id full_name team position price total_points\n", "0 383 André Onana MUN GKP 5.2 65\n", "1 339 Virgil van Dijk LIV DEF 6.4 64\n", "2 3 Gabriel dos Santos Magalhães ARS DEF 6.2 60\n", "3 422 Ola Aina NFO DEF 4.9 58\n", "4 328 Mohamed Salah LIV MID 13.3 151\n", "5 182 Cole Palmer CHE MID 11.1 125\n", "6 17 Bukayo Saka ARS MID 10.5 103\n", "7 99 Bryan Mbeumo BRE MID 7.6 96\n", "8 247 Alex Iwobi FUL MID 5.7 76\n", "9 447 Chris Wood NFO FWD 6.5 88\n", "10 541 Matheus Santos Carneiro Da Cunha WOL FWD 7.1 80" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "team" ] }, { "cell_type": "code", "execution_count": null, "id": "58eeba2f-edce-470d-b484-efe33361af68", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.1" } }, "nbformat": 4, "nbformat_minor": 5 }