我需要记录飞机作业的开始时间和结束时间
#!usr/bin/env python # -*- coding:utf-8 _*- """ @author:JK @file:jisuan.py @time:2024/03/$ {DAY} @desc: """ import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker input_file = 'D:/呼和浩特土左旗_second.xlsx' df = pd.read_excel(input_file) x_axis_data = df['时间'] y_axis_data = df['NT'] start_time = df.at[11,'时间'] #时间那列对应的飞机作业开始时间的行数,为第11行 start_NT = df.at[11,'NT'] # nt值那列对应的飞机作业开始时间的行数,为第11行 end_time = df.at[118,'时间'] end_NT = df.at[118,'NT'] plt.plot(x_axis_data, y_axis_data, ls="-", alpha=0.5, linewidth=1, label='abc') plt.legend plt.gca().xaxis.set_major_locator(ticker.MultipleLocator(30)) plt.scatter(start_time,start_NT,color='red',s=50) plt.scatter(end_time,end_NT,color='red',s=50) plt.xlabel('tuzuoqi') plt.ylabel('NT') plt.show()
结果如图:
标签:plt,end,标记,python,df,time,折线图,NT,axis From: https://www.cnblogs.com/shirleysu90/p/18104802