def model_poly_jauge_price(day,od): df = pd.read_csv('/home/groupevsc.com/abdesselem_hantour/Téléchargements/ods_jauge_price_F.csv') df_day = df[df['day_name']==day] df_day_od = df_day[df_day['od']==od] df_final = df_day_od[['BOOKING_WINDOW','MT_VNT_EUR_VOY']] obs_day = df_final['MT_VNT_EUR_VOY'].reset_index() del obs_day ['index'] x = list(df_final['BOOKING_WINDOW']) y = list(df_final['MT_VNT_EUR_VOY']) fitted = np.polyfit(x,y,3) func_third_order =np.poly1d(fitted) pas = range(1,90,1) return plt.plot(func_third_order(pas),'g'),\ plt.plot(obs_day,'r'),\ plt.suptitle('Median prix pour Vendredi OD:' + od),\ plt.xlabel('Booking Window'),\ plt.ylabel('Median'),\ plt.legend(["third_order","Observed"])