Get lapnumber of fastest lap #318
Unanswered
foxyskippy
asked this question in
Q&A
Replies: 1 comment
-
The |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to add the lapnumber of the fastest lap when pick_fastest()
import fastf1 as ff1
import fastf1.plotting
from fastf1.core import Laps
import numpy as np
import matplotlib as mpl
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.collections import LineCollection
###SETUP GRANDPRIX
grandprix = 18
year = 2022
###FREE PRACTICE 1
session = ff1.get_session(year, grandprix, 'FP1')
weekend = session.event
weekendName = session.weekend.name
###TELEMETRY FAST LAPS
session.load()
laps = session.load_laps(with_telemetry=True)
drivers = pd.unique(laps['Driver'])
list_fastest_laps = list()
for drv in drivers:
try:
drv_lap = session.laps.pick_driver(drv).pick_fastest()
temp = drv_lap.get_telemetry()
df = pd.DataFrame(temp)
df["Session"] = "FP1"
df["Weekend"] = str(weekendName)
df["LapNr"] = "1"
df["Driver"] = drv
print(df)
except:
pass
Beta Was this translation helpful? Give feedback.
All reactions