Coder Social home page Coder Social logo

code-soccer-files's Introduction

README

These are the files for the book Learn to Code with Soccer.

If you're not familiar with Git or GitHub, no problem. Just click the Source code link under the latest release to download the files. This will download a file called code-soccer-files-vX.X.X.zip, where X.X.X is the latest version.

When you unzip these (note in the book I've dropped the version number and renamed the directory just code-soccer-files, which you can do too) you'll see four sub-directories: code, data, anki, solutions-to-excercises.

You don't have to do anything with these right now except know where you put them. For example, on my mac, I have them in my home directory:

/Users/nathanbraun/code-soccer-files

If I were using Windows, it might look like this:

C:\Users\nathanbraun\code-soccer-files

Set these aside for now and we'll pick them up in chapter 2.

Changelog

v0.2.0 (2024-06-18)

Cleaned up plotting chapter to avoid misc Seaborn warnings.

v0.1.1 (2024-04-22)

Fix Pandas mean example. More: Pandas changed their defaults to throw an error if you try to call this on string columns. Fixed example to explicitely only call it on numeric data.

v0.1.0 (2024-04-16)

Change scraping example to get data from worldfootball.net, since myfootballfacts.com was no longer working.

v0.0.17 (2024-03-12)

Fix some typos (thanks Dillion!)

v0.0.16 (2024-03-04)

Fixed the answer to exercise 3.1.5 (thanks Akash!)

v0.0.15 (2024-02-07)

Misc typos.

v0.0.14 (2024-01-22)

Changed some terminology based on reader feedback (thanks Dillion!)

v0.0.13 (2024-01-14)

Minor uupdates for clarity.

v0.0.11 (2023-02-13)

Fixed some typos in the book. Thanks Paul!

v0.0.9 (2023-02-13)

Fixed a typo in the book. Thanks Dan!

v0.0.8 (2022-12-02)

Minor rewording.

v0.0.7 (2022-09-16)

Clean up some misc non-soccer references in modeling chapter. Thanks x3 Ross!

v0.0.6 (2022-09-16)

More edits to make sure book matches the code. You're on fire Ross!

Also changed the book image on SendOwl to be more grass-like green vs yellow.

v0.0.5 (2022-09-12)

Fixed some out of date variable/sports references in merge and sql sections. Thanks (again) Ross!

v0.0.4 (2022-09-09)

Fixed a stray reference to the wrong football (American). Fixed an error in end of chapter exercises for Pandas filter section. Thanks Ross!

v0.0.3 (2022-08-17)

Fixed some typos. Thanks Jon!

v0.0.2 (2022-07-22)

Added a football version for non-American readers, where I've subbed out "soccer" and replaced it with "football" throughout the text. Comes with both so read which you prefer.

v0.0.1 (2022-07-22)

Adding this README!

code-soccer-files's People

Contributors

nathanbraun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code-soccer-files's Issues

One to Many Example

The one to many example in section 3.5 was a little confusing to me. combined ends up being our "left" table, which has many duplicated player_id that match to single player_ids in the player table. To me, this seems more like many-to-one?

This is further illustrated by passing validate='1:m':

In [70]: pd.merge(combined, player[['player_id', 'player_name', 'pos', 'team']], validate='1:m')
Traceback (most recent call last):

  Cell In[70], line 1
    pd.merge(combined, player[['player_id', 'player_name', 'pos',

  File ~/anaconda3/lib/python3.11/site-packages/pandas/core/reshape/merge.py:148 in merge
    op = _MergeOperation(

  File ~/anaconda3/lib/python3.11/site-packages/pandas/core/reshape/merge.py:747 in __init__
    self._validate(validate)

  File ~/anaconda3/lib/python3.11/site-packages/pandas/core/reshape/merge.py:1590 in _validate
    raise MergeError(

MergeError: Merge keys are not unique in left dataset; not a one-to-many merge

Just reversing the arguments works and passes validation, however the columns aren't in a more human-readable order (to be expected).

In   [71]: pd.merge(player[['player_id', 'player_name', 'pos', 'team']], combined, validate='1:m').head()
Out[71]: 
   player_id      player_name  pos     team  match_id  pass  assist  shot  goal
0      32793       A. N'Diaye  MID  Senegal   2057996    28       0     0     0
1      32793       A. N'Diaye  MID  Senegal   2057999    16       0     0     0
2         36  T. Alderweireld  DEF  Belgium   2057990   105       0     0     0
3         36  T. Alderweireld  DEF  Belgium   2057992    53       1     2     0
4         36  T. Alderweireld  DEF  Belgium   2058007    77       0     0     0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.