I'm trying to merge two curves into only one, but the originals two lines are shifted horizontally:
import numpy as np
a = np.array([[1,2,3], # x value
[0.3, 0.5, 0.6]]) # y value
b = np.array([[2,3,4], [0.5,0.4,0.3]])
I need c = [[1,2,3,4],[0.3, 1, 1, 0.3]]
How can I done?
CodePudding user response:
You can use pandas:
import pandas as pd
import numpy as np
a = np.array([[1,2,3], # x value
[0.3, 0.5, 0.6]]) # y value
b = np.array([[2,3,4], [0.5,0.4,0.3]])
pd.concat(map(pd.DataFrame,[a.T, b.T])).groupby(0).sum().plot()
Output: