Issue 1:
I am running into an issue trying to run OLS using pandas 0.13.1.

Here is a simple example: I want to regress a variable on itself, in this case excess returns. The intercept should be 0, and the coefficient should be 1. pandas provides the wrong estimates, while statsmodels gives the correct estimates.

This is not due to the silly regression specification, as I have noticed the pandas.ols estimates are inconsistent for other specifications as well.

Has anyone else encountered this problem?

import pandas as pd
import statsmodels.formula.api

In [1]: pd.ols(y=test.exret,x=test.exret).beta
Out[1]:
x 0.003107
intercept 0.006438
dtype: float64

In [2]: sm.ols(formula="exret ~ exret", data=test).fit().params
Out[2]:
Intercept -3.469447e-18
exret 1.000000e+00
dtype: float64

In [3]: pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.11.0-19-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.13.1
Cython: 0.20.1
numpy: 1.8.0
scipy: 0.13.3
statsmodels: 0.5.0
IPython: 2.0.0-dev
sphinx: 1.2.1
patsy: 0.2.1
scikits.timeseries: None
dateutil: 1.5
pytz: 2013b
bottleneck: None
tables: 3.1.0
numexpr: 2.3.1
matplotlib: 1.3.1
openpyxl: 1.8.2
xlrd: 0.9.2
xlwt: 0.7.5
xlsxwriter: 0.5.2
sqlalchemy: 0.9.2
lxml: 3.3.1
bs4: 4.3.1
html5lib: None
bq: None
apiclient: None

Issue 2:
To get an auto-diff on a timeseries I do:

In [47]: ts
Out[47]:
0 2011-04-16 00:00:00.025000
1 2011-04-16 00:00:00.152999
2 2011-04-16 00:00:00.280999
3 2011-04-16 00:00:00.409000
4 2011-04-16 00:00:00.537000
5 2011-04-16 00:00:00.665000
6 2011-04-16 00:00:00.792999
7 2011-04-16 00:00:00.921000
8 2011-04-16 00:00:01.049000
9 2011-04-16 00:00:01.177000
10 2011-04-16 00:00:01.297000
11 2011-04-16 00:00:01.424999
12 2011-04-16 00:00:01.552999
13 2011-04-16 00:00:01.680999
14 2011-04-16 00:00:01.809000
...
25646 2011-04-16 00:59:58.143001
25647 2011-04-16 00:59:58.270999
25648 2011-04-16 00:59:58.398998
25649 2011-04-16 00:59:58.527000
25650 2011-04-16 00:59:58.654998
25651 2011-04-16 00:59:58.783000
25652 2011-04-16 00:59:58.910999
25653 2011-04-16 00:59:59.039001
25654 2011-04-16 00:59:59.166999
25655 2011-04-16 00:59:59.294998
25656 2011-04-16 00:59:59.423000
25657 2011-04-16 00:59:59.550998
25658 2011-04-16 00:59:59.679000
25659 2011-04-16 00:59:59.806999
25660 2011-04-16 00:59:59.935001
Length: 25661, dtype: datetime64[ns]

In [48]: ts.diff()
Out[48]:
0 NaN
1 127999000
2 128000000
3 128001000
4 128000000
5 128000000
6 127999000
7 128001000
8 128000000
9 128000000
10 120000000
11 127999000
12 128000000
13 128000000
14 128001000
...
25646 128002000
25647 127998000
25648 127999000
25649 128002000
25650 127998000
25651 128002000
25652 127999000
25653 128002000
25654 127998000
25655 127999000
25656 128002000
25657 127998000
25658 128002000
25659 127999000
25660 128002000
Length: 25661, dtype: float64

One thing would be nice if a diff on a time-series automatically becomes a timedelta?

When converting the result of the ts.diff() with astype('timedelta64[ns']) it should convert the NaN into a NaT, if I understand things correctly?

Instead this happens and I have to cut off the NaN to make it work:

In [49]: ts.diff().astype('timedelta[ns]')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-49-d1462d75fb33> in <module>()
----> 1 ts.diff().astype('timedelta[ns]')

/usr/local/epd/lib/python2.7/site-packages/pandas/core/series.pyc in astype(self, dtype)
830 See numpy.ndarray.astype
831 """
--> 832 casted = com._astype_nansafe(self.values, dtype)
833 return self._constructor(casted, index=self.index, name=self.name,
834 dtype=casted.dtype)

/usr/local/epd/lib/python2.7/site-packages/pandas/core/common.pyc in _astype_nansafe(arr, dtype, copy)
1361 """ return a view if copy is False """
1362 if not isinstance(dtype, np.dtype):
-> 1363 dtype = np.dtype(dtype)
1364
1365 if issubclass(arr.dtype.type, np.datetime64):

TypeError: data type not understood

In [50]: ts.diff().astype('timedelta64[ns]')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-50-e9c54d8f8d73> in <module>()
----> 1 ts.diff().astype('timedelta64[ns]')

/usr/local/epd/lib/python2.7/site-packages/pandas/core/series.pyc in astype(self, dtype)
830 See numpy.ndarray.astype
831 """
--> 832 casted = com._astype_nansafe(self.values, dtype)
833 return self._constructor(casted, index=self.index, name=self.name,
834 dtype=casted.dtype)

/usr/local/epd/lib/python2.7/site-packages/pandas/core/common.pyc in _astype_nansafe(arr, dtype, copy)
1370
1371 if np.isnan(arr).any():
-> 1372 raise ValueError('Cannot convert NA to integer')
1373 elif arr.dtype == np.object_ and np.issubdtype(dtype.type, np.integer):
1374 # work around NumPy brokenness, #1987

ValueError: Cannot convert NA to integer

In [51]: ts.diff()[1:].astype('timedelta64[ns]')
Out[51]:
1 00:00:00.127999
2 00:00:00.128000
3 00:00:00.128001
4 00:00:00.128000
5 00:00:00.128000
6 00:00:00.127999
7 00:00:00.128001
8 00:00:00.128000
9 00:00:00.128000
10 00:00:00.120000
11 00:00:00.127999
12 00:00:00.128000
13 00:00:00.128000
14 00:00:00.128001
15 00:00:00.128000
...
25646 00:00:00.128002
25647 00:00:00.127998
25648 00:00:00.127999
25649 00:00:00.128002
25650 00:00:00.127998
25651 00:00:00.128002
25652 00:00:00.127999
25653 00:00:00.128002
25654 00:00:00.127998
25655 00:00:00.127999
25656 00:00:00.128002
25657 00:00:00.127998
25658 00:00:00.128002
25659 00:00:00.127999
25660 00:00:00.128002
Length: 25660, dtype: timedelta64[ns]