Written by Ivana Kotorchevikj We Tested
OpenAI has been providing us with numerous updates lately. One of their most recent and thrilling announcements is the launch of their Code Interpreter plugin.
The Code Interpreter plugin was initially introduced in Alpha mode a few months ago. However, OpenAI took a step further last week by releasing it in Beta mode exclusively for ChatGPT Plus subscribers. This plugin expands the capabilities of ChatGPT and provides users with essential options they have been longing for.
With the plugin, users can effortlessly tackle mathematical problems, analyze data, generate charts, and convert files into various formats, among other functionalities.
OpenAI made the official announcement about the Code Interpreter release on their Twitter profile:
https://twitter.com/OpenAI/status/1677015057316872192
In this post, we’ll dive into how to enable the ChatGPT Code Interpreter and show you how to use it to interpret code, analyze data, and upload datasets. We’ll also ask the Code Interpreter to do some interpretations and predictions and analyse the results.
❗Important: OpenAI has renamed the Code Interpreter feature into Advanced Data Analysis, and added more functionalities to it. They also removed several features, so these are a few things to be aware of for the Advanced Data Analysis feature in ChatGPT:
Apart from these considerations, the main purpose of the enhanced environment is to offer more tools and flexibility in data analysis.
Keep in mind that to be able to use ChatGPT Code Interpreter, you must have the Plus subscription, which will cost you $20 a month.
If you have the subscription, you can start using the ChatGPT Code Interpreter with the following steps:
We asked ChatGPT itself to explain what the ChatGPT Code Interpreter is and what it can do:
“The new code interpreter in this environment is designed to execute Python code securely. Here's what it can do:
However, please note the following limitations:
Python is a programming language. It can be used for a lot of things, but in this context, it is good to know that it is the most popular language for data analysis and is used in a lot of science education institutions and universities.
Under the hood, ChatGPT Code Interpreter also uses Pandas. Pandas is an open-source data analysis and manipulation library for Python. You can analyze large datasets and generate charts from them. With the Code Interpreter, you can also analyze data, ask ChatGPT what the data is about, and even run your Python code.
Here's a simple example of using Pandas:
Now, let's try out the interpreter with an example dataset.
There are many websites you can use to find a dataset. For the sake of the text, we used a Seattle weather dataset from Kaggle.
You can also upload a dataset file to ChatGPT to analyze it with the Code Interpreter. Here’s how to do it:
For this experiment, we asked to explain what the file was about, and ChatGPT gave a simple summary of the columns in the CSV file and asked if we wanted to know anything specific.
👉 Bonus read: How to Use DAN ChatGPT And Does It Really Work?
Further, we asked ChatPT if it could notice any trends in the data. As a response, ChatGPT provided a nice set of charts generated with another widely used Python package matplotlib, and a summary of its interpretation:
On top of the response, you can see a little button saying, ‘Show work.’ Once you click on it, you can see the Python code that is used to generate the charts:
Next, we asked ChatGPT if there were any noticeable yearly trends.
Once the processing was done, ChatGPT provided a new set of charts and a summary of the results.
Additionally, ChatGPT Code Interpreter gave the following assessments:
“Average Yearly Precipitation: The average yearly precipitation shows some variation, but there doesn't appear to be a clear upward or downward trend.
Average Yearly Maximum Temperature: There is some fluctuation in the yearly maximum temperature. However, without a longer time series, it's difficult to discern a clear trend.
Average Yearly Minimum Temperature: Similar to the maximum temperature, the minimum temperature also shows some variation from year to year.
Average Yearly Wind Speed: The average yearly wind speed appears relatively stable over the years.”
The assessment is a bit disappointing. The charts above show a clear increase in the Average Yearly Maximum Temperature and Average Yearly Minimum Temperature, but ChatGPT doesn’t mention that in the assessment.
Therefore, we asked ChatGPT to give a more specific answer about the results:
“What can you explain about the changes in temperature?”
Surprisingly, ChatGPT answers that there is no notable change in temperature, while the charts clearly show us something different.
This time, we asked ChatGPT directly for an explanation:
“You say there is no clear upward or download trend in the temperature, but to me, it looks like there is a clear upwards trend in the minimum and maximum temperature?”
Finally, we get a different result!
Code Interpreter now generates a new visualization and corrects its mistake:
“The linear regression analysis provides some interesting insights:
- Maximum Temperature: The slope of the regression line for the maximum temperature is approximately 0.74. This suggests that, on average, the maximum temperature has been increasing by about 0.74 degrees Celsius per year. The p-value is approximately 0.009, which is less than 0.05, indicating that this upward trend is statistically significant.
- Minimum Temperature: The slope of the regression line for the minimum temperature is approximately 0.51. This suggests that, on average, the minimum temperature has been increasing by about 0.51 degrees Celsius per year. The p-value is approximately 0.042, which is less than 0.05, indicating that this upward trend is also statistically significant.
These results indicate that there has been a statistically significant upward trend in both the maximum and minimum temperatures over the years covered by this dataset. I apologize for the earlier confusion, and I appreciate your patience and keen observation. Is there anything else you would like to explore in this data?”
🚀 📊 Learn how to integrate and use ChatGPT in Excel.
While the ChatGPT code interpreter looks promising, it has some work to do. As is seen in our first try, the analysis was far from correct and proved that you should always draw your own conclusions. Only after pointing the ChatGPT Code interpreter to its clear mistake was it possible to draw a tight conclusion. We do like the apology we got with it 🙂.
The article is written by Martijn van Nieuwenhoven, Owner of The Code Connectors, and edited by Ivana Kotorchevikj, Content Writer at the Code Connectors - Neural Network Press.