【发布时间】:2022-01-27 13:40:11
【问题描述】:
我正在开始我的第一个数据科学项目。第一步是绘制 2018 NHL 赛季的所有镜头。似乎无法弄清楚如何从 xCord 和 yCord 列中提取 x 和 y 坐标,这两种数据类型都是 int64 数据类型。
import pandas as pd
import numpy as py
import matplotlib.pyplot as plt
shots = pd.read_csv('NHL_Project/Data/shots_2007-2020.csv')
shot = shots[['homeTeamCode', 'awayTeamCode', 'season','isPlayoffGame','game_id','homeTeamWon', 'period', 'time','period','team','location','event','goal','xCord','yCord','shotType','playerPositionThatDidEvent','playerNumThatDidEvent','goalieIdForShot','goalieNameForShot','shooterPlayerId','shooterName','shooterLeftRight','shotWasOnGoal']].head()
fig = plt.figure(figsize=(100,100))
ax = plt.axes()
t = py.linspace(-100, 100, 100) # return 100 numbers between -100 and 100
x = ['xCord']
y = ['yCord']
ax.plot(x, y, color='red', marker='D')
【问题讨论】:
标签: python python-3.x matplotlib