def pandas_to_series_spec(x):
    if hasattr(x, 'columns'):
        if (len(x.columns) > 1):
            raise ValueError('Does not handle DataFrame with more than one column')
        x = x[x.columns[0]]
    data = '({0})'.format('\n'.join(map(str, x.values.tolist())))
    try:
        period = _freq_to_period[x.index.freqstr]
    except (AttributeError, ValueError):
        from pandas.tseries.api import infer_freq
        period = _freq_to_period[infer_freq(x.index)]
    start_date = x.index[0]
    if (period == 12):
        (year, stperiod) = (start_date.year, start_date.month)
    elif (period == 4):
        (year, stperiod) = (start_date.year, start_date.quarter)
    else:
        raise ValueError('Only monthly and quarterly periods are supported. Please report or send a pull request if you want this extended.')
    if hasattr(x, 'name'):
        name = (x.name or 'Unnamed Series')
    else:
        name = 'Unnamed Series'
    series_spec = SeriesSpec(data=data, name=name, period=period, title=name, start='{0}.{1}'.format(year, stperiod))
    return series_spec
def pandas_to_series_spec(x):
    if hasattr(x, 'columns'):
        if (len(x.columns) > 1):
            raise ValueError('Does not handle DataFrame with more than one column')
        x = x[x.columns[0]]
    data = '({0})'.format('\n'.join(map(str, x.values.tolist())))
    try:
        period = _freq_to_period[x.index.freqstr]
    except (AttributeError, ValueError):
        from pandas.tseries.api import infer_freq
        period = _freq_to_period[infer_freq(x.index)]
    start_date = x.index[0]
    if (period == 12):
        (year, stperiod) = (start_date.year, start_date.month)
    elif (period == 4):
        (year, stperiod) = (start_date.year, start_date.quarter)
    else:
        raise ValueError('Only monthly and quarterly periods are supported. Please report or send a pull request if you want this extended.')
    if hasattr(x, 'name'):
        name = (x.name or 'Unnamed Series')
    else:
        name = 'Unnamed Series'
    series_spec = SeriesSpec(data=data, name=name, period=period, title=name, start='{0}.{1}'.format(year, stperiod))
    return series_spec