Question



Inner merging DF with cardinality of many-to-many

So i reduced a couple of DFs down to 2 cols each.
mapping: companyID, ticker
companies: companyID, storyID

Since the cardinality for both DFs are many-to-many, what happens when I merge(x = mapping2001, y = companies, by = "companyID")?

* In this scenario, the resulting nrow is between nrow(mapping) and nrow(companies).
* However, in a different scenario where I have 2 different DFs, the resulting nrow is bigger than both nrow(x) and nrow(y).





Answers and follow-up questions





Answer or follow-up question 1

Dear student,

Since you're doing an inner merge, the result will only contain rows that can be linked by companyID.

Please elaborate on your question if you want a more detailed answer or come to my office hours.

Michel Ballings



Sign in to be able to add an answer or mark this question as resolved.