Master LLMs with our FREE course in collaboration with Activeloop & Intel Disruptor Initiative. Join now!


Sexy Plotly Range Sliders: Prompting GPT-4 For Interactive Python Visuals
Data Science   Latest   Machine Learning

Sexy Plotly Range Sliders: Prompting GPT-4 For Interactive Python Visuals

Last Updated on January 5, 2024 by Editorial Team

Author(s): John Loewen, PhD

Originally published on Towards AI.

A modular approach to Python plotly range slider code creation
Dall-E image: Impressionist interpretation of range slider in thick, rainbow colour

Data visualization skills are an essential component of quality data analysis.

For data visualization creation, Python is an awesome language — with an array of tools for creating interactive visualizations.

As an example, let’s take a look at how to add a range slider to your Python data visualizations, by using the Plotly library.

For this example, we will be using a cool new dataset offered up by the UN Department of Economic and Social Affairs website (HERE).

Wait! Even better! Let’s prompt GPT-4 for rapid data cleaning, processing, and code generation for our sexy range slider.

Rapid? Sexy? How?

Let me show you!

The UN dataset for this example models population growth projections by age groups from 2022 to 2100.

The file I selected is under the “Probabilistic Projections” tab and it is called “Population Percentage”.

Data set xlsx file for this example.

There are multiple tables in the xlsx file. For this exercise, I selected the “median” table and exported it as a CSV.

After a cursory view, I can see that some data cleaning is in order. The actual data headers start on Row 17. So we can remove the first 16 Rows of data (or just start… Read the full blog for free on Medium.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓