Open j-honnacker opened 7 months ago
as a work-around, would something like this work for what you are trying to do ?
tbl.computedVarsProgram="if tip=. then total_amount=amount; else total_amount=amount+tip;"
>>> tbl.computedVarsProgram="if tip=. then total_amount=amount; else total_amount=amount+tip;"
>>> tbl
CASTable('TEST', caslib='CASUSER', computedvarsprogram='if tip=. then total_amount=amount; else total_amount=amount+tip;')
>>> tbl.fetch()
CASResults([('Fetch', Selected Rows from Table TEST
amount tip total_amount
0 35.0 3.5 38.5
1 40.0 NaN 40.0)])
Thank you for the suggestion! Unfortunately, I was preparing a demo intended to showcase the extent to which Python syntax can be applied for profiling and cleaning a CAS table. As it often happens, what seemed simple at first (handling missing values) turned out to be (currently) unfeasible :)
If I create a CAS table with missing values...
...the .fillna() method does not replace the missing values:
Is there any workaround? In this case, I want to add
amount
withtip
and save the result intotal_amount
: