Open imamverdi875 opened 1 year ago
Hi imamverdi875, I have read your message. Apologize for the issue, I'm still figuring it out. So weird, I fixed this issue and it just happens to pop up. Anyways, I'm on it and hope to let you know soon! Kind regards.
On Tue, Aug 9, 2022 at 2:53 AM imamverdi875 @.***> wrote:
Hello. When I run this code on Jupyter Notebook:
pitch = Pitch(pitch_type='statsbomb', pitch_color='#06D6A0', line_color='#AF125A') fig, ax = pitch.draw(figsize=(16, 11), constrained_layout=True, tight_layout=False) fig.set_facecolor("#06D6A0")
for idx, row in average_locations.iterrows(): pitch.annotate(int(row.passer), xy=(row.x 1.2, row.y 0.8),ax=ax,color='white', va='center', ha='center') Display arrows for passes
arrows = pitch.arrows(1.2 pass_between.x, 0.8 pass_between.y, 1.2 pass_between.x_end, 0.8 pass_between.y_end, ax=ax, width=5, headwidth=3, color='#000F08', zorder=1, alpha=0.9) Display nodes as players
nodes = pitch.scatter(1.2 average_locations.x, 0.8 average_locations.y, s=700, color='#92140C', edgecolors='#9E788F', linewidth=2.5, alpha=1, zorder=1, ax=ax) It did not work: :
AttributeError Traceback (most recent call last) in 4 5 for idx, row in average_locations.iterrows(): ----> 6 pitch.annotate(int(row.passer), xy=(row.x 1.2, row.y 0.8),ax=ax,color='white', va='center', ha='center') 7 8 # Display arrows for passes
~\anaconda3\lib\site-packages\pandas\core\generic.py in getattr(self, name) 5137 if self._info_axis._can_hold_identifiers_and_holds_name(name): 5138 return self[name] -> 5139 return object.getattribute(self, name) 5140 5141 def setattr(self, name: str, value) -> None:
AttributeError: 'Series' object has no attribute 'passer'
Could you please help me? Thanks in advance.
— Reply to this email directly, view it on GitHub https://github.com/hussy53/Football_Pass_Network_Map/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPG5ZRFCSOUHO4CJEZW2Y3VYGFX5ANCNFSM556XXUCA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi there, You will have to make the necessary changes: From:- for idx, row in average_locations.iterrows(): pitch.annotate(int(row.passer), xy=(row.x 1.2, row.y 0.8),ax=ax,color='white', va='center', ha='center') To:- for idx, row in average_locations.iterrows(): pitch.annotate(int(idx), xy=(row.x 1.2, row.y 0.8),ax=ax,color='white', va='center', ha='center')
Everything else before that is the same. Please let me know if you encounter any other issues.
Hello. When I run this code on Jupyter Notebook:
pitch = Pitch(pitch_type='statsbomb', pitch_color='#06D6A0', line_color='#AF125A') fig, ax = pitch.draw(figsize=(16, 11), constrained_layout=True, tight_layout=False) fig.set_facecolor("#06D6A0")
for idx, row in average_locations.iterrows(): pitch.annotate(int(row.passer), xy=(row.x 1.2, row.y 0.8),ax=ax,color='white', va='center', ha='center')
Display arrows for passes
arrows = pitch.arrows(1.2 pass_between.x, 0.8 pass_between.y, 1.2 pass_between.x_end, 0.8 pass_between.y_end, ax=ax, width=5, headwidth=3, color='#000F08', zorder=1, alpha=0.9)
Display nodes as players
nodes = pitch.scatter(1.2 average_locations.x, 0.8 average_locations.y, s=700, color='#92140C', edgecolors='#9E788F', linewidth=2.5, alpha=1, zorder=1, ax=ax)
It did not work: :
AttributeError Traceback (most recent call last)