Passing networks

Поділитися
Вставка
  • Опубліковано 24 сер 2022
  • A step by step guide to creating passing networks.
    I step through the code on this page: soccermatics.readthedocs.io/e...

КОМЕНТАРІ • 4

  • @mohamedkhaled4888
    @mohamedkhaled4888 Рік тому

    Firstly, thank you for your efforts. But after trying to make the only forward passes network, l couldn't do it, and I don't know where to get help after searching for a while. It would be nice if you can help me with that.
    Thank you.

    • @aashiksingh7704
      @aashiksingh7704 Рік тому +1

      I used lambda to try and find whether a pass was made forwards or not. I took the original dataframe (df) and created a new column based on the following condition:
      df['pass_direction'] = df[['x', 'end_x']].apply(lambda i: 'forward' if i['end_x'] > i['x'] else 'backward', axis=1)
      I am making an assumption that if the 'end_x' is greater than the 'x' position for that particular id then it must be a forward pass?
      Let me know what you think

    • @mohamedkhaled4888
      @mohamedkhaled4888 Рік тому

      @@aashiksingh7704 Thank you for your respond, I think that is really a good idea, I already knew the suedo code but I'm not comfortable with data science and python, I appreciate your help, thank you. 😀

    • @plarp
      @plarp Рік тому +3

      @@mohamedkhaled4888 Hopefully you completed the challenge - I changed the code defining the mask. I made the same assumption as Aashik about a foward pass (end_x > x) and this seems to be correct.
      My solution, I added the last & and the condition following it:
      mask_england_fwd = (df.type_name == 'Pass') & (df.team_name == "England Women's") & (df.index < sub) & (df.outcome_name.isnull()) & (df.sub_type_name != "Throw-in") & (df.end_x > df.x)