Feb 26 2025 · Piotr Płoński

Use ChatGPT inside Jupyter Notebook with MLJAR Studio

Use ChatGPT in Jupyter notebookIn this article, we'll show you how to use MLJAR Studio—a free desktop app that gives you a JupyterLab with custom extensions designed to simplify user experience. One of extensions is AI Assistant powered by OpenAI's ChatGPT. This built-in assistant can help you with data analysis, code generation, and even fixing errors. You don't have to write any code if you don't want to, but you can edit everything in the code. If you would like to learn more about MLJAR Studio extensions, please check it on GitHub. Yes, MLJAR Studio is an open-source application.

Setup AI assistant

Please download MLJAR Studio and install it locally on your machine. Create your first notebook, I've called mine analysis.ipynb. Your application should look like below:

create empty notebook

Please open AI Assistant by clicking chat icon in the left panel. At the first run, you will need to login, with the same credentials that you created during app download.

setup chatgpt in jupyter notebook

That's all, you AI Assistant is configured. You don't need to provide any API keys or install additional packages. It is ready to help you 😊

Are you wondering, why do you need to login in the desktop app? The app is using OpenAI ChatGPT that is running through our server, which is in the cloud. Your credentials are used to log into our server. We provide 20 free prompts monthly for every user! If you would like to use more prompts, then you need to have paid plan, you can check pricing details on our website. We provide discounts for students and academic researchers, just let us know 🤓

Download example dataset

In this article, I'm using World Happiness Report from year 2024. You can download it from my GitHub. Just click the download button in the top bar. I've saved the dataset file in the same folder as notebook file.

download dataset

Load CSV file with ChatGPT

Dataset is ready, let's read it in Python. I simply write in the Chat panel the prompt:

load data from WHR_2024.csv

In response I got python code. Please be aware that ChatGPT can't execute code autonomously. It will provide code which you can use in the notebook. You can insert it to the notebook and execute with one click on green button. Data is load to Pandas DataFrame and first rows are displayed.

load csv data with chatgpt to python

Advanced Data Analysis with ChatGPT

We can ask questions about our data. ChatGPT will provide code that can be used to provide answer. I've asked:

what are top 10 happy countries?

and got Python code in response, which sorted DataFrame and showed result:

# Sort the DataFrame based on the happiness score in descending order
top_10_happy_countries = whr_data.sort_values(by='happiness_score', ascending=False).head(10)

# Extract the names of the top 10 happy countries
top_10_happy_countries[['country', 'happiness_score']]

create analysis with chatgpt in Jupyter

We can ask ChatGPT to compute any statistics about our data.

Create plots with ChatGPT

A picture is worth a thousand words. We can create charts with ChatGPT too! I've asked in the Chat panel:

plot top 10 happy countires as bar chart

and got matplotlib code to plot a bar chart:

create plot with chatgpt in Jupyter

What if we would like to have more advanced plot. Let's ask for choroplet map showing happines for all countries.

plot happiness using choropleth map

We get the world map showing all countries, using plotly package.

create choroplet map plot with chatgpt in Jupyter

The map is interactive. We can zoom in and out, move maps, and check happiness scores nationwide.

interactive map plot

Reuse code

The code created during analysis is available as Python notebook. You can re-run the code at any time you want. It is on your machine. You don't need to use ChatGPT if you only want to re-execute code.

notebook code created with chatgpt in Jupyter

The data file and notebook file in the local folder.

folder with notebook and data file

Fix errors

Sometimes, you might get an error when running a code cell. In such situation, Fix with AI button will be displayed. Just click it to get help from AI Assistant.

fix errors in notebook with chatgpt

Summary

MLJAR Studio is a free desktop app that gives you a full JupyterLab environment with custom extensions. One of them is AI Assistant powered by ChatGPT that helps with data analysis, code generation, and error fixing. You can work without writing any code by hand, or you can customize everything by editing the code. The app makes it easy to load datasets, and start working with them in Python. ChatGPT provides code, but it needs to be manually accepted for Python execution. All the code generated is saved in a Python notebook on your computer, so you can run it any time.

Become a Data Science wizard, today!

Forget about Python problems, just do your work.

MLJAR Studio