def assemble_data(data_dfs, concat_direction):
    """ Assemble the data dfs together. Both indices are sorted.

    Args:
        data_dfs (list of pandas dfs)
        concat_direction (string): 'horiz' or 'vert'

    Returns:
        all_data_df_sorted (pandas df)

    """
    if concat_direction == "horiz":
        # Concatenate the data_dfs horizontally
        all_data_df = pd.concat(data_dfs, axis=1)

        # Sanity check: the number of columns in all_data_df should
        # correspond to the sum of the number of columns in the input dfs
        n_cols = all_data_df.shape[1]
        logger.debug("all_data_df.shape[1]: {}".format(n_cols))
        n_cols_cumulative = sum([df.shape[1] for df in data_dfs])
        assert n_cols == n_cols_cumulative

    elif concat_direction == "vert":

        # Concatenate the data_dfs vertically
        all_data_df = pd.concat(data_dfs, axis=0)

        # Sanity check: the number of rows in all_data_df should
        # correspond to the sum of the number of rows in the input dfs
        n_rows = all_data_df.shape[0]
        logger.debug("all_data_df.shape[0]: {}".format(n_rows))
        n_rows_cumulative = sum([df.shape[0] for df in data_dfs])
        assert n_rows == n_rows_cumulative

    # Sort both indices
    all_data_df_sorted = all_data_df.sort_index(axis=0).sort_index(axis=1)

    return all_data_df_sorted
Assemble the data dfs together. Both indices are sorted.

    Args:
        data_dfs (list of pandas dfs)
        concat_direction (string): 'horiz' or 'vert'

    Returns:
        all_data_df_sorted (pandas df)