Example #1
0
 def test_transform(self):
     X = numpy.asarray([
         "January", "February", "March", "April", "May", "June", "July",
         "August", "September", "October", "November", "December"
     ])
     Xt_exp = [
         True, True, False, False, True, False, False, False, False, False,
         False, False
     ]
     transformer = MatchesTransformer("ar?y")
     self.assertEqual(Xt_exp, transformer.transform(X).tolist())
     X = DataFrame(X.reshape(-1, 1), columns=["month"])
     Xt = transformer.transform(X)
     self.assertTrue((12, 1), Xt.shape)
     self.assertEqual(Xt_exp, Xt.tolist())
Example #2
0
 def test_transform(self):
     X = numpy.asarray([
         "January", "February", "March", "April", "May", "June", "July",
         "August", "September", "October", "November", "December"
     ])
     transformer = MatchesTransformer("ar?y")
     self.assertEqual(
         [[True], [True], [False], [False], [True], [False], [False],
          [False], [False], [False], [False], [False]],
         transformer.transform(X).tolist())