parent
196283678d
commit
ad49a82f87
@ -0,0 +1,41 @@
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import matplotlib as mpl
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib import font_manager
|
||||
|
||||
font_path = r'E:\PycharmProjects\pythonProject\simsun.ttc'
|
||||
font_prop = font_manager.FontProperties(fname=font_path)
|
||||
#支持中文显示
|
||||
|
||||
'''
|
||||
mpl.rcParams['font.family'] = 'Kaiti'
|
||||
# 使用非 unicode 的负号,当使用中文时候要设置
|
||||
mpl.rcParams['axes.unicode_minus'] = False
|
||||
# %matplotlib inline
|
||||
'''
|
||||
|
||||
data = pd.read_csv(r'E:\PycharmProjects\pythonProject\航班信息\airport-ontime.csv')
|
||||
# data.info()
|
||||
|
||||
#将Unnamed这列删除
|
||||
|
||||
data.dropna(axis=1, how='all', inplace=True)
|
||||
# data.info()
|
||||
|
||||
#查看是否有重复数据
|
||||
data.duplicated().any()
|
||||
data.drop_duplicates(inplace=True)
|
||||
# data.info()
|
||||
|
||||
# 统计起飞是否延迟 饼图
|
||||
|
||||
# print(data['DEP_DEL15'].head())
|
||||
|
||||
|
||||
dep_data = data['DEP_DEL15'].dropna()
|
||||
dep_delay = dep_data.value_counts()
|
||||
dep_delay.name = ''
|
||||
dep_delay.plot(kind='pie', labels=['起飞不延迟', '起飞延迟'], autopct='%.2f', textprops={'fontproperties': font_prop})
|
||||
plt.title('起飞延迟不延迟情况', {'fontproperties': font_prop})
|
||||
plt.show()
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue