in spotify_confidence/analysis/frequentist/confidence_computers/confidence_computer.py [0:0]
def join(df: DataFrame) -> DataFrame:
has_index = not all(idx is None for idx in df.index.names)
if has_index:
# self-join on index (the index will typically model the date,
# i.e., rows with the same date are joined)
return df.merge(df, left_index=True, right_index=True, suffixes=(SFX1, SFX2))
else:
# join on dummy column, i.e. conduct a cross join
return (
df.assign(dummy_join_column=1)
.merge(right=df.assign(dummy_join_column=1), on="dummy_join_column", suffixes=(SFX1, SFX2))
.drop(columns="dummy_join_column")
)