The Scipy series continues with the py_EvalU spreadsheet included in the download file:
The spreadsheet and associated Python packages have had significant edits since the first post in this series, so please download the latest file.
Details of the required pyxll package (including download, free trial, and full documentation) can be found at: pyxll
For those installing a new copy of pyxll, a 10% discount on the first year’s fees is available using the coupon code “NEWTONEXCELBACH10”.
The py_EvalU spreadsheet provides functions for the evaluation of functions entered as text, conversion and evaluation of units, and high precision maths functions. In addition to Numpy and Scipy, the following Python packages should be installed:
- Sympy
- Pint
- MPMath
- Matplotlib
- Plotly
The Examples sheet has various functions for working with different units:
py_ConvertA converts column arrays between specified unit systems:

py_ToSIBase and py_FromSIBase convert between base SI units and a specified unit system:


The py_ConvertTab converts between unit systems in tabular format:

List_units lists all unit names in a specified system:

The functions below convert between metric and feet and inches in fraction format:

The py_EvalU function evaluates a text string, adjusting for the specified input and output units:


The Latex sheet displays the Plot_Math function, which converts a text string to Latex format, then uses Matplotlib to convert this to a graphic image. The original text string may be evaluated with the py_Eval or py_EvalU functions, or optionally Plot_Math may return the evaluated result (Cell C27 in the image below):

The Implied Units sheet shows two options for unit-aware evaluation of equations including factors with implied units:

The mpmath sheet shows examples of high precision calculations using the mp_Eval function. In the example below the sum of 3 cubes of 17 digit integers is correctly evaluated to 42, whereas floating point calculations return a value of 1.09785E+36.

Finally the Pint_Quant sheet shows the creation of Pint Quantity objects with specified units, and the creation of new units:

Pingback: Plotting Carlyle’s Circle with Matplotlib in Excel | Newton Excel Bach, not (just) an Excel Blog
Pingback: Evaluate and display definite integrals in Excel with Latex and Matplotlib | Newton Excel Bach, not (just) an Excel Blog