Python数据分析-FIFA2018球员数据分析

本文通过Python进行FIFA2018球员数据的详细分析,涵盖17994行×7列、253行×7列及647行×2列的数据集,揭示球员各项指标的统计特征与关联性。
摘要由CSDN通过智能技术生成
#!/usr/bin/env python
# coding: utf-8
# TI=FIFA2018球员数据分析
# 明确分析目的
# 	运动员数量前十名的国家,以及平均身价
# 	各大联赛运动员数量,以及球员平均身价
# 	各俱乐部的平均周薪
# 	英超联赛English Premier League各个俱乐部球员的平均周薪
# 	球员年龄分布情况,不同年龄段平均身价分布
# 引入使用的库
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# 加载数据文件
df = pd.read_csv('./FIFA_2018_player.csv')
# 查看数据具有哪些列,什么类型
df.info()
# 可见共17994行,league和club有缺失值
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 17994 entries, 0 to 17993
Data columns (total 12 columns):
ID             17994 non-null int64
name           17994 non-null object
full_name      17994 non-null object
nationality    17994 non-null object
league         17741 non-null object
club           17741 non-null object
age            17994 non-null int64
birth_date     17994 non-null object
height_cm      17994 non-null float64
weight_kg      17994 non-null float64
eur_value      17994 non-null float64
eur_wage       17994 non-null float64
dtypes: float64(4), int64(2), object(6)
memory usage: 1.6+ MB
df.head()
ID name full_name nationality league club age birth_date height_cm weight_kg eur_value eur_wage
0 20801 Cristiano Ronaldo C. Ronaldo dos Santos Aveiro Portugal Spanish Primera División Real Madrid CF 32 1985-02-05 185.0 80.0 95500000.0 565000.0
1 158023 L. Messi Lionel Messi Argentina Spanish Primera División FC Barcelona 30 1987-06-24 170.0 72.0 105000000.0 565000.0
2 190871 Neymar Neymar da Silva Santos Jr. Brazil French Ligue 1 Paris Saint-Germain 25 1992-02-05 175.0 68.0 123000000.0 280000.0
3 176580 L. Suárez Luis Suárez Uruguay Spanish Primera División FC Barcelona 30 1987-01-24 182.0 86.0 97000000.0 510000.0
4 167495 M. Neuer Manuel Neuer Germany German Bundesliga FC Bayern Munich 31 1986-03-27 193.0 92.0 61000000.0 230000.0
df.describe()
ID age height_cm weight_kg eur_value eur_wage
count 17994.000000 17994.000000 17994.000000 17994.000000 1.799400e+04 17994.000000
mean 207791.796543 25.120151 181.271980 75.400856 2.370511e+06 11503.834612
std 32328.527723 4.617428 6.690392 6.994824 5.347250e+06 23050.661073
min 16.000000 16.000000 155.000000 49.000000 0.000000e+00 0.000000
25% 192621.250000 21.000000 177.000000 70.000000 3.000000e+05 2000.000000
50% 214186.000000 25.000000 181.000000 75.000000 7.000000e+05 4000.000000
75% 231615.750000 28.000000 186.000000 80.000000 2.000000e+06 12000.000000
max 241489.000000 47.000000 205.000000 110.000000 1.230000e+08 565000.000000
df.count()
# 可见league 和 club有缺失值
ID             17994
name           17994
full_name      17994
nationality    17994
league         17741
club           17741
age            17994
birth_date     17994
height_cm      17994
weight_kg      17994
eur_value      17994
eur_wage       17994
dtype: int64
# 对于本次的分析目的,其实在加载数据时就可以只加载部分列
# 选出部分列 ID nationality league club age eur_value eur_wage
# 分析的是FIFA2018的数据,age按当年数据计算,birth_date省略
df = df[['ID', 'nationality', 'league', 'club', 'age', 'eur_value', 'eur_wage']]
df
ID nationality league club age eur_value eur_wage
0 20801 Portugal Spanish Primera División Real Madrid CF 32 95500000.0 565000.0
1 158023 Argentina Spanish Primera División FC Barcelona 30 105000000.0 565000.0
2 190871 Brazil French Ligue 1 Paris Saint-Germain 25 123000000.0 280000.0
3 176580 Uruguay Spanish Primera División FC Barcelona 30 97000000.0 510000.0
4 167495 Germany German Bundesliga FC Bayern Munich 31 61000000.0 230000.0
... ... ... ... ... ... ... ...
17989 237463 England English League One Scunthorpe United 17 50000.0 1000.0
17990 11728 England English League Two Wycombe Wanderers 47 0.0 1000.0
17991 231381 Scotland English League Two Swindon Town 17 60000.0 1000.0
17992 238813 England English League Two Crewe Alexandra 18 60000.0 1000.0
17993 238308 Ghana English League One Scunthorpe United 18 50000.0 1000.0

17994 rows × 7 columns

<
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值