Import NumPy under the alias np
.
import numpy as np
Import pandas under the alias pd
.
import pandas as pd
Given the DataFrames df
and other_df
, perform a join operation that joins other_df
onto df
.
df = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3', 'A4', 'A5']}, index = ['K0', 'K1', 'K2', 'K3', 'K4', 'K5'])
other_df = pd.DataFrame({'B': ['B0', 'B1', 'B2']}, index = ['K0', 'K1', 'K2'])
#Solution goes here
df.join(other_df)
A | B | |
---|---|---|
K0 | A0 | B0 |
K1 | A1 | B1 |
K2 | A2 | B2 |
K3 | A3 | NaN |
K4 | A4 | NaN |
K5 | A5 | NaN |