摘要:在微博上收藏了一个技术贴,作者是 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应该也有类似的嵌入工具。

使用Python解析NBA官方API,获取球员运动数据,通过Seaborn和Matplotlib进行数据可视化,展示运动员的运动轨迹。文章介绍了如何设置画布风格、获取数据、处理数据并绘制轨迹图,特别展示了James Harden的运动轨迹。
最低0.47元/天 解锁文章
1689

被折叠的 条评论
为什么被折叠?



