ncrease productivity with BARD by leveraging Python for data visualizations. Tap into BARD’s coding capabilities to create insightful and compelling visual representations of data, optimizing your data exploration and analysis processes.
Photo Mojahid Mottakin by on Unsplash
ChatGPT used to be widely acclaimed for its data visualization capabilities. However, there was a significant update in May or June that restricted direct access to the internet.
Previously, ChatGPT was the go-to tool for effortless data visualization. Even with the added features of ChatGPT Plus and its data visualization plugins, a strong grasp of Python or SQL remained crucial to maximize the potential of visualizing data effectively.
As of now, users are finding “Currently I Feed Bard” to be an excellent alternative for online searches, especially since ChatGPT’s functionality appears to have been limited after the update.
One of my go-to websites is data-is-plural.com. Data Is Plural offers a weekly newsletter featuring fascinating and captivating datasets.
Having convenient access to BARD raises an important question for me: How can I enhance my productivity by harnessing its coding capabilities to create data visualizations for these intriguing datasets?
Good Prompting
[April 2023]
Now ChatGPT’s official line is “I can’t access websites on the Internet” — but it can — it just depends on how you ask the questions.
My first attempt:
For the website data-is-plural.com can you give me a list of datasets that are available
ChatGPT’s response:
As an AI language model, I do not have real-time access to data-is-plural.com to provide you with an up-to-date list of available datasets. However, I can suggest some ways to access this information.
OK, not what I was looking for.
My second attempt:
What are 10 interesting datasets from data-is-plural.com?
ChatGPT’s Response:
While I can’t provide you with the most recent datasets from Data Is Plural, here are 10 interesting datasets that have been featured on the website in the past:
1. Global Terrorism Database: A database containing information on over 200,000 terrorist events between 1970 and 2019. URL: https://www.start.umd.edu/gtd/
2. Illegal Cheetah Trade: Global Dataset for seized and non-intercepted illegal cheetah trade URL: https://data.mendeley.com/datasets/84k92j4n3y
[...]
Since the May 2023 update you will get ChatGPT’s Response:
As mentioned earlier, I don't have direct access to external websites like data-is-plural.com, and my knowledge is limited to information up until September 2021. Therefore, I can't provide you with a list of datasets from that specific website.
[...]
Therefore, I opted to utilize BARD, and interestingly, the responses I received were quite similar to what ChatGPT provided before the update. To access real-time data, it is recommended to utilize BARD, as Microsoft and OpenAI currently restrict direct internet access as they did in the past.
It worked! Looking at the datasets, I would like to focus on what everyone is interested in these days — the illegal cheetah trade. Using the URL provided by data-is-plural.com, I can ask BARD about this data:
My request:
Can you provide some details on the dataset https://data.mendeley.com/datasets/84k92j4n3y
Bard’s Response:
Sure. The dataset you linked to is a global dataset for seized and non-intercepted illegal cheetah trade (Acinonyx jubatus) 2010-2019. It was created by the Cheetah Conservation Fund and the University of Oxford, and it is the most extensive dataset of its kind.
[...]
My request:
Using this dataset what analysis would you suggest to provide 5 different data visualizations on cheetah distribution patterns?
Bard’s Response:
Sure, here are 5 different data visualizations that you can create using the dataset to analyze cheetah distribution patterns:
- Heatmap: A heatmap is a great way to visualize the density of cheetah observations. You can create a global heatmap to see where cheetahs are most concentrated, or you can create heatmaps for specific regions or countries.
- Choropleth map: A choropleth map is another way to visualize the distribution of cheetah observations. This type of map divides the map into different regions and color-codes each region based on the number of cheetah observations in that region.
- Time series line chart: A time series line chart can be used to track trends in cheetah sightings over time. This type of chart would show the number of cheetah observations per year, or it could show the number of cheetah observations per month.
- Bar chart: A bar chart can be used to compare the number of cheetah observations in different countries or regions. This type of chart would show the number of cheetah observations for each country or region, and it could also show the percentage of total cheetah observations that occurred in each country or region.
As evident, one must exercise caution when dealing with data or images provided by AI since they may not always be accurate or reliable.
To generate these visualizations, an array of data visualization tools and libraries can be utilized, including Tableau, R, Python (with libraries like Matplotlib, Seaborn, Plotly, or Folium), or JavaScript (with libraries like D3.js or Leaflet.js).
Fantastic! A bar chart showcasing the top countries sounds like an excellent way to begin. BARD’s helpful suggestions for visualizing the data in Python will come in handy! Now, let’s dive into the details and get started.
Using this dataset, and using Python and the dash library, please write the code to create a bar chart data visualization displaying the top countries with the highest number of cheetah observations.
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.express as px
# Load dataset
df = pd.read_csv("cheetah_observations.csv")
# Group dataset by country and count the number of observations
country_counts = df["Country"].value_counts().reset_index()
country_counts.columns = ["Country", "Observations"]
# Select the top 10 countries with the highest number of observations
top_10_countries = country_counts.nlargest(10, "Observations")
# Sort the top 10 countries in descending order of observations
top_10_countries_sorted = top_10_countries.sort_values(by="Observations", ascending=True)
# Create a horizontal bar chart using Plotly Express
fig = px.bar(top_10_countries_sorted, x="Observations", y="Country", orientation="h", title="Countries With the Highest Cheetah Observations")
# Initialize the Dash app
app = dash.Dash(__name__)
# Define the layout of the app
app.layout = html.Div([
dcc.Graph(id="cheetah_bar_chart", figure=fig)
])
# Run the Dash app
if __name__ == "__main__":
app.run_server(debug=True)
Default Bar Chart — Countries With Cheetah Observations
The chart partially addresses the issue at hand, but there’s room for improvement. We could refine it by seeking additional information from BARD, but that’s a discussion for another occasion. Well done!
Interestingly, there’s a significant number of cheetahs in the Middle East. It’s surprising since one wouldn’t expect cheetahs to “migrate” to that region. It’s not what I initially guessed regarding the places with the highest cheetah sightings!