Beispiel #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)
Beispiel #2
0
 def test_1(self):
     self.assertEqual(math_parser.evaluate("foo+bar", self.variables), 9)
Beispiel #3
0
 def testSingleVariable(self):
     self.assertEqual(math_parser.evaluate("foo", self.variables), 4)
Beispiel #4
0
 def test_2(self):
     self.assertEqual(math_parser.evaluate("a*b+c", self.variables), 5)
Beispiel #5
0
 def test_1(self):
     self.assertEqual(math_parser.evaluate("a+b*c", self.variables), 7)
Beispiel #6
0
 def test_6(self):
     self.assertEqual(math_parser.evaluate("foo+(bar*c*a)+((b*c))", self.variables), 704)
Beispiel #7
0
 def test_4(self):
     self.assertEqual(math_parser.evaluate("foo+(bar*c*a)+b", self.variables), 506)
Beispiel #8
0
 def test_2(self):
     self.assertEqual(math_parser.evaluate("foo+(bar*c)", self.variables), 504)