nfl定理

NFL 2020 season is coming soon. For preview this season, I’m going to visualize some rushing data using 2019 dataset.

NFL 2020赛季即将到来。 为了预览本季,我将使用2019年数据集可视化一些紧急数据。

Please see also my article about quaterback data visualization.

另请参阅我有关四分之四数据可视化的文章。

1.概述 (1. Overview)

In this article, I’m going to use this dataset as below. Thanks to Mr. Ron Yurko.

在本文中,我将使用以下数据集。 感谢Ron Yurko先生。

There is play-by-play dataset of pre-season, regular season and play-off. I’m going to use only regular season and visualize some rusher stats. How many run yards did they have in total and on average? How is their performance when in the specific situation such as quarter, down and score behind.

有季前,常规赛和附加赛的逐项比赛数据集。 我将仅使用常规季节并可视化一些冲刺统计数据。 他们总共平均有多​​少码? 他们在特定情况下的表现如何,例如四分之一,下降,得分落后。

OK, Let’s get down to implementation.

好的,让我们开始实施。

2.预处理 (2. Preprocessing)

import pandas as pdpd.set_option(“max_columns”, 400)pbp = pd.read_csv(“play_by_play_data/regular_season/reg_pbp_2019.csv”)roster = pd.read_csv(“roster_data/regular_season/reg_roster_2019.csv”)

See the dataframe info of pbp dataset.

查看pbp数据集的数据框信息。

pbp.info()

<class ‘pandas.core.frame.DataFrame’> RangeIndex: 45546 entries, 0 to 45545 Columns: 256 entries, play_id to defensive_extra_point_conv dtypes: float64(130), int64(21), object(105) memory usage: 89.0+ MB

<class'pandas.core.frame.DataFrame'> RangeIndex:45546个条目,0到45545列:256个条目,play_id到defensive_extra_point_conv dtypes:float64(130),int64(21),object(105)内存使用量:89.0+ MB

It’s too large to visualize rushing data, so narrow down the columns. Please note “yards_gained” doesn’t include lateral rush.

它太大了,无法可视化紧急数据,因此请缩小列范围。 请注意,“ yards_gained”不包括横向奔波。

pbp_custom = pbp[  [    “game_id”    ,”game_half”    ,”qtr”    ,”time”    ,”posteam”    ,”yardline_100"    ,”down”    ,”ydstogo”    ,”yards_gained”    ,”play_type”    ,”two_point_attempt”    ,”first_down_rush”    ,”rush_attempt”    ,”rush_touchdown”    ,”rusher_player_id”    ,”rusher_player_name”    ,”score_differential”  ]].sort_values(  [    “game_id”    ,”game_half”    ,”qtr”    ,”time”  ]  ,ascending=[    True    ,True    ,True    ,False  ])

Aggregate season total rushing by player and also by player, quarter and down.

总计赛季总冲刺人数,也包括球员,季度和下降。

#Aggregate by playerrush_stats_season = pbp_custom[  (pbp_custom.two_point_attempt == 0)  & (pbp_custom.rush_attempt == 1)].groupby(  [    “rusher_player_id”    ,”rusher_player_name”  ]  ,as_index=False).agg(  {    “rush_attempt”: “sum”    ,”yards_gained”: “sum”    ,”first_down_rush”: “sum”    ,”rush_touchdown”: “sum”  })# Only who over 1000 yards in seasonrush_stats_season = rush_stats_season[  rush_stats_season.yards_gained >= 1000].sort_values([“yards_gained”], ascending=False)
rush_stats_season
rush_stats_season
#Aggregate by player, quarter and downrush_stats_details = pbp_custom[  (pbp_custom.two_point_attempt == 0)  & (pbp_custom.rush_attempt == 1)  & (pbp_custom.rusher_player_id.isin(    rush_stats_season.rusher_player_id  )) # Only who over 1000 yards in season].groupby(  [    “rusher_player_id”    ,”rusher_player_name”    ,”qtr”    ,”down”  ]  ,as_index=False).agg(  {    “rush_attempt”: “sum”    ,”yards_gained”: “sum”    ,”first_down_rush”: “sum”    ,”rush_touchdown”: “sum”  })
rush_stats_details
rush_stats_details

3.可视化 (3. Visualization)

Firstly, I visualize total yards gain ranking using histogram. Not only total yards, also visualize average yards per rushing attempt.

首先,我使用直方图可视化总码增益排名。 不仅总码,还可视化每次冲刺的平均码数。

%matplotlib inlineimport matplotlib.pyplot as pltwith plt.rc_context(  {    "axes.edgecolor":"white"    ,"xtick.color":"white"    , "ytick.color":"white"    , "figure.facecolor":"white"  }):  fig = plt.figure(figsize=(15, 8), facecolor=”black”)  ax_hist = fig.add_subplot(111, facecolor=”black”)  ax_line = ax_hist.twinx() #Share X-axis#Plot histogramax_hist.bar(  rush_stats_season.rusher_player_name  ,rush_stats_season.yards_gained  ,color = “mediumseagreen”  ,width=0.7)ax_hist.set_ylim(800, 1600)ax_hist.set_ylabel(“Total Yards”, color=”white”)#Plot line in the same axes with histogramax_line.plot(  rush_stats_season.rusher_player_name  ,rush_stats_season.yards_per_attempt  ,”chocolate”  ,linewidth=3)ax_line.set_ylim(4, 7)ax_line.set_ylabel(“Yards per Attempt”, color=”white”)

Top 5 players are all Running Back but can you see that Lamar Jackson has outstanding average yards? Almost all of the players in the ranking are 4–5 yards but he is nearly 7 (of course 4–5 is also outstanding). This means almost 1st down when he runs.

前5名选手都在跑回头,但是您能看到Lamar Jackson拥有出色的平均码吗? 排名中几乎所有球员都是4-5码,但他几乎是7码(当然4-5也很出色)。 这意味着他跑步时几乎倒下了1。

Next, from a different perspective, how about each quarter? I use heatmap in seaborn library.

接下来,从另一个角度来看,每个季度如何? 我在seaborn库中使用heatmap。

Firstly, we need to create pivot table which has player name as index, quarter as column and gained yards as value. Gained yards is aggregated total.

首先,我们需要创建数据透视表,该数据透视表的玩家名称为索引,四分之一为列,获得的码数为价值。 获得的码是总计。

rush_stats_qtr_pivot = pd.pivot_table(  data=rush_stats_details[rush_stats_details.qtr <= 4]  ,values=”yards_gained”  ,columns=”qtr”  ,index=”rusher_player_name”  ,aggfunc=”sum”)
rush_stats_qtr_pivot
rush_stats_qtr_pivot

I visualize this data as heatmap. Set pivot table as data source and can display actual value using “annot” parameter.

我将此数据可视化为热图。 将数据透视表设置为数据源,并可以使用“ annot”参数显示实际值。

import numpy as npimport seaborn as snswith plt.rc_context(  {    "axes.edgecolor":"white"    ,"xtick.color":"white"    , "ytick.color":"white"    , "figure.facecolor":"white"  }):  plt.figure(figsize=(15, 8), facecolor=”black”)  sns.heatmap(    rush_stats_qtr_pivot    ,annot=True #Display values    ,fmt=”g”    ,cmap=”Blues”  )plt.xlabel(“Quarter”, color=”white”)

Derrick Henry and Christian McCaffrey looks strong in 3rd quarter. Henry, Carlos Hyde and Nick Chubb has more yards in 4th. Meanwhile, Ezeliel Elliott is strong in 1st half.

德里克·亨利(Derrick Henry)和克里斯蒂安·麦卡弗里(Christian McCaffrey)在第三季度表现强劲。 亨利,卡洛斯·海德和尼克·丘布在第4位还有更多码。 同时,Ezeliel Elliott上半场表现强劲。

In addition, I want to see also each down. At this time, I’m going to use average yards not gross yards.

另外,我也想看看每个下来。 此时,我将使用平均码而不是总码。

#Aggregate by player and downrush_stats_down = rush_stats_details.groupby(  [    “rusher_player_name”    ,”down”  ]  ,as_index=False).agg(  {    “rush_attempt”: “sum”    ,”yards_gained”: “sum”  })rush_stats_down[“yards_per_attempt”] = round(rush_stats_down.yards_gained / rush_stats_down.rush_attempt, 1)rush_stats_down = rush_stats_down.astype({“down”: int})
rush_stats_down.head(10)
rush_stats_down.head(10)

I create pivot table again.

我再次创建数据透视表。

rush_stats_down_pivot = pd.pivot_table(  data=rush_stats_down  ,values=”yards_per_attempt”  ,columns=”down”  ,index=”rusher_player_name”  ,aggfunc=”sum”)
rush_stats_down_pivot
rush_stats_down_pivot

Visualize it.

可视化它。

with plt.rc_context(  {    "axes.edgecolor":"white"    ,"xtick.color":"white"    , "ytick.color":"white"    , "figure.facecolor":"white"  }):  plt.figure(figsize=(15, 8), facecolor=”black”)  sns.heatmap(    rush_stats_down_pivot    ,annot=True    ,fmt=”g”    ,cmap=”Blues”  )plt.xlabel(“Down”, color=”white”)

We can see many 5+ boxes in heatmap, but Jackson is outstanding. He always gains over 5 yards 1–3rd down (4th is almost 5), this means if he rushes twice Ravens gets 1st down. Why cannot we say he is the best rusher?

我们可以在热图中看到许多5个以上的方框,但杰克逊非常出色。 他总是在1到3下降时获得5码以上的距离(第4几乎是5),这意味着如果他两次冲进Ravens就会获得1下降。 为什么不能说他是最好的冲刺者?

Henry and Josh Jacobs also gains almost 5 yards every down. Can we say these three rushers are the best in NFL?

亨利(Henry)和乔什(Josh Jacobs)每次下跌都获得近5码的球。 我们可以说这三位选手是NFL最好的选手吗?

In the end, extra visualization, I create same figure using dataset which has rushing play when offense team was score behind.

最后,进行额外的可视化处理,我使用数据集创建了相同的身材,当进攻队落后时,该数据集将发挥作用。

Pay attention to Chabb, Henry, Leonard Fournette and Kenyan Drake when they are in adversity? They never give up.

在逆境中关注沙布,亨利,伦纳德·富内特和肯亚德雷克吗? 他们从不放弃。

Thank you for reading!!

谢谢您的阅读!!

翻译自: https://medium.com/the-sports-scientist/nfl-2020-preview-with-python-rushing-d24b0439a96e

nfl定理


http://www.taodudu.cc/news/show-5372725.html

相关文章:

  • biostar handbook(十)|如何进行变异检测
  • Android 锁屏状态下启动应用很慢的原因分析
  • yolov5使用知识蒸馏
  • BiometricPrompt之六 - BiometricDialogView锁屏显示
  • Nothing Ventured, Nothing Gained
  • 声控助手_我从构建声控机器人获得的见解
  • 在线查看word、excel、powerpoint文件
  • Markdown Online PPT
  • 【前端实现在线预览ppt、word、xls、pdf、视频】
  • 阿诺德Arnold渲染器 (R20-2023版本合集)
  • 用MAYA阿诺德(Arnold)渲染器渲染科幻全息线框效果经验笔记
  • 删除maya阿诺德渲染器所有AOVS层
  • marlin 源码入门3
  • marlin 源码入门2
  • marlin 源码入门1
  • Codeforces 980B Marlin(构造)
  • Marlin基础配置(转载收藏)
  • marlin固件烧录教程_marlin2.0应用到STM32实践(续)
  • 关于Marlin的一点认识
  • visual2019没有勾选的在如何加入_批量下载天猫商品时,如何过滤gif格式详情图的实例...
  • 蓝牙定位之蓝牙5.1,升级技术的优点介绍——新导智能
  • 蓝牙定位系统有什么优势
  • 蓝牙定位,多种应用方式的新技术
  • 蓝牙定位5.0技术,高精度定位,你get到了吗?--新导智能
  • 室内精准定位市场大洗牌,蓝牙定位是否会成为主流?
  • 室内外蓝牙定位巡更电子胸牌
  • 商用蓝牙定位算法剖析
  • 蓝牙定位技术未来发展的三大趋势,蓝牙定位无所不能--新导智能
  • IBeacon技术使如何实现室内蓝牙定位?室内蓝牙定位真的如此简单?
  • 蓝牙定位技术在蓝牙人员定位中的应用--新导智能

nfl定理_NFL 2020预览与python冲相关推荐

  1. nfl定理_NFL 2020预览与python团队防御

    nfl定理 NFL 2020 season is coming soon. For preview this season, I'm going to visualize some quarterba ...

  2. 看懂nfl定理需要什么知识_NFL球队为什么不经常通过?

    看懂nfl定理需要什么知识 Debunking common NFL myths in an analytical study on the true value of passing the bal ...

  3. idea网页预览功能_IDEA 2020.2 重磅发布,动画级新功能预览!

    博主关注了 IDEA 的官推,平时没事就会去看看有没有啥比较好的更新.今天下午看到IntelliJ IDEA 2020.2 都已经发布并且还支持了 Java15.然后,我就去官网简单看了一下新特性.单 ...

  4. IDEA 2020.2 重磅发布,动画级新功能预览!

    点击上方 好好学java ,选择 星标 公众号 重磅资讯.干货,第一时间送达今日推荐:2020年7月程序员工资统计,平均14357元,又跌了,扎心个人原创100W+访问量博客:点击前往,查看更多 本文 ...

  5. csv 20位数据 如何打开可以预览完整数字_干货Python Pandas 做数据分析之玩转 Excel 报表分析...

    本篇文章选自作者在 GitChat 的分享,若有什么问题,可在公众号回复「小助手」添加小助手微信,邀请你进入技术交流群. 各位朋友大家好,非常荣幸和大家聊一聊用 Python Pandas 处理 Ex ...

  6. python 在线预览文件_用Python PyQt写一个在线预览图片的GUI

    在爬完网上一篇帖子,并得到其中的所有图片链接后,写一个GUI来实现在线预览是一个很自然的想法, 相当于实现一个python版的图片浏览器, 通过这个练习,可以让我们更熟悉PyQt这个库. 这里我用的是 ...

  7. Python excel转成html页面 excel 在线预览

    Python excel转成html页面 excel 在线预览 因为这两天公司的项目要用到在浏览excel 所以就在做这个功能.一开始查了很多资料 都是各种不行,最后好不容易找到一些辅助资料 终于是今 ...

  8. Python实现多线程批量下载昵图网的清晰预览图

    我入门Python编程的一个习作:Python多线程下载昵图网的清晰预览图. 目前昵图网(nipic.com)没有限制爬虫,可以用requests来快速打开页面和下载图片. 注意:本文只是示范多线程下 ...

  9. python爬虫读取pdf_python爬虫处理在线预览的pdf文档

    引言 最近在爬一个网站,然后爬到详情页的时候发现,目标内容是用pdf在线预览的 比如如下网站: https://camelot-py.readthedocs.io/en/master/_static/ ...

最新文章

  1. 关于win8/win8.1系统不能调节亮度的解决办法
  2. java xfire下载_XFIRE教程 PDF 下载
  3. linux python3 pip3_linux环境下安装python3以及pip3
  4. 重设忘记的Mysql密码
  5. 从1.5k到18k, 一个程序员的5年成长之路(分享)
  6. 监控linux内存,linux 监控系统资源-内存
  7. jQuery插件_SuperSlide插件(焦点图切换、标签切换、多个slide组合)
  8. 计算机丢失twitchsdk,修复twitchsdk_32_release.dll
  9. Bailian2684 POJ NOI0105-34 求阶乘的和【迭代】
  10. PHP在接下来的几年内将是主主流的
  11. 一种自动(半自动)学习的算法(验证码识别)
  12. macOS软件列表及配置高效备份方案
  13. 敏捷开发模式下SDL实践
  14. bugku(Crypto)---ook
  15. 重装电脑?先来个PE盘!
  16. 数据结构之数组及动态数组剖析
  17. 实时计算 java基础:类的结构之五:内部类
  18. 利用 tesseract 自动识别图片中的文字
  19. 《摔跤吧!爸爸》—同样伟大的妈妈
  20. Python学习日志08 - 字典

热门文章

  1. 前端与移动开发-----CSS(三大特性+盒子模型原理)
  2. NBT:可重复交互式的微生物组分析平台QIIME 2(2021.4发布)
  3. IT行业含金量较高的证书考试汇总分析
  4. C语言-十进制/二进制数的互相转化
  5. POLYCOM视频会议系统应用
  6. QtCreator选择新建项目类别,各项目类别介绍
  7. 企业在选择文档加密软件的适合需要注意哪些?文档加密软件是如何实现对数据文件的加密?
  8. 实战爬取Plati官网游戏实时最低价格-Python
  9. 使用Share Sdk 实现第三方登录和分享
  10. 知+是什么?知+如何开通?如何用知+在知乎做推广?知+广告怎么投放?知+信息流投放如何优化内容?