diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..f9bd145 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include requirements.txt diff --git a/README.md b/README.md index e004841..087ba9c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## XLtoy: -The ultimate toolkit for Microsoft Excel modelers and mod-operations. +The ultimate toolkit for Microsoft Excel modelers and model-ops. #### The name @@ -121,11 +121,9 @@ Options: ``` Follow tutorials to a deep dive into all features - -* [Tutorial](https://raw.githubusercontent.com/glaucouri/xltoy/main/tutorial.md) -* [working rules](https://raw.githubusercontent.com/glaucouri/xltoy/main/rules.md) - - +* [working rules](https://raw.githubusercontent.com/glaucouri/xltoy/main/rules.md) How to manage working areas and how works the parser +* [Tutorial1](https://raw.githubusercontent.com/glaucouri/xltoy/main/tutorial.md) How to manage values +* [Tutorial2](https://raw.githubusercontent.com/glaucouri/xltoy/main/tutorial2.md) How to manage models and formulas #### Framework descriptions diff --git a/rules.md b/rules.md index 3cedb28..f6d2176 100644 --- a/rules.md +++ b/rules.md @@ -19,6 +19,12 @@ from same position and must have the same shape. With this technique, each names is coupled to his equation. If names range is not given equation will be named as sequence of anon_* names. +### Parser: implemented syntax + +* basic operators: \+ - \* / +* basic functions: sqrt len sum min max ave len log +* logic operators: and or +* function: rand ### Parser: unhandled syntax diff --git a/tutorial.md b/tutorial.md index 0d0f264..8c15aa1 100644 --- a/tutorial.md +++ b/tutorial.md @@ -53,7 +53,7 @@ So in relative mode, no difference found #### case 3: huge data diff (>3M cells) -This exercise was done using data from *https://data.world/* a free datasources provider. +This exercise was done using data from *https://data.world/* a free data sources provider. [data source](https://tinyurl.com/ybhqd8g9) diff --git a/tutorial2.md b/tutorial2.md new file mode 100644 index 0000000..308a6fa --- /dev/null +++ b/tutorial2.md @@ -0,0 +1,80 @@ +## xltoy tutorial +Here are some examples useful to understand use cases. All used files are +available in this repository. + +#### case1: values diff on simple model + +In this example, we compare 2 workbook with only 1 data range each one. +Working area is set only on numeric cells, so we can do positional difference. +In second workbook we have add a new line, row 12 corresponding to VAR_9 +and changed a cell in position M7. + +![xlsample](https://github.com/glaucouri/xltoy/raw/main/img/data_sample1.png?raw=true) +![xlsample](https://github.com/glaucouri/xltoy/raw/main/img/data_sample1_diff.png?raw=true) + +``` +(xltoy)$ xltoy diff data/data_sample1.xlsx data/data_sample1_diff.xlsx +add: + D12: 0.0005004366657703548 + E12: 0.000547121974635698 + F12: 0.0005295198569146752 + G12: 0.0005072172479631228 + H12: 0.0005379024723558388 + I12: 0.0005430174783953075 + J12: 0.0005689182087171011 + K12: 0.0005538596087349697 + L12: 0.0005297508191981888 + M12: 0.0005409815166305603 + N12: 0.0005876844243079103 + O12: 0.0006204197757602877 + P12: 0.0006232399068120899 + Q12: 0.0007001965787723482 + R12: 0.0007432987416372932 + S12: 0.0007323677326847715 +change: + data_sample: + M7: 905509 -> 905510 +``` + +#### case2: values diff on simple model [positional relative] + +First workbook is from case1 +In second workbook range was moved to another position + +![xlsample](https://github.com/glaucouri/xltoy/raw/main/img/data_sample1_relative.png?raw=true) + +``` +(xltoy)$ xltoy diff data/data_sample1.xlsx data/data_sample1_relative.xlsx --relative + + +``` + +So in relative mode, no difference found + + + +#### case 3: collecting formula on anonymous model + +This is an example of a common forecasting model that can be well handled by XLtoy. +![xlsample](https://github.com/glaucouri/xltoy/raw/main/img/simple_model.png?raw=true) +Green cells contain actual (or hystorical) values, model in salmon for the first calculated step, +and in yellow dragged cells, the rest of the model. As you can see in the outcome, +no labels are provided in the input so the collector assign to each formula a label anon_1,2,3,..,n + +``` +(xltoy)$ xltoy collect data/anon_sheet.xlsx --yaml +WAR Found anonymous model Sheet1 : 11 anon labels assigned +Sheet1: + anon_1: =(E3+D3)/2 + anon_10: =LOG(F11) + anon_11: =LOG($F$11) + anon_2: =(E4+D4)/2 + anon_3: =(E5+D5)/2 + anon_4: =(E6+D6)/2 + anon_5: =IF(D7,D7+E7,D7-E7) + anon_6: =RAND() + anon_7: =E9*0.023 + anon_8: =8 + anon_9: =12 + +``` \ No newline at end of file diff --git a/xltoy/parser.py b/xltoy/parser.py index 6314aa8..a783fb8 100644 --- a/xltoy/parser.py +++ b/xltoy/parser.py @@ -68,7 +68,7 @@ def stat_function(name, obj=expr, empty=False): maxFunc = stat_function("max") aveFunc = stat_function("ave") sqrFunc = stat_function("sqrt") - lenFunc = stat_function("sqrt") + lenFunc = stat_function("len") andFunc = stat_function("and", obj=condExpr).setParseAction(self.logic_operation) orFunc = stat_function("or", obj=condExpr).setParseAction(self.logic_operation) randFunc= stat_function("rand", empty=True)