OpenAI recently announced that their Code Interpreter is now available for all ChatGPT Plus users.
Most descriptions of the Code Interpreter are something like “it allows users to run code, analyze data, create charts”. I used to say it’s like having a data scientist in your pocket. But that was before I learned about the wide range of use cases, outside of reading and analyzing CSVs.
Let’s dive in and see what this thing can really do.
What actually is the Code Interpreter?
The Code Interpreter is a plugin for ChatGPT (only available to Plus users at the moment). Its key feature allows you to process and execute code based on natural language. This power combined with its ability to read files makes it particularly helpful for data analysis.
How Does the Code Interpreter Work?
The Code Interpreter is only available via ChatGPT (no API access, yet). It processes prompts from users and translates those prompts into code.
For example, you might say: “What is the most common competitor mentioned in this user survey we did”. Code Interpreter will translate that into the following code.
This code loads the survey data from a CSV file, extracts the column that contains mentions of competitors, and then identifies the most commonly mentioned competitor.
But Code Interpreter can do so much more aside from data analysis. Let’s take a look at some use-cases.
10 Code Interpreter use cases
1. Convert files
Convert files straight inside of ChatGPT. For example, convert a GIF into an MP4 and add a slow zoom.
- Prompt: "Convert this GIF into an MP4 with a slow zoom effect."
2. Turn images into videos
Use Code Interpreter to turn still images into videos.
- Prompt: "Create a video by panning this still image from left to right."
3. Generate QR codes
Generate a completely functioning QR code in seconds.
- Prompt: "Generate a QR code for this URL: "prompthub.us"
4. Analyze stock (or crypto) options
Analyze specific stock holdings and get feedback on the best plan of action via data. For example, analyzing AAPL's options expiring on a certain date and highlighting rewards with low risk.
- Prompt: "Analyze the stock options for AAPL expiring on [insert date here] and highlight the options with low risk and high potential."
5. Graph public Ddata
I’ve been experimenting with this interesting dataset on Kaggle. It is about happiness and alcohol consumption. It could be interesting to graph this relationship as it relates to age.
- Prompt: "Analyze the relationship between happiness, alcohol consumption, and age using the dataset"
6. Analyzing survey data
We have tons of surveys that we use to collect info from our users. Code Interpreter is great at saving me time by answering specific questions, quickly
- Prompt: "Identify the most common tools or products used by the respondents in our surveys."
7. Basic charts
Thinking back to the happiness and alcohol consumption dataset, let’s make a graph of number of drinks per week, related to life expectancy.
- Prompt: "Generate a graph relating drinks per week with lifespan"
8. Heatmaps
I’ve had the pleasure of never having to generate a heatmap by hand, and it doesn’t look like I’ll ever have to. Code Interpreter can do it for me.
- Prompt: "Create a heatmap using this CSV file of San Francisco crime data."
9. Language analysis
This one is really fun. We can use the Code Interpreter to analyze text data for specific linguistic patterns. For example, we can upload novels by a particular author and use natural language processing techniques to identify common themes, stylistic patterns, or the evolution of the author's writing style over time.
- Prompt: "Analyze this collection of novels by Hemingway and identify common themes and stylistic patterns."
10. Fitness data visualization
I’m a fitness data nerd, so this one is my personal favorite. We can upload fitness data from whatever source available and use the Code Interpreter to visualize fitness trends over time, identify patterns, and even make predictions.
- Prompt: "Visualize my fitness data from this CSV file, such as heart rate, step count, and sleep patterns, and identify any trends or patterns."
If you don’t have datasets on hand you can grab some from Kaggle, for free.
Conclusion
The Code Interpreter is extremely powerful. I’ve found it most useful when analyzing large datasets, but the use-cases go beyond that.
If you're struggling with getting good outputs from your prompts, or just want some premade prompts templates, feel free to join our waitlist below!