Join
Joins two dataframes together based on the similarity of values in a single column in each dataframe, called the column being joined on. Most often, the column being joined on is a type of unique identifier that connects the rows from different data frames. For example, although likely too generic to be an identifier, you may join to dataframes on the column address. One table might be owner, and the other business name, and the two dataframes could be joined on address to connect the owners with the business names at an address.
Options
column: Specifies the column to join on
leftColumn: Specifies the column in the left dataframe to join on
rightColumn: Specifies the column in the right dataframe to join on
join: Specifies the type of join to perform
leftTable: Specifies the name of the left dataframe
rightTable: Specifies the name of the right dataframe
switchLeftAndRightTable: Switches the positions of the left and right dataframes
Examples
Example 1 - Join Two Most Recent Dataframes on a Column
When no table names are specified, Arctic Fox will assume you want to join the two most recently loaded dataframes. In this example, we join the most recent datasets, storesDf and salesDf, on the StoreId column using a left join. All rows from the left dataframe are preserved, and any matching rows from the right dataframe are brought in.
#> Join --column StoreId --join left
AFLEFT
# selected left table: storesDf
# selected right table: salesDf
storesDfSalesDfJoin = pd.merge(storesDf, salesDf, on=['StoreId'], how='left') AFRIGHT
Example 2 - Join Specified Dataframes on a Column
Instead of relying on Arctic Fox to choose the most recent dataframes, you can explicitly specify the left and right tables. Here, we join salesDf to storesDf using a left join on the StoreId column. This makes it clear which dataset is being expanded and which one is being used for lookup.
#> Join --leftTable salesDf --rightTable storesDf --column StoreId --join left
AFLEFT
salesDfStoresDfJoin = pd.merge(salesDf, storesDf, on=['StoreId'], how='left') AFRIGHT