I'm trying to create some parameters for a simulation but I'm struggling to pull all the data together. My data comes from:
df1 = pd.read_csv(file1)
TurnDatabase = tkFileDialog.askopenfilename(title='choose file')
A particular lap is then picked from the data which is unimportant.
The trouble I'm having is when I'm trying to take data from the CSV file when
'BCornerEntry' == 'YES'
while 'sLap'
in the excel sheet is the same as the CSV.
The excel doc has a table like this:
Turn Numbers, Entry, Exit
1 321 546 2 789 1002 3 1230 1567
And so on. Where Entry and Exit will be the same as sLap at some point.
I've
I've used this to isolate the corners of a track and when the conditions are correct.
Entries1 = {i: df1.TurnData1[i][(df1.TurnData1[i]['BCornerEntry'] == "YES") & (df1.TurnData1[i]['NLap'] == Lap1)] for i in df1.TurnData1.viewkeys()}
TurnData1 comes from here:
TurnInfo = TurnInfo.dropna(axis=1)
# Split the data up into each turn number
df1.TurnData1 = {i: df1[(df1['sLap'] > TurnInfo.Entry[i]) & (df1['sLap'] < TurnInfo.Exit[i])]for i in TurnInfo.index.unique()}
Then I used:
df3 = df1[df1.columns].groupby([df1.BCornerEntry == 'YES', Entries1]).agg([np.mean, np.std])
but it returns this:
Empty DataFrame
When there is definitely overlapping data. The CSV is far too large to write down but there are 30+ columns each with a different name and mostly int. data with some boolean and occasional str.
Any help would be greatly appreciated and sorry If I've missed anything.
EDIT:
What I am trying to achieve is a line of code that will iterate through each corner (data comes from the excel table shown previous) and then generate a graph showing the mean values of each column in the CSV file per for those corners.
The graph bit is sorted but the part i'm finding hard is the fact the column headers can change so picking up their data without manually calling them is something I'm unable to do.
I need something that will read and link the values to the excel table.
Sorry it's quite difficult to describe.