Esempio n. 1
0
 def test_single_quoted_word(self):
     expr = pt.c(5).c(6).quote(pt.add).call
     result = expr['2019-01-01'].iloc[0, -1]
     self.assertEqual(result, 11)
Esempio n. 2
0
 def test_multiple_quoted_words(self):
     expr = pt.c(5).c(6).quote(pt.c(1).add).call
     result = expr['2019-01-01'].iloc[0, -1]
     self.assertEqual(result, 7)
Esempio n. 3
0
 def test_ge(self):
     expr = pt.c(5).c(6).ge
     result = expr['2019-01-01'].iloc[0, 0]
     self.assertEqual(result, 0.)
Esempio n. 4
0
 def test_neg(self):
     expr = pt.c(5).neg
     result = expr['2019-01-01'].iloc[0, 0]
     self.assertEqual(result, -5.)
Esempio n. 5
0
 def test_add(self):
     expr = pt.c(5).c(6).add
     result = expr['2019-01-01'].iloc[0, 0]
     self.assertEqual(result, 11.)
Esempio n. 6
0
 def test_sub(self):
     expr = pt.c(5).c(6).sub
     result = expr['2019-01-01'].iloc[0, 0]
     self.assertEqual(result, -1.)
Esempio n. 7
0
 def test_join_dates(self):
     expr = pt.c(5).c(6).join('2019-01-05')
     result = expr['2019-01-01':'2019-01-15']
     self.assertEqual(result.iloc[3, -1], 5)
     self.assertEqual(result.iloc[4, -1], 6)
Esempio n. 8
0
 def test_date_range(self):
     expr = pt.c(5)
     result = expr['2019-01-01':'2019-01-15']
     self.assertEqual(result.shape[0], 10)
Esempio n. 9
0
 def test_join_int(self):
     expr = pt.c(5).c(6).join(3)
     result = expr[:10]
     self.assertEqual(result.iloc[2, -1], 5)
     self.assertEqual(result.iloc[3, -1], 6)
Esempio n. 10
0
 def test_int_range(self):
     expr = pt.c(5)
     result = expr[0:10]
     self.assertEqual(result.shape[0], 10)
Esempio n. 11
0
 def test_cleave(self):
     expr = pt.c(4).quote(pt.neg).quote(pt.sqrt).cleave(2)
     result = expr['2019-01-01']
     self.assertEqual(result.iloc[0, -1], 2)
     self.assertEqual(result.iloc[0, -2], -4)
Esempio n. 12
0
 def test_each_with_copy(self):
     expr = pt.c(5).c(6).quote(pt.c(1).add).each(copy=True)
     result = expr['2019-01-01']
     self.assertEqual(result.shape[1], 4)
Esempio n. 13
0
 def test_each(self):
     expr = pt.c(5).c(6).quote(pt.c(1).add).each
     result = expr['2019-01-01']
     self.assertEqual(result.iloc[0, -1], 7)
     self.assertEqual(result.iloc[0, -2], 6)