# Buggy code
def attach_columns(self, result):
    if result.squeeze().ndim <= 1:
        return Series(result, index=self.xnames)
    else:  # for e.g., confidence intervals
        return DataFrame(result, index=self.xnames)


# Traceback (Exception)
model = ols('LREO_recovery ~ 0 + HREO_recovery', df_product)
results = model.fit()
print results.summary()

OLS Regression Results
==============================================================================
Dep. Variable:          LREO_recovery   R-squared:                       0.999
Model:                            OLS   Adj. R-squared:                  0.999
Method:                 Least Squares   F-statistic:                       inf
Date:                Sat, 16 Mar 2013   Prob (F-statistic):                nan
Time:                        20:35:35   Log-Likelihood:                 165.81
No. Observations:                  54   AIC:                            -329.6
Df Residuals:                      53   BIC:                            -327.6
Df Model:                           0
=================================================================================
coef    std err          t      P>|t|      [95.0% Conf. Int.]
---------------------------------------------------------------------------------
HREO_recovery     1.0029      0.003    373.607      0.000         0.998     1.008
==============================================================================
Omnibus:                       21.160   Durbin-Watson:                   1.978
Prob(Omnibus):                  0.000   Jarque-Bera (JB):               67.387
Skew:                           0.891   Prob(JB):                     2.33e-15
Kurtosis:                       8.175   Cond. No.                         1.00
==============================================================================

results.conf_int()
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-45-6d86a730d4c3> in <module>()
----> 1 results.conf_int()

/usr/local/lib/python2.7/dist-packages/statsmodels/base/wrapper.pyc in wrapper(self, *args, **kwargs)
87         results = object.__getattribute__(self, '_results')
88         data = results.model._data
---> 89         return data.wrap_output(func(results, *args, **kwargs), how)
90
91     argspec = inspect.getargspec(func)

/usr/local/lib/python2.7/dist-packages/statsmodels/base/data.pyc in wrap_output(self, obj, how)
104     def wrap_output(self, obj, how='columns'):
105         if how == 'columns':
--> 106             return self.attach_columns(obj)
107         elif how == 'rows':
108             return self.attach_rows(obj)

/usr/local/lib/python2.7/dist-packages/statsmodels/base/data.pyc in attach_columns(self, result)
166     def attach_columns(self, result):
167         if result.squeeze().ndim <= 1:
--> 168             return Series(result, index=self.xnames)
169         else: # for e.g., confidence intervals
170             return DataFrame(result, index=self.xnames)

/usr/local/lib/python2.7/dist-packages/pandas/core/series.pyc in __new__(cls, data, index, dtype, name, copy)
370
371         subarr = _sanitize_array(data, index, dtype, copy,
--> 372                                  raise_cast_failure=True)
373
374         if not isinstance(subarr, np.ndarray):

/usr/local/lib/python2.7/dist-packages/pandas/core/series.pyc in _sanitize_array(data, index, dtype, copy, raise_cast_failure)
3127     elif subarr.ndim > 1:
3128         if isinstance(data, np.ndarray):
-> 3129             raise Exception('Data must be 1-dimensional')
3130         else:
3131             subarr = _asarray_tuplesafe(data, dtype=dtype)

Exception: Data must be 1-dimensional

model = ols('LREO_recovery ~ HREO_recovery', df_product)
results = model.fit()
print results.summary()

OLS Regression Results
==============================================================================
Dep. Variable:          LREO_recovery   R-squared:                       0.999
Model:                            OLS   Adj. R-squared:                  0.999
Method:                 Least Squares   F-statistic:                 3.925e+04
Date:                Sat, 16 Mar 2013   Prob (F-statistic):           1.60e-76
Time:                        20:35:51   Log-Likelihood:                 166.13
No. Observations:                  54   AIC:                            -328.3
Df Residuals:                      52   BIC:                            -324.3
Df Model:                           1
=================================================================================
coef    std err          t      P>|t|      [95.0% Conf. Int.]
---------------------------------------------------------------------------------
Intercept         0.0023      0.003      0.789      0.434        -0.004     0.008
HREO_recovery     0.9995      0.005    198.115      0.000         0.989     1.010
==============================================================================
Omnibus:                       26.677   Durbin-Watson:                   1.990
Prob(Omnibus):                  0.000   Jarque-Bera (JB):               93.924
Skew:                           1.169   Prob(JB):                     4.02e-21
Kurtosis:                       9.023   Cond. No.                         4.09
==============================================================================

results.conf_int()
Out[47]:
0         1
Intercept     -0.003528  0.008103
HREO_recovery  0.989421  1.009669

# Fixed code
def attach_columns(self, result):
    if result.squeeze().ndim <= 1 and len(result) > 1:
        return Series(result, index=self.xnames)
    else:  # for e.g., confidence intervals
        return DataFrame(result, index=self.xnames)