From the course: Python in Excel: Data Outputs in Custom Data Visualizations and Algorithms

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Configuring Python in Excel with dynamic parameters

Configuring Python in Excel with dynamic parameters

- [Instructor] Now let's have some fun in the Python and Excel sandbox environment by making our algorithms and visuals dynamic. The K means clustering model currently sets the number of clusters to two. We fixed it in the Python formula when we created the K means object, but we can make it dynamic by having it referenced another cell in our Excel model. We see there's an orange cell in the middle of the K means modeling steps. This is where we'll input the number of clusters. Because I set the maximum number of clusters for the scatter plot to five through five series in the chart, I already validated the cell, so it's a whole number between one and five. If we enter six or 2.5 for example, then it throws an error message in Excel. In the K means modeling process, we can use an elbow chart to determine the optimal number of clusters. That's out of the scope of this course, however, but there are courses in the library that talk about this topic. Instead, let's use this dynamic input…

Contents