Skip to content

Instantly share code, notes, and snippets.

┌──────────────────┬──────────┬──────────┐
│ column ┆ column_0 ┆ column_1 │
│ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str │
╞══════════════════╪══════════╪══════════╡
│ elo ┆ 1200.0 ┆ 1200.0 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
│ true_skill_mu ┆ 100.0 ┆ 100.0 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
│ true_skill_sigma ┆ 50.0 ┆ 50.0 │
ids = dfs["id"].unique()
# all players:
elo_frame = {}
true_skill_frame = {}
dates = []
count = 0
dates_to_ids = {}
dates = dfs["date"].unique()
elo_df = dfs[dfs[["id", "date"]].is_unique()][["date", "id"]]
elo_df = elo_df.with_columns([pl.lit(1200.0).alias("elo"),
[<path d="M 3.3333333333333335 93.75 L 30.948313239968687 93.75 30.948313239968687 85.93750000000003 L 103.80233264732459 85.93750000000003 103.80233264732459 78.125 L 115.75009153130098 78.125 115.75009153130098 57.812500000000014 L 139.05589203169023 57.812500000000014 139.05589203169023 62.49999999999998 L 139.84091234266273 62.49999999999998 139.84091234266273 54.6875 L 164.22223963085005 54.6875 164.22223963085005 50.00000000000004 L 181.4578692165954 50.00000000000004 181.4578692165954 54.6875 L 211.42246985995303 54.6875 211.42246985995303 37.50000000000003 L 228.16793776850767 37.50000000000003 228.16793776850767 9.375 L 228.36324081191663 9.375 228.36324081191663 17.18749999999997 L 229.6367907412213 17.18749999999997 229.6367907412213 31.250000000000014 L 252.55089711555357 31.250000000000014 252.55089711555357 45.3125 L 252.64773260782877 45.3125 252.64773260782877 59.37499999999997 L 253.72543547410493 59.37499999999997 253.72543547410493 51.5625 L 272.3401547953425 51.5625 272.3401547953425 46.87
@MichaelWS
MichaelWS / table.html
Created May 1, 2017 14:20
bestfightodds table
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="UFC Fight Night 108: Swanson vs. Lobov odds &amp; betting lines. UFC/MMA odds comparison service. Compare the latest UFC/MMA fight odds and betting lines from the top online sportsbooks" />
<meta name="keywords" content="UFC Fight Night 108: Swanson vs. Lobov, mma odds, mma betting, mma lines, ufc odds, ufc, mma, odds, betting" />
<meta property="og:image" content="https://www.bestfightodds.com/img/iconv2.jpg" />
<link href="https://fonts.googleapis.com/css?family=Roboto:500,700,400" rel="stylesheet" type="text/css" />
<script async="" src="//www.google-analytics.com/analytics.js"></script><script type="text/javascript">
if( screen.width &lt; 767 ) {
document.write( '&lt;meta name="viewport" content="width=device-width, maximum-scale=1.0, minimum
GET /q/op?s=MSFT&date=1413590400 HTTP/1.1
Host: finance.yahoo.com
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,es;q=0.6
Cookie: PREF=ID=a6c1e76064f94d39:U=827f4a5f7ace80ef:FF=0:LD=en:TM=1405040931:LM=1410201670:GM=1:S=btbAGy8zLyRsY3Qr; SID=DQAAACwCAADXppdnRkNOk3FSR5EzCt5fvxdXMAH87uz4j_4Xm2aM-zbhU5JEXVw93LhmIjRCf2B-nonvZv4hXuO_V2FYXsdOYCxigM7jpBxhd1RcK-zfzM1w5SrEa6Q5aFfBHvU6p5KkPQ8v4m8srb_k0cxAzf7x5KRlkZ5llB5oDLpiPPUhFORd7y2xobzHvIo9YJ92pv8kmCnPWnNfMUUMK6XEoov56B1SmfJ8XUTyRN3oBIe0MKAPodTznhLlB0_qzqG1ohjEIv_WoiauvWNzmLGuzmQqAuHlMswIBnF5S0ECJ7sb-6Nap9FITjCnJfrelTqTH782wJL9pC7SGlU0L1LTkBb_j1Zmy4HI2eItaNhFXy-LIWF2hX88ijAQkYas0SrBvLC7d-SC58mLuvqwW4ZHntTCkIvRv1ZUs8fQPFCLl-WbmHcHhgavmVeEGXuCNAmzcAkslJ_eBghQUlbPPOqEAzNMgWrJkAzVcQBTxhYi2P8mQ4_c91L7mFeLe_NspFLCoWLnlIyfxwfVma6fpOGpGgg3eWydiOWT-WcNzNnY6P1TrN0gIL4QZvaD7VdBkvMJVtUeFHhxjZE5535Gddg1g1N469MesuGcIEISjOtjoBMpYMjmbRvIV4UyKSTFzSiqxZxOI0uSn1w-acf5g6G4tBmbfU_kSz1ass8ZV0rmiSrnTniNGWEg635jKCcTFND4KYuUJ1T21RlRP3q3btvejbzx29uuJxwWkR5KX0
-> 302 pickle.load(open(cacs_file, 'rb'))
303
/usr/anaconda/lib/python2.7/site-packages/pandas-0.14.0_413_gf7822bd-py2.7-linux-x86_64.egg/pandas/core/internals.pyc in __setstate__(self, state)
2091 unpickle_block(values,
2092 self.axes[0].get_indexer(items))
-> 2093 for values, items in zip(bvalues, bitems))
2094
2095 self._post_setstate()
@MichaelWS
MichaelWS / tail exception
Created January 4, 2014 14:55
tail exception
/usr/anaconda/lib/python2.7/site-packages/pandas-0.13.0_16_g2c8a8ef-py2.7-linux-x86_64.egg/pandas/core/generic.pyc in tail(self, n)
1570 if abs(n) > l:
1571 n = l if n > 0 else -l
-> 1572 return self.iloc[-n:]
1573
1574 #----------------------------------------------------------------------
/usr/anaconda/lib/python2.7/site-packages/pandas-0.13.0_16_g2c8a8ef-py2.7-linux-x86_64.egg/pandas/core/indexing.pyc in __getitem__(self, key)
1018 return self._getitem_tuple(key)
1019 else:
@MichaelWS
MichaelWS / gist:8186689
Created December 30, 2013 19:22
replace traceback
ValueError Traceback (most recent call last)
<ipython-input-2-b8fda0fafe55> in <module>()
2 ibm = web.DataReader("IBM", "yahoo", "1993/01/01").reset_index()
3 next_date_dict = dict(zip(ibm["Date"], ibm["Date"].shift()))
----> 4 ibm_next_date = ibm["Date"].replace(next_date_dict)
5 print (ibm_next_date == ibm["Date"]).all()
/local/install/pandas_test/lib/python2.7/site-packages/pandas/core/series.pyc in replace(self, to_replace, value, method, inplace, limit)
2838
2839 if isinstance(to_replace, dict):
@MichaelWS
MichaelWS / terms traceback
Created December 18, 2013 03:02
pytables traceback
File "/usr/anaconda/lib/python2.7/site-packages/pandas/io/pytables.py", line 637, in select
auto_close=auto_close).get_values()
File "/usr/anaconda/lib/python2.7/site-packages/pandas/io/pytables.py", line 1311, in get_values
results = self.func(self.start, self.stop)
File "/usr/anaconda/lib/python2.7/site-packages/pandas/io/pytables.py", line 626, in func
columns=columns, **kwargs)
File "/usr/anaconda/lib/python2.7/site-packages/pandas/io/pytables.py", line 3749, in read
if not self.read_axes(where=where, **kwargs):
File "/usr/anaconda/lib/python2.7/site-packages/pandas/io/pytables.py", line 3020, in read_axes
self.selection = Selection(self, where=where, **kwargs)
@MichaelWS
MichaelWS / data
Created December 17, 2013 01:24
heads of each df
close country currency high id low open volume unadj_open unadj_close unadj_high unadj_low unadj_volume liq adj_factor dividend
date
1994-08-01 0.869021 AR ARS 0.878840 CD6N07-S-AR 0.849382 0 1344112.549706 0 1.7700 1.7900 1.7300 659922 NaN 0.490972 NaN
1994-08-01 2.279286 AR ARS 2.301203 D56641-S-AR 2.264676 0 1003886.791989 0 3.1200 3.1500 3.1000 733380 NaN 0.730541 NaN
1994-08-01 0.527021 AR ARS 0.527021 FBJJ92-S-AR 0.522788 0 1190121.444286 0 0.1245 0.1245 0.1235 5037900 NaN 4.233097 NaN
1994-08-01 38.766332 AR ARS 38.877729 J1DBW2-S-AR 38.543537 0 18402.566557