internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: statsmodels/statsmodels

Issue:
Bug in dates_from_range
```
import statsmodels.api as sm
assert len(sm.tsa.datetools.dates_from_range("1959Q3", length=202)) == 202
```



Discussion:

Resolving patch:
diff --git a/statsmodels/tsa/base/datetools.py b/statsmodels/tsa/base/datetools.py
--- a/statsmodels/tsa/base/datetools.py
+++ b/statsmodels/tsa/base/datetools.py
@@ -205,7 +205,7 @@ def date_range_str(start, end=None, length=None):
         length = (yr2 - yr1) * annual_freq + offset2
     elif length:
         yr2 = yr1 + length // annual_freq
-        offset2 = length % annual_freq
+        offset2 = length % annual_freq + (offset1 - 1)
     years = np.repeat(range(yr1+1, yr2), annual_freq).tolist()
     years = np.r_[[str(yr1)]*(annual_freq+1-offset1), years] # tack on first year
     years = np.r_[years, [str(yr2)]*offset2] # tack on last year


Test patch:
diff --git a/statsmodels/tsa/base/tests/test_datetools.py b/statsmodels/tsa/base/tests/test_datetools.py
--- a/statsmodels/tsa/base/tests/test_datetools.py
+++ b/statsmodels/tsa/base/tests/test_datetools.py
@@ -66,6 +66,47 @@ def test_dates_from_range():
     dt_range = dates_from_range('1959q1', '1962q2')
     npt.assert_(results == dt_range)
 
+    # test with starting period not the first with length
+    results = results[2:]
+    dt_range = dates_from_range('1959q3', length=len(results))
+    npt.assert_(results == dt_range)
+
+    # check month
+    results = [datetime(1959, 3, 31, 0, 0),
+               datetime(1959, 4, 30, 0, 0),
+               datetime(1959, 5, 31, 0, 0),
+               datetime(1959, 6, 30, 0, 0),
+               datetime(1959, 7, 31, 0, 0),
+               datetime(1959, 8, 31, 0, 0),
+               datetime(1959, 9, 30, 0, 0),
+               datetime(1959, 10, 31, 0, 0),
+               datetime(1959, 11, 30, 0, 0),
+               datetime(1959, 12, 31, 0, 0),
+               datetime(1960, 1, 31, 0, 0),
+               datetime(1960, 2, 28, 0, 0),
+               datetime(1960, 3, 31, 0, 0),
+               datetime(1960, 4, 30, 0, 0),
+               datetime(1960, 5, 31, 0, 0),
+               datetime(1960, 6, 30, 0, 0),
+               datetime(1960, 7, 31, 0, 0),
+               datetime(1960, 8, 31, 0, 0),
+               datetime(1960, 9, 30, 0, 0),
+               datetime(1960, 10, 31, 0, 0),
+               datetime(1960, 12, 31, 0, 0),
+               datetime(1961, 1, 31, 0, 0),
+               datetime(1961, 2, 28, 0, 0),
+               datetime(1961, 3, 31, 0, 0),
+               datetime(1961, 4, 30, 0, 0),
+               datetime(1961, 5, 31, 0, 0),
+               datetime(1961, 6, 30, 0, 0),
+               datetime(1961, 7, 31, 0, 0),
+               datetime(1961, 8, 31, 0, 0),
+               datetime(1961, 9, 30, 0, 0),
+               datetime(1961, 10, 31, 0, 0)]
+
+    dt_range = dates_from_range("1959m3", length=len(results))
+
+
 try:
     from pandas import DatetimeIndex
     _pandas_08x = True
@@ -114,4 +155,3 @@ def test_infer_freq():
     assert _infer_freq(m) == 'M'
     assert _infer_freq(d[:3]) == 'D'
     assert _infer_freq(m[:3]) == 'M'
-
Repository: statsmodels/statsmodels

Issue:
OLS residuals returned as Pandas series when endog and exog are Pandas series
When I fit OLS model with pandas series and try to do a Durbin-Watson test, the function returns nan. In that case the RegressionResult.resid attribute is a pandas series, rather than a numpy array- converting to a numpy array explicitly, the durbin_watson function works like a charm. 

My instinct is this is something that should probably be changed in OLS (to guarantee the type of resid), hence the title of the issue, but I leave that to the judgement of our fearless leaders.

``` python
import statsmodels.api as sm
import numpy as np
from pandas import DataFrame
x=np.arange(1,11)
y=[num+np.random.normal() for num in np.arange(0,5, .5)]
linmod=sm.OLS(y, x).fit()
dw=sm.stats.stattools.durbin_watson(linmod.resid)
data=DataFrame({'x':x, 'y':y}, index=x)
linmod_pandas=sm.OLS(data.y, data.x).fit()
dw_pandas=sm.stats.stattools.durbin_watson(linmod_pandas.resid)
dw_pandas1=sm.stats.stattools.durbin_watson(array(linmod_pandas.resid))
print type(linmod_pandas.resid)
print dw, dw_pandas, dw_pandas1
```



Discussion:
Thank for the report, the function is missing an asarray, it's an old function that predates pandas

Can you check the other two functions in stattools, jarque_bera and omni_normtest, both of those have an asarray in in ?


Resolving patch:
diff --git a/statsmodels/stats/stattools.py b/statsmodels/stats/stattools.py
--- a/statsmodels/stats/stattools.py
+++ b/statsmodels/stats/stattools.py
@@ -24,6 +24,7 @@ def durbin_watson(resids):
     Durbin Watson statistic.  This is defined as
     sum_(t=2)^(T)((e_t - e_(t-1))^(2))/sum_(t=1)^(T)e_t^(2)
     """
+    resids=np.asarray(resids)
     diff_resids = np.diff(resids, 1)
     dw = np.dot(diff_resids, diff_resids) / np.dot(resids, resids)
     return dw


Test patch:
diff --git a/statsmodels/stats/tests/test_statstools.py b/statsmodels/stats/tests/test_statstools.py
--- a/statsmodels/stats/tests/test_statstools.py
+++ b/statsmodels/stats/tests/test_statstools.py
@@ -1,6 +1,7 @@
 
 
 import numpy as np
+import pandas as pd
 from numpy.testing import assert_almost_equal
 from statsmodels.stats.stattools import (omni_normtest, jarque_bera,
                             durbin_watson)
@@ -150,6 +151,10 @@ def test_adnorm():
                    axis=1)
     assert_almost_equal(ad, np.column_stack(st_pv), 11)
 
+def test_durbin_watson_pandas():
+    x=np.random.randn(50)
+    x_series=pd.Series(x)
+    assert_almost_equal(durbin_watson(x), durbin_watson(x_series), decimal=13)
 
 if __name__ == '__main__':
     test_durbin_watson()
@@ -157,3 +162,4 @@ def test_adnorm():
     test_jarque_bera()
     test_shapiro()
     test_adnorm()
+    test_durbin_watson_pandas()
Repository: statsmodels/statsmodels

Issue:
why does t_test return one-sided p-value
contrast.py uses one sided p-value 

I thought results.t_test(...).pvalue returns the same as results.pvalues

bug or design? I don't see any description in the documentation, and don't remember any discussion

t_test misses Returns in docstring



Discussion:
There are tests for it (including pvalue) in `TestTtest` and `TestTtest2` in test_regression.py 

I still find it surprising to use abs and one-sided p-values.

I think this is likely a bug right? It looks like I inadvertently added the abs a long time ago.

I think it's a bug that we should change fast, but it still a break in backwards compatibility. A warning ? or just documenting it?

No, it's not the abs that's the problem, the problem is a missing *2

What does Stata do?
(Trying to do homework with kids)

The *2 is definitely not right, but then it was also wrong before back in nipy when it was 1 - t.cdf(t).

AFAIK Stata doesn't allow t-test for linear hypotheses testing. Two-sided F-test or chi-2 test only. Neither does car in R, so I don't really remember where the test came from, and I don't have this code anymore. It was in the wrapped Rpy stuff that came from nipy, so it's possible the bug was there too.

I just think we should change it to be correct. Can put a note in the release notes.

http://www.stata.com/support/faqs/statistics/one-sided-tests-for-coefficients/


Resolving patch:
diff --git a/statsmodels/stats/contrast.py b/statsmodels/stats/contrast.py
--- a/statsmodels/stats/contrast.py
+++ b/statsmodels/stats/contrast.py
@@ -24,7 +24,7 @@ def __init__(self, t=None, F=None, sd=None, effect=None, df_denom=None,
             self.sd = sd
             self.effect = effect
             self.df_denom = df_denom
-            self.pvalue = student_t.sf(np.abs(t), df_denom)
+            self.pvalue = student_t.sf(np.abs(t), df_denom) * 2
 
     def __array__(self):
         if hasattr(self, "fvalue"):


Test patch:
diff --git a/statsmodels/regression/tests/test_regression.py b/statsmodels/regression/tests/test_regression.py
--- a/statsmodels/regression/tests/test_regression.py
+++ b/statsmodels/regression/tests/test_regression.py
@@ -323,9 +323,9 @@ def test_sd(self):
         assert_almost_equal(self.Ttest.sd, self.res1.bse, DECIMAL_4)
 
     def test_pvalue(self):
-        assert_almost_equal(self.Ttest.pvalue,
-                student_t.sf(np.abs(self.res1.tvalues),self.res1.model.df_resid),
-                    DECIMAL_4)
+        assert_almost_equal(self.Ttest.pvalue, student_t.sf(
+                        np.abs(self.res1.tvalues), self.res1.model.df_resid)*2,
+                        DECIMAL_4)
 
     def test_df_denom(self):
         assert_equal(self.Ttest.df_denom, self.res1.model.df_resid)
@@ -357,7 +357,7 @@ def test_sd(self):
         assert_almost_equal(self.Ttest1.sd, 455.39079425195314, DECIMAL_4)
 
     def test_pvalue(self):
-        assert_almost_equal(self.Ttest1.pvalue, 0.0015163772380932246,
+        assert_almost_equal(self.Ttest1.pvalue, 2*0.0015163772380932246,
             DECIMAL_4)
 
     def test_df_denom(self):
Repository: statsmodels/statsmodels

Issue:
sm.load should be in the main API namespace
This is awkward since the results instances aren't imported by default.

http://stackoverflow.com/questions/16420407/python-statsmodels-ols-how-to-save-learned-model-to-file/16513935#16513935

```
import statsmodels.api as sm

data = sm.datasets.longley.load_pandas()

data.exog['constant'] = 1

results = sm.OLS(data.endog, data.exog).fit()
results.save("longley_results.pickle")

# we should probably add a generic load to the main namespace
from statsmodels.regression.linear_model import OLSResults
new_results = OLSResults.load("longley_results.pickle")

# or more generally
from statsmodels.iolib.smpickle import load_pickle
new_results = load_pickle("longley_results.pickle")
```



Discussion:

Resolving patch:
diff --git a/statsmodels/api.py b/statsmodels/api.py
--- a/statsmodels/api.py
+++ b/statsmodels/api.py
@@ -21,6 +21,8 @@
 
 from .formula import api as formula
 
+from .iolib.smpickle import load_pickle as load
+
 import os
 
 chmpath = os.path.join(os.path.dirname(__file__), 'statsmodelsdoc.chm')


Test patch:
Repository: statsmodels/statsmodels

Issue:
Baxter King has unneeded limit on value for low?
The US business cycle literature suggests 1.5 for annual data but there's a check that low is not less than 2. Maybe this was intended for quarterly data? I need to go back and check, but for now, I think we should probably just remove this check.



Discussion:

Resolving patch:
diff --git a/statsmodels/tsa/filters/bk_filter.py b/statsmodels/tsa/filters/bk_filter.py
--- a/statsmodels/tsa/filters/bk_filter.py
+++ b/statsmodels/tsa/filters/bk_filter.py
@@ -58,8 +58,6 @@ def bkfilter(X, low=6, high=32, K=12):
     #TODO: allow windowing functions to correct for Gibb's Phenomenon?
     # adjust bweights (symmetrically) by below before demeaning
     # Lancosz Sigma Factors np.sinc(2*j/(2.*K+1))
-    if low < 2:
-        raise ValueError("low cannot be less than 2")
     _pandas_wrapper = _maybe_get_pandas_wrapper(X, K)
     X = np.asarray(X)
     omega_1 = 2.*np.pi/high # convert from freq. to periodicity


Test patch:
Repository: statsmodels/statsmodels

Issue:
emplike emplikeAFT stray dimensions
numpy master for 1.8 raises an indexing error if there are extra slices

fix on the way



Discussion:

Resolving patch:
diff --git a/statsmodels/emplike/aft_el.py b/statsmodels/emplike/aft_el.py
--- a/statsmodels/emplike/aft_el.py
+++ b/statsmodels/emplike/aft_el.py
@@ -245,9 +245,10 @@ def __init__(self, endog, exog, censors):
         self.censors = self.censors[idx]
         self.censors[-1] = 1  # Sort in init, not in function
         self.uncens_nobs = np.sum(self.censors)
-        self.uncens_endog = self.endog[np.bool_(self.censors), :].\
-          reshape(-1, 1)
-        self.uncens_exog = self.exog[np.bool_(self.censors.flatten()), :]
+        mask = self.censors.ravel().astype(bool)
+        self.uncens_endog = self.endog[mask, :].reshape(-1, 1)
+        self.uncens_exog = self.exog[mask, :]
+
 
     def _is_tied(self, endog, censors):
         """


Test patch:
diff --git a/statsmodels/nonparametric/tests/test_lowess.py b/statsmodels/nonparametric/tests/test_lowess.py
--- a/statsmodels/nonparametric/tests/test_lowess.py
+++ b/statsmodels/nonparametric/tests/test_lowess.py
@@ -85,11 +85,11 @@ def test_delta(self):
         actual_lowess_del0    = lowess(test_data['y'], test_data['x'], frac=0.1)
         actual_lowess_delRdef = lowess(test_data['y'], test_data['x'], frac=0.1,
                        delta = 0.01 * np.ptp(test_data['x']))
-        actual_lowess_del1    = lowess(test_data['y'], test_data['x'], frac = 0.1, delta = 1.0)
+        actual_lowess_del1    = lowess(test_data['y'], test_data['x'], frac = 0.1, delta = 1.0 + 1e-10)
 
         assert_almost_equal(expected_lowess_del0, actual_lowess_del0, decimal = testdec)
         assert_almost_equal(expected_lowess_delRdef, actual_lowess_delRdef, decimal = testdec)
-        assert_almost_equal(expected_lowess_del1, actual_lowess_del1, decimal = testdec)
+        assert_almost_equal(expected_lowess_del1, actual_lowess_del1, decimal = 10) #testdec)
 
     def test_options(self):
         rfile = os.path.join(rpath, 'test_lowess_simple.csv')
Repository: statsmodels/statsmodels

Issue:
lowes test failure Ubuntu
https://launchpadlibrarian.net/144807626/buildlog_ubuntu-raring-amd64.statsmodels_0.5.0~ppa17~revno-1430~raring1_UPLOADING.txt.gz

```
======================================================================
ERROR: statsmodels.nonparametric.tests.test_lowess.TestLowess.test_options
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/build/buildd/statsmodels-0.5.0~ppa17~revno/debian/python-statsmodels/usr/lib/python2.7/dist-packages/statsmodels/nonparametric/tests/test_lowess.py", line 144, in test_options
    return_sorted=False)
  File "/build/buildd/statsmodels-0.5.0~ppa17~revno/debian/python-statsmodels/usr/lib/python2.7/dist-packages/statsmodels/nonparametric/smoothers_lowess.py", line 182, in lowess
    yfitted_[mask_valid] = yfitted
ValueError: NumPy boolean array indexing assignment cannot assign 20 input values to the 17 output values where the mask is true
```



Discussion:

Resolving patch:
diff --git a/statsmodels/nonparametric/smoothers_lowess.py b/statsmodels/nonparametric/smoothers_lowess.py
--- a/statsmodels/nonparametric/smoothers_lowess.py
+++ b/statsmodels/nonparametric/smoothers_lowess.py
@@ -171,7 +171,7 @@ def lowess(endog, exog, frac=2.0/3.0, it=3, delta=0.0, is_sorted=False,
         # rebuild yfitted with original indices
         # a bit messy: y might have been selected twice
         if not is_sorted:
-            yfitted_ = np.empty_like(endog)
+            yfitted_ = np.empty_like(y)
             yfitted_.fill(np.nan)
             yfitted_[sort_index] = yfitted
             yfitted = yfitted_


Test patch:
Repository: statsmodels/statsmodels

Issue:
Prefer to_offset not get_offset in tsa stuff
I'm not sure when `to_offset` was added but we should use it if available.

http://stackoverflow.com/questions/17579932/statsmodel-arma-function-is-incompatiable-with-pandas/17581170
https://github.com/pydata/pandas/issues/4205



Discussion:

Resolving patch:
diff --git a/statsmodels/tsa/base/datetools.py b/statsmodels/tsa/base/datetools.py
--- a/statsmodels/tsa/base/datetools.py
+++ b/statsmodels/tsa/base/datetools.py
@@ -6,13 +6,13 @@
 
 #NOTE: All of these frequencies assume end of period (except wrt time)
 try:
-    from pandas.tseries.frequencies import get_offset
+    from pandas.tseries.frequencies import to_offset
     class _freq_to_pandas_class(object):
         # being lazy, don't want to replace dictionary below
         def __getitem__(self, key):
-            return get_offset(key)
+            return to_offset(key)
     _freq_to_pandas = _freq_to_pandas_class()
-except ImportError, err:
+except ImportError:
     _freq_to_pandas = {'B' : pandas_datetools.BDay(1),
                        'D' : pandas_datetools.day,
                        'W' : pandas_datetools.Week(weekday=6),


Test patch:
Repository: statsmodels/statsmodels

Issue:
BLD data_files for stats.libqsturng
originally reported in #831

I did not manage to get the test and data files to install in libqsturng.

I worked around this for the required test data file in PR #905

However copyright and one txt file are in the sdist but are missing in the installed package



Discussion:
Can we close this or is it still something I need to look at?

The workaround (relocating a file) works to get the test suite to pass. 

However, it would be good, if you manage to get it to work that the extra files get installed. But we don't need to waste a lot of time on this, if you don't figure out how to get it to work right away.

The missing piece

`include_package_data=True,`
inside
`setup(name = DISTNAME,`

see section on `Non-Code Files` in http://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/

I just tested it in a virtualenv and it installed the missing files in statsmodels.stats.libqsturng

(maybe this was implied by the numpy distutils version)

@jseabold  can you just add the one line in the setup.py in master?

My tox testrun with it came back clean.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -520,4 +520,5 @@ def get_data_files():
           cmdclass = cmdclass,
           packages = packages,
           package_data = package_data,
+          include_package_data=True,
           **setuptools_kwargs)


Test patch:
Repository: statsmodels/statsmodels

Issue:
DOCS link in notebooks to notebook for download
Is it possible to add a link in the rendered notebooks that points to a download link for the original notebook?



Discussion:
Relatedly, it would be nice to have a sphinx shortcut link to each notebook by its name. Will look into it.


Resolving patch:
diff --git a/tools/nbgenerate.py b/tools/nbgenerate.py
--- a/tools/nbgenerate.py
+++ b/tools/nbgenerate.py
@@ -299,7 +299,8 @@ def nb2rst(nb, files_dir):
                 with io.open(new_html, "w", encoding="utf-8") as f:
                     f.write(title_cell["source"]+u"\n")
                     f.write(u"="*len(title_cell["source"])+u"\n\n")
-                    f.write(notebook_template.substitute(body=html_out))
+                    f.write(notebook_template.substitute(name=fname_only,
+                                                         body=html_out))
             hash_funcs.update_hash_dict(filehash, fname_only)
     except Exception, err:
         raise err
diff --git a/tools/notebook_output_template.py b/tools/notebook_output_template.py
--- a/tools/notebook_output_template.py
+++ b/tools/notebook_output_template.py
@@ -1,6 +1,10 @@
 from string import Template
 
 notebook_template = Template("""
+.. _$name_notebook:
+
+`Link to Notebook GitHub <https://github.com/statsmodels/statsmodels/tree/master/examples/notebooks/$name.ipynb>`_
+
 .. raw:: html
 
 $body


Test patch:
Repository: statsmodels/statsmodels

Issue:
no bse in robust with norm=TrimmedMean
I'm trying out different options for RLM.

I don't know what the answer is (non-differentiability ?)

```
hsalta = RLM(endog, exog, M=robust.norms.TrimmedMean()).fit()

>>> hsalta.bse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\base\wrapper.py", line 35, in __getattribute__
    obj = getattr(results, attr)
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\tools\decorators.py", line 95, in __get__
    _cachedval = self.fget(obj)
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\robust\robust_linear_model.py", line 467, in bse
    return np.sqrt(np.diag(self.bcov_scaled))
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\tools\decorators.py", line 95, in __get__
    _cachedval = self.fget(obj)
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\robust\robust_linear_model.py", line 425, in bcov_scaled
    m = np.mean(model.M.psi_deriv(self.sresid))
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\robust\norms.py", line 77, in psi_deriv
    raise NotImplementedError
NotImplementedError
```



Discussion:
typos in norms

method derive instead of deriv
subzet instead of subset

I'm not completely sure it's correct, but looks ok after fixing typos

tests coverage?

Did you push the change or should I? There's no test because trimmed mean wasn't in SAS, but it should be correct. The derivative is simple enough here.

I have it currently in my branch, working on LTS. To avoid merge conflicts it's easier if I do it.  I'm also looking at the adjustments for trimming for the scale estimate in the Doornik paper.  scale estimate is too small I guess. 


Resolving patch:
diff --git a/statsmodels/robust/norms.py b/statsmodels/robust/norms.py
--- a/statsmodels/robust/norms.py
+++ b/statsmodels/robust/norms.py
@@ -555,7 +555,7 @@ def weights(self, z):
         test = self._subset(z)
         return test
 
-    def psi_derive(self, z):
+    def psi_deriv(self, z):
         """
         The derivative of least trimmed mean psi function
 
@@ -563,7 +563,7 @@ def psi_derive(self, z):
         -----
         Used to estimate the robust covariance matrix.
         """
-        test = self.subzet(z)
+        test = self._subset(z)
         return test
 
 class Hampel(RobustNorm):


Test patch:
Repository: statsmodels/statsmodels

Issue:
add_constant incorrectly detects constant column
statsmodels/statsmodels/tools/tools.py:245 checks for columns with unit variance, not zero variance when looking for constant columns.  Any z-scored data will, of course, have unit variance.  The line should be
    if np.any(data.var(0) == 0):



Discussion:
Thank you for reporting, clearing a bug.

How did you get this? Do you have an example that triggered this?

I don't find any code in statsmodels that uses this function based on a quick file content search.

I see now that it's used through _pandas_add_constant.


Resolving patch:
diff --git a/statsmodels/tools/tools.py b/statsmodels/tools/tools.py
--- a/statsmodels/tools/tools.py
+++ b/statsmodels/tools/tools.py
@@ -242,7 +242,7 @@ def _series_add_constant(data, prepend):
 
 def _dataframe_add_constant(data, prepend):
     # check for const.
-    if np.any(data.var(0) == 1):
+    if np.any(data.var(0) == 0):
         return data
     if prepend:
         data.insert(0, 'const', 1)


Test patch:
diff --git a/statsmodels/tools/tests/test_tools.py b/statsmodels/tools/tests/test_tools.py
--- a/statsmodels/tools/tests/test_tools.py
+++ b/statsmodels/tools/tests/test_tools.py
@@ -376,6 +376,8 @@ def test_pandas_const_df():
 
 def test_pandas_const_df_prepend():
     dta = longley.load_pandas().exog
+    # regression test for #1025
+    dta['UNEMP'] /= dta['UNEMP'].std()
     dta = tools.add_constant(dta, prepend=True)
     assert_string_equal('const', dta.columns[0])
     assert_equal(dta.var(0)[0], 0)