In this example we use VerbaGPT to analyze some climate data. We use publicly available data from IMF.
Video:
Coming soon…
We start by asking a simple data question.
User question: Give me the temperature change in USA for 2015.
VerbaGPT response: ![]()
Cost of query: $0.00
Temperature change in USA for 2015: 1.531
Nice, clean response from VerbaGPT – and accurate.
While this looks basic, it isn’t completely straightforward. The table is structured so that the temperature is actually across rows rather than in a column. That makes it slightly tricky as you now have to pivot the data to do interesting things with it.
Also, there are several options to select a specific country. There is a [Country] column, with the full country name spelled out. So if VerbaGPT selected that column and tried to extract data where [Country]=’USA’, it would fail – since for that column you need the full country name spelled out. But there is another column [ISO3] that has standardized country names, which would work more consistently across user queries.
In addition to producing the result above, VerbaGPT also provides the user with the following (editable) code. If the user chooses to, they can edit the code before hitting execute button, or simply hit execute without editing the code to produce the results shown above.
VerbaGPT Message Window
Here is a code snippet that you can use to get the temperature change in the USA for 2015:
usa_temp_change_2015 = df.loc[df['ISO3'] == 'USA', 'F2015'].values[0]
print(f'Temperature change in USA for 2015: {usa_temp_change_2015}')
Now let’s try another question, this time more complicated.
User question: Give me a plot temperature changes for USA, for 1975-latest year available in data.
A couple of things happening in this question. This has all the complexity we described above, plus 1) we are asking for a plot, and 2) we are not specific in our request (i.e., latest-year available).
VerbaGPT response: ![]()

Perfect! There are additional things going on under the hood in VerbaGPT. The x-axis labels are unreadable with so many data points. It adjusted the code so only certain markers are shown, so the plot can be read more easily.
But what if you don’t like something about the plot? For example – you may want to substitute “2022” for “latest year available” in the plot headline. VerbaGPT provides the code in an editable window that you can adjust and re-run. This is tremendously helpful. I code in python all the time, but I would still need help to write the exact code needed to generate the plot. VerbaGPT gets me 80% of the way quickly, and then I can make easy edits and re-run the code. This is a super easy way for a non-coder to a) get familiar with coding in a beginner-friendly language like python, and b) get a query template that you can make easy adjustments to – like labels.
VerbaGPT Message Window
Here is a code snippet that should help you plot the temperature changes for the USA from 1975 to the latest year available in your data:
import matplotlib.pyplot as plt
# Select data for USA
usa_data = df[df['ISO3'] == 'USA']
# Get the column names for the years 1975 to the latest year available in data
year_cols = [col for col in usa_data.columns if col.startswith('F') and int(col[1:]) >= 1975]
# Get the temperature change data for USA
temp_change = usa_data[year_cols].values[0]
# Plot the data
plt.plot(range(1975, 1975 + len(year_cols)), temp_change)
plt.xticks(rotation=90)
plt.xlabel('Year')
plt.ylabel('Temperature Change')
plt.title('Temperature Change for USA (1975 - latest year available)') #This is where you can substitute 2022 for "latest year available"
plt.show()
Now let’s crank up the complexity some more. As Nigel in Spinal Tap would say, “take it to 11”.
User question: Give me a plot temperature changes for China, for years 1980-2022. Overlay a scatter plot for frequency of disasters for the same years. Use a different y-axis scale for the second plot.
A lot of things going on here. First we, combined the disasters dataset below the temperature one, so VerbaGPT needs to pick out the correct series to plot. Then we are asking for two types of plots, and not only that, asking to overlay them. Heck, I don’t know how to code this – would take me several minutes googling to try and figure it out.
VerbaGPT response: ![]()

Great! We have the plot that we wanted. Not easy for an GPT4 to figure this out without accessing any data, except for the column names passed along by VerbaGPT. But it pulls it off.
VerbaGPT Message Window
Here is a code snippet for a plot you are looking for:
import matplotlib.pyplot as plt
# Filter data for China
df_china = df[(df['ISO3'] == 'CHN')]
# Filter data for Temperature and Disasters
temp_data = df_china[df_china['Indicator'] == 'Temperature']
disaster_data = df_china[df_china['Indicator'] == 'Disasters']
# Create x-axis labels
x_labels = [f'F{year}' for year in range(1980, 2023)]
# Plot temperature data
plt.plot(x_labels, temp_data[x_labels].values[0], label='Temperature')
# Plot disaster data on secondary y-axis
ax2 = plt.twinx()
ax2.scatter(x_labels, disaster_data[x_labels].values[0], color='red', label='Disasters')
# Set x-axis tick labels
plt.xticks(x_labels[::5], rotation=90)
# Add legend
plt.legend()
ax2.legend(loc='upper right')
# Show plot
plt.show()

Leave a Reply