def ensure_str_type(df):
    """Convert object elements in dataframe to string.

    Parameters
    ----------
    * df : pd.DataFrame
    
    Returns
    -------
    * pd.DataFrame with object types converted to string
    """
    is_object = df.dtypes == object
    df.loc[:, is_object] = df.loc[:, is_object].astype(str)
    return df