Skip to content
Experiment with the AI assistant
Experiment with the AI assistant
Generative AI is coming to DataCamp Workspace! Go through this notebook to experience the AI-enabled functionality. In this example project, we'll be querying a database with unicorn company data to build a chart showing the countries with the highest amount in total funding.
Get the data
The first step is getting data. Rather than using SQL, we'll ask the AI assistant to generate the code for us!
- Click on the SQL cell below and select "Unicorn Companies" in the dropdown in the cell header.
- In the cell menu on the right-hand side, click on "Generate".
- In the input field that appears, type "Get a list of companies (name, country, and funding)".
- Hit Enter and see the code streaming in!
- Accept the suggestion and run the SQL cell.
DataFrameas
df
variable
SELECT country, AVG(life_expectancy) AS avg_life_expectancy
FROM life_expectancy_table
GROUP BY country
ORDER BY avg_life_expectancy DESC;
-- This query selects the average life expectancy for each country and orders the results by the highest average life expectancy. You can use this data to create a bar chart in your preferred visualization tool.Visualize the data
To visualize the DataFrame we got back in the previous step, let's ask the AI once more!
- Click in the Python cell below and click on "Generate" in the cell menu on the right-hand side.
- In the input field that appears, type "Plotly bar chart with top 10 countries by total funding".
- Hit Enter and see the code streaming in!
- Accept the suggestion and run the code cell.
May the AI force be with you! 🤖