PageRenderTime 162ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/pandas/tests/test_ndframe.py

http://github.com/wesm/pandas
Python | 30 lines | 20 code | 9 blank | 1 comment | 1 complexity | 8abf11b10c8290d336b9e2ac8a083450 MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0
  1. import unittest
  2. import numpy as np
  3. from pandas.core.generic import NDFrame
  4. import pandas.util.testing as t
  5. class TestNDFrame(unittest.TestCase):
  6. def setUp(self):
  7. tdf = t.makeTimeDataFrame()
  8. self.ndf = NDFrame(tdf._data)
  9. def test_constructor(self):
  10. # with cast
  11. ndf = NDFrame(self.ndf._data, dtype=np.int64)
  12. self.assert_(ndf.values.dtype == np.int64)
  13. def test_ndim(self):
  14. self.assertEquals(self.ndf.ndim, 2)
  15. def test_astype(self):
  16. casted = self.ndf.astype(int)
  17. self.assert_(casted.values.dtype == np.int64)
  18. if __name__ == '__main__':
  19. import nose
  20. nose.runmodule(argv=[__file__,'-vvs','-x','--pdb', '--pdb-failure'],
  21. exit=False)