I have a DataFrame (see 'Test Data' section below) and I would like to add a secondary x axis (at the top). But this axis has to be from 0 to 38.24(ms). This is the sum of all values in column 'Time'. It expresses the total time that the 4 inferences took to execute. So far I have tried 'twinx()' without success.
How can I do that? Is it possible or am I lacking information?
Test Data:
raw_data = {'Time': [21.9235, 4.17876, 4.02168, 3.81504, 4.2972],
'TPU': [33.3, 33.3, 33.3, 33.3, 33.3],
'CPU': [32, 32, 32, 32, 32],
'MemUsed': [435.92, 435.90, 436.02, 436.02, 436.19]}
df_m=pd.DataFrame(raw_data, columns = ['Time', 'TPU', 'CPU', 'MemUsed'])
df_m
##Sum of all values in column Time(ms)
(df_m.iloc[:, 0].sum())
##Time per inference(ms)
ax = df_m.plot(kind = 'line', y = 'MemUsed', grid = True)
ax.set_xlabel("NUMBER OF INFERENCES")
ax.set_ylabel("MemUsed(MB)")
What I have tried:
ax = df_m.plot(kind = 'line', y = 'MemUsed', grid = True)
df_m.plot(kind='line', ax=ax.twinx(), secondary_x=range(0, 39))
ax.set_xlabel("NUMBER OF INFERENCES")
ax.set_ylabel("MemUsed(MB)")
Output Graph:
How does the big table look like




