在mlb,yahoo!,哥伦比亚广播公司,ESPN和Fangraphs。

baseball-id的Python项目详细描述


你是否分析了来自不同来源的棒球数据,并需要找到一种方法来关联同一个球员的数据?位于https://crunchtimebaseball.com的所有者为此目的发布map。有了这张地图,你可以从Yahoo!与来自http://baseball-reference.comhttp://fangraphs.comhttp://www.seanlahman.com等站点的数据交叉引用。这个包提供了一种在python中访问这个映射的方法。一组api允许您通过各种不同的id查找播放器。

生成状态

https://travis-ci.com/spilchen/baseball_id.svg?branch=masterDocumentation Status

安装

此软件包可以通过pip安装:

pip install baseball_id

或回购:

git clone https://github.com/spilchen/baseball_id
cd baseball_id
python setup.py install

文档

文档位于readthedocs.io:https://baseball-id.readthedocs.io/en/latest/

API使用示例

In [1]: from baseball_id import Lookup

In [2]: Lookup.from_mlb_ids([430945, 607680, 669456])
Out[2]:
      mlb_id      mlb_name mlb_pos mlb_team         mlb_team_long  ...  ottoneu_name ottoneu_pos  rotowire_id  rotowire_name rotowire_pos
39    430945    Adam Jones      CF      ARI  Arizona Diamondbacks  ...    Adam Jones          OF       8165.0     Adam Jones           OF
1746  607680  Kevin Pillar      CF       SF  San Francisco Giants  ...  Kevin Pillar          OF      12678.0   Kevin Pillar           OF
2545  669456  Shane Bieber       P      CLE     Cleveland Indians  ...  Shane Bieber          SP      14383.0   Shane Bieber            P

[3 rows x 35 columns]

In [3]: Lookup.from_yahoo_ids([10794, 9542, 7578])
Out[3]:
      mlb_id        mlb_name mlb_pos mlb_team  ... ottoneu_pos rotowire_id   rotowire_name  rotowire_pos
5     621345     A.J. Minter       P      ATL  ...          RP     13889.0     A.J. Minter             P
204   605151  Archie Bradley       P      ARI  ...          RP     12131.0  Archie Bradley             P
2340  448179       Rich Hill       P      LAD  ...          SP      7965.0       Rich Hill             P

[3 rows x 35 columns]

In [4]: Lookup.from_cbs_ids([1660162, 2507367])
Out[4]:
      mlb_id      mlb_name mlb_pos mlb_team         mlb_team_long  ...  ottoneu_name ottoneu_pos  rotowire_id  rotowire_name rotowire_pos
423   457763  Buster Posey       C       SF  San Francisco Giants  ...  Buster Posey        C/1B      10426.0   Buster Posey            C
1657  665742     Juan Soto      LF      WSH  Washington Nationals  ...     Juan Soto          OF      13960.0      Juan Soto           OF

[2 rows x 35 columns]

In [5]: Lookup.from_espn_ids([29252])
Out[5]:
     mlb_id       mlb_name mlb_pos mlb_team        mlb_team_long  ...   ottoneu_name ottoneu_pos  rotowire_id  rotowire_name rotowire_pos
836  451594  Dexter Fowler      RF      STL  St. Louis Cardinals  ...  Dexter Fowler          OF       8271.0  Dexter Fowler           OF

[1 rows x 35 columns]

In [6]: Lookup.from_fangraphs_ids([19753, 19566])
Out[6]:
      mlb_id           mlb_name mlb_pos mlb_team  ... ottoneu_pos rotowire_id      rotowire_name  rotowire_pos
1510  642528  Jonathan Loaisiga       P      NYY  ...       SP/RP     15256.0  Jonathan Loaisiga             P
2133  663993          Nate Lowe      1B       TB  ...          1B         NaN                NaN           NaN

[2 rows x 35 columns]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何删除列表中的重复项并将列表复制到另一个列表中   Java如何在非UI应用程序中检测tab键按下?   java无法在未调用Looper的线程内创建处理程序。警报对话框线程上的prepare()   java Jaxb将XML转换为ElementNSImpl类型,而不是正确的类型   基于java标记的过滤实现Firestore   我们可以使用Java和Eclipse使用YouTube分析Api吗?   JavaSpring注释在多个选项卡中同时打开多个视图   java Hibernate不使用JBOSS检索数据   矩阵如何从Apache Commons数学Java库中找到伪逆   对象Java打印“null”作为字符串引用!=使无效   java中的图形慢映射   java用户界面:操作栏和上下文操作栏,新趋势   java Infinispan,版本化操作返回不正确的结果   java调整保存在父JFrame中的JInternalFrame的大小,并且该父JFrame使用ComponentMover API注册   java如何防止会话属性在服务器上持久化?   java如何为SpringBoot 2创建自定义嵌入式servlet容器   使用Robolectric进行单元测试时,在片段类内调用getString()时发生java IllegalStateException