I'm using Numpy and Pandas to generate a series of prices in .25 increments before creating another array of associated values from a dataframe.
I end up with an array of keys, and an array of values.
What is the best way to sum two sets of these key/value array pairs on their respective prices?
keys1 = np.array([1.0, 1.25, 1.5, 1.75])
vals1 = np.array([1, 1, 1, 1])
keys2 = np.array([1.25, 1.5])
vals2 = np.array([1, 1])
Desired result:
(1, 2, 2, 1)
Note: I'm not concerned with cases where the 2nd set has values that do not exist in the first set. Just looking for a clean way to add the 2nd set of values to the 1st set of values.