-3
請原諒我的無知,但我很難讓Python做我想做的事情。所以基本上,我有一個CSV文件,其中包含美國國家橄欖球聯盟(NFL)的數據,其中包括四個行,分別是位置,球員名稱,薪水和平均幻想分數(AFPG)。因此,例如CSV文件中的位置將是Position(RB),PlayerName(Le'Veon Bell)薪水(9800)AvgFantasyPoints(28.6)。我想要做的是選擇一個平均至少有14個AFPG且少於7000薪水的PlayersName。以下是我在下面的代碼。任何幫助表示感謝。Python NFL Fantasy CSV
import csv
out=open("NFL.csv", "rb")
reader = csv.reader(out, delimiter = ",")
data = csv.reader(out)
data = [row for row in data]
for row in data:
Position = row[0]
Name = row[1]
Salary = row[2]
Game_info = row[3]
Avg_points = row[4]
Players = (Name)
for field in Salary:
print(if Salary <= 7000)
out.close()
你能提供的CSV的內容文件?作爲@stamaimer說, – stamaimer
,張貼您的CSV文件,也許你冷冷看[熊貓](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html#pandas.read_csv)模塊使用csv文件 –