예제 #1
0
    def on_ok(self):
        w1 = self.get_widget('ncol')
        w2 = self.get_widget('nexp')

        col_dict = {}
        for i,f in enumerate(self.parentApp.data):
            col_dict = {**col_dict, **{'d{0}c{1}'.format(i+1, j+1) : f[col] for j, col in enumerate(f)}}

        vals = math_parser.evaluate(w2.value, col_dict)
        self.parentApp.data[self.parentApp.current_dataset-1][w1.value] = vals
        self.parentApp.getForm(self.return_id).ncols += 1
        self.parentApp.getForm(self.return_id).draw_columns()
        self.parentApp.switchForm(self.return_id)
예제 #2
0
 def test_1(self):
     self.assertEqual(math_parser.evaluate("foo+bar", self.variables), 9)
예제 #3
0
 def testSingleVariable(self):
     self.assertEqual(math_parser.evaluate("foo", self.variables), 4)
예제 #4
0
 def test_2(self):
     self.assertEqual(math_parser.evaluate("a*b+c", self.variables), 5)
예제 #5
0
 def test_1(self):
     self.assertEqual(math_parser.evaluate("a+b*c", self.variables), 7)
예제 #6
0
 def test_6(self):
     self.assertEqual(math_parser.evaluate("foo+(bar*c*a)+((b*c))", self.variables), 704)
예제 #7
0
 def test_4(self):
     self.assertEqual(math_parser.evaluate("foo+(bar*c*a)+b", self.variables), 506)
예제 #8
0
 def test_2(self):
     self.assertEqual(math_parser.evaluate("foo+(bar*c)", self.variables), 504)