This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor | |
from itertools import repeat | |
import json | |
import pandas as pd | |
from dateutil import parser | |
import time | |
import random | |
import string | |
import pathlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in each page | |
loc = localStorage.getItem('list_of_cities') | |
if (loc == null) { | |
loc = [] | |
} | |
else { | |
loc = JSON.parse(loc) | |
} | |
a = loc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let get_all_data = () => { | |
let gws = Array.from(jQuery(".ptsshoq")).map(i => i.textContent).filter(i => i.includes('GW')).map(i => parseInt(i.split('GW')[1])) | |
let first_week = Math.min(...gws) | |
let last_week = Math.max(...gws) | |
let jsondata= jQuery("#fplr_api").text() | |
let d=JSON.parse(decodeURIComponent(escape(window.atob(jsondata)))) | |
let main_keys = ['name', 'pos', 'team_abbrev', 'now_cost', 'now_cost'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URLS = [ | |
{'year': 2023, 'month': 3, 'url': 'https://docs.google.com/spreadsheets/d/1xivGiILExvw61SrDP1sar9u-V_oSfl5yDRIAHen0tAU/'}, | |
{'year': 2023, 'month': 2, 'url': 'https://docs.google.com/spreadsheets/d/1DTmJMhxKFeSZrPdrlmD4Fq93Yim6-m7lIj2CHwDJdV0/'}, | |
{'year': 2023, 'month': 1, 'url': 'https://docs.google.com/spreadsheets/d/1tu5cshTG33b416o0OroSkvnJb7Vnk-LJ-WlhXDgBPR4/'}, | |
{'year': 2022, 'month': 12, 'url': 'https://docs.google.com/spreadsheets/d/1PS7zerHg4Qis3pFG1qIC_QFIcdJ462jQS8n9s2bnJVU/'}, | |
{'year': 2022, 'month': 11, 'url': 'https://docs.google.com/spreadsheets/d/1qfpM4iiSnzsnvKFGC3eMIWXuUZmUEynNmh15K-x094M/'}, | |
{'year': 2022, 'month': 10, 'url': 'https://docs.google.com/spreadsheets/d/1aQcs5miXsnVN8iQ2mQcNoFh2eld46VkEHpkcumsRgAk/edit#gid=631818250'}, | |
{'year': 2022, 'month': 9, 'url': 'https://docs.google.com/spreadsheets/d/15l5ebzPPwM9T35cxPH01mxTGTWzdFLux7mNd5FY-aaU/edit#gid=631818250'}, | |
{'year': 2022, 'month': 5, 'url': 'https://docs.google.com/spreadsheets/d/1JXoaovC9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_data_kiwi(target, can_use_cache=False): | |
if can_use_cache: | |
if os.path.exists(target): | |
return pd.read_csv(target) | |
raw_data = pd.read_csv("https://github.com/theFPLkiwi/webpage/raw/main/data/Projected_FPL_2223.csv") | |
# ("https://raw.githubusercontent.com/theFPLkiwi/webpage/main/data/Projected_FPL_2122.csv") | |
first_gw = int(raw_data.keys()[9]) | |
last_gw = 38 | |
col_count = last_gw - first_gw + 1 | |
raw_data.iloc[:, 9:38-9+1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import pathlib | |
import os | |
import json | |
from unicodedata import combining, normalize | |
import requests | |
from fuzzywuzzy import fuzz | |
import numpy as np | |
from abc import ABC, abstractmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unicodedata import combining, normalize | |
import pandas as pd | |
import requests | |
from fuzzywuzzy import fuzz | |
import numpy as np | |
# To remove accents in names | |
def fix_name_dialect(name): | |
new_name = ''.join([c for c in normalize('NFKD', name) if not combining(c)]) | |
return new_name.replace('Ø', 'O').replace('ø', 'o').replace('ã', 'a') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getMyRank = () => {let me = parseFloat(jQuery("#my_dataviz9 .bubbles[r=6]")[0].getAttribute("cy")); let others = jQuery("#my_dataviz9 .bubbles[r=2]").toArray().map(i => parseFloat(i.getAttribute('cy'))); return others.filter(i => i < me).length + 1}; getMyRank() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bb_gw = 29 | |
model.add_constraints((so.expr_sum(lineup[p,w] for p in players) == 11 + (4 if bb_gw == w else 0) for w in gameweeks), name='lineup_count') | |
model.add_constraints((so.expr_sum(bench[p,w,0] for p in players if player_type[p] == 1) == 1 - (1 if bb_gw == w else 0) for w in gameweeks), name='bench_gk') | |
model.add_constraints((so.expr_sum(bench[p,w,o] for p in players) == 1 - (1 if bb_gw == w else 0) for w in gameweeks for o in [1,2,3]), name='bench_count') | |
model.add_constraints((so.expr_sum(captain[p,w] for p in players) == 1 for w in gameweeks), name='captain_count') | |
model.add_constraints((so.expr_sum(vicecap[p,w] for p in players) == 1 for w in gameweeks), name='vicecap_count') | |
model.add_constraints((lineup[p,w] <= squad[p,w] for p in players for w in gameweeks), name='lineup_squad_rel') | |
model.add_constraints((bench[p,w,o] <= squad[p,w] for p in players for w in gameweeks for o in order), name='bench_squad_rel') | |
model.add_constraints((captain[p,w] <= lineup[p,w] for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let get_all_data = () => { | |
let gws = Array.from(jQuery(".ptsshoq")).map(i => i.textContent).filter(i => i.includes('GW')).map(i => parseInt(i.split('GW')[1])) | |
let first_week = Math.min(...gws) | |
let last_week = Math.max(...gws) | |
let jsondata= jQuery("#fplr_api").text() | |
let d=JSON.parse(decodeURIComponent(escape(window.atob(jsondata)))) | |
let main_keys = ['name', 'pos', 'team_abbrev', 'now_cost'] |
NewerOlder