摘要:在微博上收藏了一个技术贴,作者是 Savvs Tjortjoglou(Twitter:@savvas_tj)。他之前的一篇NBA投篮绘图在内地网络上挺火的,几个微信公号都有推,今天看的这一个帖子原题是:How to Track NBA Player Movements in
首先,可以进入NBA官网的stats看看,非常详细的统计,主菜单栏里Stats中有一个SportVU Player Tracking,当然还有Team Tracking。里面的可视化呈现相当美观。Intro里写到:Player Tracking is the latest example of how technology and statistics are changing the way we understand the game of basketball.
对于美国的运动数据统计能力感到惊讶!但强大的Python当然可以在自我理解下处理这些丰富的数据。
Part 1.引入模块
导入的模块大多数是比较常用的。其中的seaborn是一个统计
import seaborn as sns, numpy as np, requests, pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import IFrame
因为是可视化,接下来设计画布风格和颜色,直接参考seaborn文档,五种风格分别是:darkgrid,whitegrid,dark,white,ticks。写以下两行代码:
sns.set_color_codes()
sns.set_style(‘white’)
接着,用IFrame导入一个网站上的既有Demo。
IFrame可以将任何网页导入到IPython Notebook,其他的IDE应该也有类似的嵌入工具。
是个动态小视频,发现IFrame这么好玩,我接下来导入一个自己原来的Tableau作品,效果也是同样好。