This solution is correct for the example I gave. But suppose A contained not only information about the ticker IBM but also the ticker MSFT. In that case, joining on date will add the price of IBM to MSFT too.
How can I place a condition to rule out that mistake?
Generally you can use leftjoin(B, A, on = [:ticker, :date]), but it wouldn’t make much sense in this case, since you already have symbol column in B, so it’s hard to understand how result should look like.
Ah sorry I hadn’t scrolled up to see what the data actually looks like - I think your suggestion is correct (B has only IBM in the ticker column, so if A has MSFT and IBM in ticker then joining on both will only take the IBM entries from A)
To make sure we are giving you the right answer and make it easier for us to help you perhaps is best if you build a DataFrameA and B as in the example above and then write manually the results you would like to have after joining.
You can start loading the packages DataFrames and Dates like this:
using DataFrames, Dates
and then
A = DataFrame(date = [Date("2021-07-20"),
Date("2021-07-24"),
Date("2021-07-24")],
symbol = ["IBM","IBM","MSFT"])
B = ... etc.