Repository: pandas-dev/pandas

Issue:
test_class_ops: ubuntu 14.04 32bit  AssertionError: 1401254445 != 1401254446
```
======================================================================
FAIL: test_class_ops (pandas.tseries.tests.test_timeseries.TestTimestamp)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/pandas-0.14.0~rc1+git79-g1fa5dd4/debian/tmp/usr/lib/python2.7/dist-packages/pandas/tseries/tests/test_timeseries.py", line 2711, in test_class_ops
    compare(Timestamp.now('UTC'),datetime.now(pytz.timezone('UTC')))
  File "/tmp/buildd/pandas-0.14.0~rc1+git79-g1fa5dd4/debian/tmp/usr/lib/python2.7/dist-packages/pandas/tseries/tests/test_timeseries.py", line 2708, in compare
    self.assertEqual(int(Timestamp(x).value/1e9), int(Timestamp(y).value/1e9))
AssertionError: 1401254445 != 1401254446

----------------------------------------------------------------------
Ran 7152 tests in 664.150s
```

```
commit: None
python: 2.7.6.final.0
python-bits: 32
OS: Linux
OS-release: 3.2.0-4-amd64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: C
LANG: C

pandas: 0.14.0.dev
nose: 1.3.1
Cython: 0.20.1post0
numpy: 1.8.1
scipy: 0.13.3
statsmodels: 0.5.0
IPython: None
sphinx: 1.2.2
patsy: 0.2.1
scikits.timeseries: None
dateutil: 1.5
pytz: 2012c
bottleneck: None
tables: 3.1.0
numexpr: 2.2.2
matplotlib: 1.3.1
openpyxl: 1.7.0
xlrd: 0.9.2
xlwt: 0.7.5
xlsxwriter: None
lxml: None
bs4: 4.2.1
html5lib: 0.999
bq: None
apiclient: None
rpy2: None
sqlalchemy: None
pymysql: None
psycopg2: None
```



Discussion:
what build is this under? I think I have `schroot` to `wheezy/sid` only?

On Wed, 28 May 2014, jreback wrote:

>    what build is this under? I think I have schroot to wheezy/sid only?

in a clean 14.04 chroot, which was originally generated by cowbuilder
--create

if you have a debian/ubuntu box I could probably give you a few lines to
run to create a similar chroot for 14.04. let me know

## 

Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist,            Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik

alternative could be to follow
http://neuro.debian.net/blog/2012/2012-04-14_ndtools.html
and get a full range of chroots for your troubleshooting pleasure ;)
(few additional changes would probably be needed depending on what is
your base system and version of debootstrap)

On Wed, 28 May 2014, jreback wrote:

>    what build is this under? I think I have schroot to wheezy/sid only?
> 
>    —
>    Reply to this email directly or [1]view it on GitHub.
> 
> References
> 
>    Visible links
> 1. https://github.com/pydata/pandas/issues/7263#issuecomment-44412008

## 

Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist,            Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik


Resolving patch:
diff --git a/pandas/io/stata.py b/pandas/io/stata.py
--- a/pandas/io/stata.py
+++ b/pandas/io/stata.py
@@ -99,7 +99,7 @@ def _stata_elapsed_date_to_datetime(date, fmt):
     #TODO: IIRC relative delta doesn't play well with np.datetime?
     #TODO: When pandas supports more than datetime64[ns], this should be improved to use correct range, e.g. datetime[Y] for yearly
     if np.isnan(date):
-        return np.datetime64('nat')
+        return NaT
 
     date = int(date)
     stata_epoch = datetime.datetime(1960, 1, 1)


Test patch:
diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py
--- a/pandas/tseries/tests/test_timeseries.py
+++ b/pandas/tseries/tests/test_timeseries.py
@@ -2705,7 +2705,7 @@ def test_class_ops(self):
         import pytz
 
         def compare(x,y):
-            self.assertEqual(int(Timestamp(x).value/1e9), int(Timestamp(y).value/1e9))
+            self.assertEqual(int(np.round(Timestamp(x).value/1e9)), int(np.round(Timestamp(y).value/1e9)))
 
         compare(Timestamp.now(),datetime.now())
         compare(Timestamp.now('UTC'),datetime.now(pytz.timezone('UTC')))