# Loop through a list of car numbers to calculate mean of steering angle for each car

142
June 29, 2019, at 02:40 AM

I am working on correcting the steering angle. Steps: 1) Filter the data based on backstretchend and backstretchstart of a race track 2) Calculate the mean of existing values by per car 3) Calculate the difference between the mean calculated per car and the actual values of steering in collected data 4) Calculate the mean of this difference

I have filtered and have calculated mean on overall column

Sample data:

``````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
``````

Code:

``````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
``````
POPULAR ONLINE

### Can anything non-obvious go wrong with this Python trick?

I frequently want a dictionary mapping keys to consecutive IDs so I do the following:

132

I have a file

114

### 'drain' event does not fire when 'end()' method used (writable stream)

The 'drain' event fires when the 'write()' method returns false according to Nodejs

110

### storing data in express,node, react and react native ( cookies,sessions,localstorage,asyncstorage )

The problem is that in node express server side i set a cookie to store some data ,in react i can view the data from the cookie set by server but in react-native i can't use cookie ,not a good solutionWhat would you recommend me to store the data in from server...

141