Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...