diff --git a/单日航班出发时段对照表.py b/单日航班出发时段对照表.py new file mode 100644 index 0000000..623266c --- /dev/null +++ b/单日航班出发时段对照表.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Nov 30 18:34:46 2022 + +@author: DELL +""" + +import datetime +import pandas as pd +import matplotlib.pyplot as plt +with open('information.txt','r',encoding='utf-8') as fe: + info=fe.read() + lst=info.split(' ') + date1 = datetime.datetime.strptime(lst[2],"%Y-%m-%d") + date2 = date1 + datetime.timedelta(days=int(lst[3])) +df = pd.read_csv("contentt.csv", encoding=('gb2312'),names=["date","flightNum", "depTime", "arrTime", "price"]) +df.head() + + +riqi=input('请输入要查询的日期(如2022-12-01):') +df1=df[df.date==riqi] +#print(df1) + +plt.rcParams['font.sans-serif'] = ['SimHei'] +plt.rcParams['figure.figsize'] = (10, 5) +flightnumber={} +x = df1['flightNum'] +y = df1['depTime'] +lst_x=x.values.tolist() +lst_y=y.values.tolist() +morning=[] +noon=[] +night=[] +for i in lst_y: + a=int(lst_y[0][0:2]) + if 8<=a<=12: + morning.append(0) + elif 12