1

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
jaz
  • 89
  • 1
  • 9
  • What is the shape of `m`? – giuppep Jan 13 '21 at 09:57
  • @GiuppeP It is (500, 6) – jaz Jan 13 '21 at 10:00
  • So a few comments: in the for loop you are overwriting `mm` so that's equivalent to `mm = m.iloc[499].values`. Then `mm[2]` and `mm[3]` are just a number so you can't concate them. What exactly are you trying to do? – giuppep Jan 13 '21 at 10:10
  • @GiuppeP Thank you for the comments. Actually, I want to concatenate these two: 'Car.Road.tx', 'Car.Road.ty' that is why I used mm at index 2 and 3 but I think this is not the right procedure and I could not figure out the right procedure to do so. Kindly guide – jaz Jan 13 '21 at 10:54
  • see answer below – giuppep Jan 13 '21 at 12:42

1 Answers1

1

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.

giuppep
  • 923
  • 1
  • 10
  • 20