An inner join combines tables while retaining only index values shared by every input. It is useful when mismatched dates would otherwise create missing values. section 11.14
Aligning time-series data
Oil prices were recorded daily, while ice-cream prices and miles traveled were recorded monthly. Joining all three with how='inner' keeps only their common dates, producing 275 index values from April 1986 through December 2021. The aligned frame can then support correlation analysis. section 11.14
df = (
oil_df
.join(ice_cream_df, how='inner')
.join(miles_df, how='inner')
)
Use chained DataFrame.join calls with how='inner' to retain the intersection of all three indexes. section 11.14


