nba球员数据分析和可视化_可视化NBA球员统计

nba球员数据分析和可视化

I haven’t written a post in a while. I had a lot to do for university and my hobbies like recreational programming and blogging have to suffer during those times. But now I have found some time and I’ll be adding smaller posts every now and then.

我已经有一段时间没有写帖子了。 我在大学里有很多工作要做,在那段时间里,诸如娱乐性编程和博客之类的爱好不得不受到影响。 但是现在我已经找到了一些时间,我会不时增加一些较小的帖子。

In the Machine Learning course I am taking at university I could use matplotlib to plot my functions for the homework submissions. So I have gotten more familiar with coding plots and graphs in Python since my last post about matplotlib. So I wanted to prepare some interactive plots for my blog and present to you what I have been able to create so far.

在我上大学的机器学习课程中 ,我可以使用matplotlib绘制作业提交的功能。 因此,自上一篇有关matplotlib的文章以来,我对Python中的绘图和图形编码更加熟悉。 因此,我想为我的博客准备一些交互式图,并向您介绍到目前为止我已经能够创建的内容。

网页傻瓜 (Web Scrapping for Dummies)

First I wanted to find some interesting data to display. I decided to collect my own data as opposed to take an already publicly available data set, since this can easily be done in Python. For a step-by-step guide on how to scrap data from a web page, where the site is generated on the server side and you can find your data directly in the html code, I recommend chapter 11 in Automate the Boring Stuff in Python from Al Sweigart. The standard module for this type of web scraping is BeautifulSoup, which makes it easy for you to find certain tags in an HTML file.

首先,我想找到一些有趣的数据来显示。 我决定收集自己的数据,而不是采用已经公开可用的数据集,因为这可以在Python中轻松完成。 有关如何从网页中抓取数据的分步指南,其中网站是在服务器端生成的,您可以直接在html代码中找到数据,我建议使用Python自动完成枯燥的工作中的第11章来自Al Sweigart。 这种类型的Web抓取的标准模块是BeautifulSoup ,它使您可以轻松地在HTML文件中查找某些标签。

So I decided, that I wanted to collect the stats of all currently active NBA players. Luckily, there is a blog post from Greg Reda that explained exactly how this can be done in Python. This approach of web scrapping is different, since a lot of newer sites create the web page on the client-side. So you have to find the url for the request to the server. The response you then get is often a JSON object, which you can then parse for the information you want.

所以我决定,我想收集所有当前活跃的NBA球员的统计数据。 幸运的是, 格雷格·雷达(Greg Reda )的博客文章准确地解释了如何使用Python完成此工作。 Web抓取的这种方法是不同的,因为许多新站点在客户端上创建网页。 因此,您必须找到到服务器的请求的URL。 然后,您获得的响应通常是一个JSON对象,然后您可以对其进行解析以获取所需的信息。

The stats.nba.com web page is generated on the client-side, so the latter approach was necessary. I first collected the person_ids from every NBA player in the database and then checked their roster status, whether the player i

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值