CSE 6040 - 7.1 - Merging data frames: join operations - Concepts Flashcards
To use the merge operation on the following to tables labeled A & B, what would be the outcome of the following pandas merge command?
C = A.merge (B, on=[‘country’, ‘year’])
See pic
By default, merge() will only include rows from A and B where all keys _____ between the two tables.
By default, merge() will only include rows from A and B where all keys match between the two tables.
Define the type of dataframe Join:
Inner-join (A, B) (default): Keep only rows of A and B where the on-keys ____ __ ____.
It is the _______ behavior of the python join function
Inner-join (A, B) (default): Keep only rows of A and B where the on-keys match in both.
It is the default behavior of the python join function
Outer-join (A, B): Keep ___ ____ __ ____ ______, but merge rows when the on-keys match. For non-matches, fill in missing values with not-a-number (NaN) values.
Outer-join (A, B): Keep all rows of both frames, but merge rows when the on-keys match. For non-matches, fill in missing values with not-a-number (NaN) values.
Left-join (A, B): Keep all rows of A. Only merge rows of B whose on-keys ____ ___.
Left-join (A, B): Keep all rows of A. Only merge rows of B whose on-keys match A.
Right-join (A, B): Keep all rows of B. Only merge rows of A whose on-keys _____ __
Right-join (A, B): Keep all rows of B. Only merge rows of A whose on-keys match B.
What does the useful primitive apply() function accomplish?
applies a function to a data frame or to a series (column of the data frame).