Comments (2)
compile
method
The compile method is trying to pre-calculate all intermediate results of the formula. I'll show you an example:
>>> import formulas
>>> builder = formulas.Parser().ast('=MYFUNC((1+2)+a)')[1]
>>> builder.dsp.plot()
the Parser
has generated a Builder
with the following Dispatcher
:
When compile the function, the Builder
has generated a new Dispatcher
with all pre-calculated outputs (see (1+2)
).
>>> func = builder.compile()
>>> func.plot()
In this case the builder couldn't execute the MYFUNC, because it has has a variable as input. But if you execute the compiled function you will get the same error:
>>> func(1)
Traceback (most recent call last):
...
schedula.utils.exc.DispatcherError: ("Failed DISPATCHING '%s' due to:\n %r", 'MYFUNC', FunctionError('Function not implemented!',))
Error description
In the first case your function has not any variable, so the compile
method executes the function MYFUNC
raising the error.
While, in the second case, since the function has a variable as input, the compile
method cannot execute the function. In any case, you will receive the same error in the first execution of the compiled function.
Detect not implemented functions
If you want to detect not implemented functions, you can do the following:
>>> [k for k, v in builder.dsp.function_nodes.items() if v['function'] is formulas.functions.not_implemented]
['MYFUNC']
from formulas.
Thanks a lot for the explanation.
It was very helpful!
from formulas.
Related Issues (20)
- Get one liner formula from graph node HOT 5
- General info HOT 1
- Slow Response in Excel Calculate Function with Entire Column Formulas HOT 1
- get_unused_node_id support removed for schedula package HOT 1
- Looking for an example of how to use the compile and dispatch pipe functionality
- Optimizing Excel Model Efficiency with Pre-Calculation
- INDEX function discrepancy
- How to have an exception when a formula is not supported
- add topic tags in About section
- excel cell names/alias are identified as loops HOT 1
- possibility to extract sugbraphs from complex models HOT 2
- discrepancy between visualized value in excel and value read-in the model HOT 2
- AttributeError: 'DataTableFormula' object has no attribute 'text' HOT 1
- Regarding the import of the model with from_dict after to_dict, the default value defined by the override is not the same as the normal result HOT 2
- I want to run excel without an excel file, and I think the to_dict and from_dict for this project are great HOT 4
- possibility to init excelModel from a function HOT 2
- how to show transfered formula?
- Calculation fails on dates HOT 1
- In excel, I want to implement define lists and then get the results via "formulas"
- Find recursively "pure input" cells HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formulas.