Пример #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)
Пример #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)
Пример #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.)
Пример #4
0
 def test_neg(self):
     expr = pt.c(5).neg
     result = expr['2019-01-01'].iloc[0, 0]
     self.assertEqual(result, -5.)
Пример #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.)
Пример #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.)
Пример #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)
Пример #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)
Пример #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)
Пример #10
0
 def test_int_range(self):
     expr = pt.c(5)
     result = expr[0:10]
     self.assertEqual(result.shape[0], 10)
Пример #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)
Пример #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)
Пример #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)