pythonasammdf

how to combine two datasets to make one combined plot in python


I have a dataset of 6 parameters with 500 values each and I want to combine the two of the datasets to get the road curvature but I am getting an error. Since I am new to python, I am not sure that I am using the correct logic or not. Please guide.

from asammdf import MDF
import pandas as pd

mdf = MDF('./Data.mf4')
    
c=['Vhcl.Yaw','Vhcl.a','Car.Road.tx', 'Car.Road.ty', 'Vhcl.v', 'Car.Width']

m = mdf.to_dataframe(channels=c, raster=0.02)

for i in range(0,500):
    mm = m.iloc[i].values

y = pd.concat([mm[2], mm[3]])

plt.plot(y)
plt.show()
print(y)

Error:

TypeError: cannot concatenate object of type '<class 'numpy.float64'>'; only Series and DataFrame objs are valid

Solution

  • Starting from your dataframe m

    y = m.iloc[:, 1:3]
    

    This will create another dataframe with all the entries in the first component and only the entries from the second and third channel.