Pascal's Triangle - Alteryx Python SDK

15 August 2018
The original version of this article with working code is here
.
After a couple of posts (I & II) getting my feet wet with the Python SDK module for Alteryx I finally get to build a tool that actually uses some code:

The Pascal's Triangle generator

Following the original recipe, I duplicated a sample folder, renamed the files, removed most of the superfluous code, added the pieces I needed and, finally, connected my code with the AyxPlugin.All so that I can generate my own Pascal's Triangles with a single tool.The main difference with the previous tools is that the code references two python libraries that are not part of the miniconda distribution that comes with Alteryx:On hindsight, this is an overkill and I could/should have just written a self-contained implementation. BUT I did want to play with importing packages and virtual environments so...The installer is available here.  Install it by double clicking on it, it will appear in the “Laboratory” tools. Unzip the .yxi to explore the files.I first wrote a working example using Jupyter:Then I migrated that code into the PascalTriangleEngine.py
  1. Import libraries
  2. Bring Pascal Function
  3. Update pi_push_all_records
Finally, I made sure to follow the steps detailed in the official documentation to obtain the installer and proper dependencies:
  1. Create a virtual environment.
  2. Install packages in the virtual environment.
  3. Create the requirements.txt file using pip freeze.
  4. Create the installer .yxi as described in previous posts.
Voilà. Tool ready (here).Please, leave any comments below or reach me at dsmd4vid
Author:
David Sanchez
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Information Lab and data industry
Subscribe now
© 2024 The Information Lab