def series_to_yaml_safe(series):
    index = series.index.to_native_types(quoting=True)
    values = series.values.tolist()

    return {i: v for i, v in itertools.izip(index, values)}
Convert a pandas Series to a dict that will survive YAML serialization
dataset/ETHPy150Open UDST/urbansim/urbansim/utils/yamlio.py/series_to_yaml_safe