我正在纠正转向角。 脚步: 1)根据赛道的backstretchend和backstretchstart过滤数据 2)按每辆车计算现有值的平均值 3)计算收集到的数据中每辆车的平均值与转向的实际值之间的差 4)计算该差的平均值
我已经过滤并计算了总列的平均值
样本数据:
car lap steering
00 20 10
00 21 -12
00 22 8
00 21 9
1 20 2
1 21 3
1 21 -9
1 22 8
代码:
backstretchstart = 0.5
backstretchend = 0.59
#Step 1: Filter the data based on backstretchend and backstretchstart of a race track
df = df.query('corrected_lap__frac > 0.50 & corrected_lap__frac < 0.59')
avgsteerback = df["steering"].mean()
df["steering_correct"] = df["steering"] - avgsteerback
avgsteer = df["steering_correct"].mean()
if avgsteer <= 0 and avgsteer != (np.isnan(avgsteer)):
df["steering_correct"] = df["steering_correct"] * - 1