def expand_date(df):
    """Adds columns with year, month, day, hour, day of year, week, weekday.

    Args:
        dataframe w/ datetime index
    
    Returns:
        copy of dataframe with columns added
    """
    df = df.copy()
    df['year'] = df.index.year
    df['month'] = df.index.month
    df['day'] = df.index.day
    df['hour'] = df.index.hour
    df['dayofyear'] = df.index.dayofyear
    df['week'] = df.index.week
    df['weekday'] = df.index.weekday
    return df