示例#1
0
 def test_array1d(self):
     des = tools.categorical(self.instr)
     assert_array_equal(des[:,-5:], self.dummy)
     assert_equal(des.shape[1],6)
示例#2
0
 def test_structarray1d_drop(self):
     instr = self.structdes['str_instr'].view(dtype=[('var1', 'a10')])
     dum = tools.categorical(instr, drop=True)
     test_dum = np.column_stack(([dum[_] for _ in dum.dtype.names]))
     assert_array_equal(test_dum, self.dummy)
     assert_equal(len(dum.dtype.names), 5)
示例#3
0
 def test_array2d(self):
     des = np.column_stack((self.des, self.instr, self.des))
     des = tools.categorical(des, col=2)
     assert_array_equal(des[:,-5:], self.dummy)
     assert_equal(des.shape[1],10)
示例#4
0
 def test_structarray2dint(self):
     des = tools.categorical(self.structdes, col=3)
     test_des = np.column_stack(([des[_] for _ in des.dtype.names[-5:]]))
     assert_array_equal(test_des, self.dummy)
     assert_equal(len(des.dtype.names), 9)
示例#5
0
 def test_structarray2d_drop(self):
     des = tools.categorical(self.structdes, col='str_instr', drop=True)
     test_des = np.column_stack(([des[_] for _ in des.dtype.names[-5:]]))
     assert_array_equal(test_des, self.dummy)
     assert_equal(len(des.dtype.names), 8)
示例#6
0
 def test_recarray1d(self):
     instr = self.structdes['str_instr'].view(np.recarray)
     dum = tools.categorical(instr)
     test_dum = np.column_stack(([dum[_] for _ in dum.dtype.names[-5:]]))
     assert_array_equal(test_dum, self.dummy)
     assert_equal(len(dum.dtype.names), 6)
示例#7
0
 def test_recarray2d(self):
     des = tools.categorical(self.recdes, col='str_instr')
     # better way to do this?
     test_des = np.column_stack(([des[_] for _ in des.dtype.names[-5:]]))
     assert_array_equal(test_des, self.dummy)
     assert_equal(len(des.dtype.names), 9)
示例#8
0
 def test_array1d_drop(self):
     des = tools.categorical(self.string_var, drop=True)
     assert_array_equal(des, self.dummy)
     assert_equal(des.shape[1],5)
示例#9
0
 def test_structarray1d(self):
     instr = self.structdes['instrument'].view(dtype=[('var1', 'f4')])
     dum = tools.categorical(instr)
     test_dum = np.column_stack(([dum[_] for _ in dum.dtype.names[-5:]]))
     assert_array_equal(test_dum, self.dummy)
     assert_equal(len(dum.dtype.names), 6)
示例#10
0
 def test_recarray1d_drop(self):
     instr = self.structdes['instrument'].view(np.recarray)
     dum = tools.categorical(instr, drop=True)
     test_dum = np.column_stack(([dum[_] for _ in dum.dtype.names]))
     assert_array_equal(test_dum, self.dummy)
     assert_equal(len(dum.dtype.names), 5)