(series, ordered=False)
Convert a pandas Series to a dict that will survive YAML serialization
    and re-conversion back to a Series.

    Parameters
    ----------
    series : pandas.Series
    ordered: bool, optional, default False
        If True, an OrderedDict is returned.

    Returns
    -------
    safe : dict or OrderedDict
Convert a pandas Series to a dict that will survive YAML serialization
    and re-conversion back to a Series.
Convert a pandas Series to a dict that will survive YAML serialization and re - conversion back to a Series .
def series_to_yaml_safe(series, ordered=False):
    """
    Convert a pandas Series to a dict that will survive YAML serialization
    and re-conversion back to a Series.

    Parameters
    ----------
    series : pandas.Series
    ordered: bool, optional, default False
        If True, an OrderedDict is returned.

    Returns
    -------
    safe : dict or OrderedDict

    """
    index = series.index.to_native_types(quoting=True)
    values = series.values.tolist()

    if ordered:
        return OrderedDict(
            tuple((k, v)) for k, v in zip(index, values))
    else:
        return {i: v for i, v in zip(index, values)}
def series_to_yaml_safe ( series , ordered = False ) : index = series . index . to_native_types ( quoting = True ) values = series . values . tolist ( ) if ordered : return OrderedDict ( tuple ( ( k , v ) ) for k , v in zip ( index , values ) ) else : return { i : v for i , v in zip ( index , values ) }