How to analyze and visualize data using ChatGPT

Ever since the advent of ChatGPT, data analysis and visualization have become immensely convenient and user-friendly by providing natural language interpretation and assistance in the whole data analysis process. Data analysis used to be a lot of manual work, and it was a mentally straining process to extract useful information and present it in an appealing form.

ChatGPT simplified data analysis and visualization in the following ways:

  1. Data exploration and interpretation: ChatGPT can help users analyze, comprehend, and explain the dataset’s structure, recognize potential patterns, identify outliers, and demonstrate statistical concepts.

  2. Data preprocessing and cleaning: ChatGPT can help in data preprocessing by proposing techniques to handle data, and it can also guide users in data transformation, ensuring that data is ready for analysis.

  3. Statistical analysis: ChatGPT can help provide descriptive and inferential statistics results, leading to ease in analysis. Users can then use that information for further analysis.

  4. Collaboration and communication: ChatGPT generates clear responses about the data insights that are easy to understand and can be shared with team members or stakeholders. Users can ask for any report type and explanation depending on the stakeholder.

  5. Quick problem-solving: ChatGPT can help troubleshoot data-related issues and reduce problem-solving time.

Generating a survey

Let’s use ChatGPT to generate a dataset to perform some data analysis and create visualizations. First, we must choose a topic we want to work on. Let’s choose “E-learning experience of users”. We asked ChatGPT to generate a survey questionnaire that can be used to create a dataset. The response can be viewed below.

The questionnaire consists of questions that can help us create a dataset to gauge the e-learning experience of users. The next step is to create a dataset by getting the questionnaire filled out by a few individuals. The following is an example of how the dataset might look like:

Sample responses to the survey

Age Range

25–34

18–24

45–54

55–64

Under 18

Gender

Female

Male

Non-binary

Female

Male

Highest Education

Bachelor’s degree

High school or equivalent

Doctoral degree

Master’s degree

High school or equivalent

E-Learning Duration

More than 3 years

Less than 6 months

2–3 years

1–2 years

Less than 6 months

No. of E-Learning Platforms

3

1

2

4

1

E-Learning Course Type

Professional development courses

Academic courses

Skill-based or vocational courses

Personal interest or hobby courses

Academic courses

Annual E-Learning Courses

5–6

1–2

3–4

1–2

1–2

Satisfaction with E-Learning

4

3

5

3

2

Technical Challenges

Yes

Yes

No

Yes

Yes

Now that we have a steady dataset, we can use it to move forward with data analysis. To understand our dataset better, we perform statistical analysis.

Statistical analysis

Statistical analysis is a type of data analysis that involves organizing and interpreting data to draw precise conclusions from the dataset. There are two methods to analyze data via statistical analysis–descriptive and inferential statistics–shown. Let’s explore them both.

Descriptive statistics

Descriptive analysis summarizes the dataset into a concise description of the dataset. It consists of many techniques, such as central tendency measures, percentages, dispersion measures, etc. Here, we will use ChatGPT to generate measures of central tendency for every variable of the dataset.

In the response above, you may notice that ChatGPT has chosen a random answer for variables that are tied.

Measures of central tendency can be calculated for all variables, but measures of dispersion can only be calculated for variables with numerical values. We will ask ChatGPT to generate them for us.

We can also generate percentages of different responses against all the given options for a variable in the questionnaire. Here, we will ask ChatGPT to show us the percentage of different responses against all the options provided for the question, “How many E-learning platforms or websites have you used?”.

Inferential statistics

Inferential statistics are used to draw conclusions about bigger datasets or populations by analyzing and driving results from smaller datasets. We can test a hypothesis, create confidence intervals, and perform regression analysis. Here, we will ask ChatGPT to generate an inferential statistics report for the questions in the survey and results.

Data visualization

We can also visualize data using ChatGPT prompts. For example, we can ask for Python code that can help us plot a chart against the dataset variables. Here, we will ask ChatGPT to show us the percentage of responses for the survey question regarding gender using a bar chart:

import matplotlib.pyplot as plt
# Create a bar chart
fig = plt.figure(figsize=(9, 8))
bars = plt.bar(genders, percentages)
for bar, percentage in zip(bars, percentages):
plt.text(bar.get_x() + bar.get_width() / 2 - 0.1, bar.get_height() + 1, f"{percentage:.2f}%", ha='center', color='black', fontsize=12)
plt.xlabel("Gender")
plt.ylabel("Percentage")
plt.title("Percentage of Responses by Gender")
plt.savefig('output/gender_chart.png')
plt.show()

We can also ask for a pie chart that shows us the percentage of e-learners using different numbers of platforms.

import matplotlib.pyplot as plt
# Create a pie chart
plt.figure(figsize=(8, 8))
plt.pie(percentages, labels=platforms, autopct='%1.1f%%', startangle=140, colors=['skyblue', 'lightgreen', 'lightcoral', 'lightsalmon'])
plt.title("Percentage of Responses by Number of E-learning Platforms Used")
# Display the chart
plt.savefig('output/platform_chart.png')
plt.show()

ChatGPT offers great flexibility with data visualization. The code generated was for Python but this can easily be done for multiple other languages. Similarly, ChatGPT can also use different libraries if instructed to do so. We can go above and beyond in analyzing a dataset and visualizing as many variables as we want using ChatGPT.

Unlock your potential: ChatGPT for everyday tasks, all in one place!

To continue your exploration of ChatGPT for everyday tasks, check out our series of Answers below:

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved