Speed Up Your Process Using the Workspace AI Assistant
Discover the power of our AI Assistant. Get started with exciting prompts that will supercharge your data workflow!
The sample dataset we'll use here consists of orders made with a UK-based online retailer from December 2010 to December 2011. Source of dataset.
Get started with AI, follow these steps:
- Hover on the space in between cells and add a new cell by clicking the "plus" icon or the line.
- Type in your first prompt.
- Click on "Ask AI" or press the return key.
1. Automatically Handle All Your Package Imports
Try this prompt:
Import the packages I will need to perform a machine learning classification task.
# Import the necessary packages
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
# Other packages
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
2. Build Beautiful Visualizations
Try this Prompt:
Create a Plotly plot of monthly sales in 2011 based on online_retail.csv.
# Import necessary libraries
import pandas as pd
import plotly.express as px
# Read the data
data = pd.read_csv('online_retail.csv')
# Convert InvoiceDate column to datetime
data['InvoiceDate'] = pd.to_datetime(data['InvoiceDate'])
# Filter data for 2011
data_2011 = data[data['InvoiceDate'].dt.year == 2011]
# Group data by month and calculate total sales
monthly_sales = data_2011.groupby(data_2011['InvoiceDate'].dt.month)['Quantity'].sum().reset_index()
# Create plot
fig = px.bar(monthly_sales, x='InvoiceDate', y='Quantity', title='Monthly Sales in 2011')
# Show plot
fig.show()
3. Speed Up Your SQL
First create a SQL cell and select the "employees" sample database source.
To the question "which countries do our customers purchase from?" using a SQL query, try this prompt:
Write a SQL query that lists the top 3 countries from which customers make purchases and run it against "online_retail.csv".
SELECT Country, COUNT(DISTINCT CustomerID) AS NumCustomers
FROM data_2011
GROUP BY Country
ORDER BY NumCustomers DESC
LIMIT 3;
SELECT Country, COUNT(DISTINCT CustomerID) AS NumCustomers
FROM data_2011
GROUP BY Country
ORDER BY NumCustomers DESC
LIMIT 3;
4. Write a Summary
Try this prompt:
Write a summary of the analysis in this workspace.
Summary of Analysis
In this workspace, we have performed analysis on the data_2011
dataset. The dataset contains information about invoices, stock codes, descriptions, quantities, invoice dates, unit prices, customer IDs, and countries.
We have executed SQL queries to answer questions such as:
- Which countries do our customers purchase from?
- What are the top 3 countries from which customers make purchases?
Additionally, we have defined three dataframes: data_2011
, monthly_sales
, and data
.
The analysis in this workspace provides insights into customer purchasing behavior and helps in understanding the sales trends.
5. Format Your Code
Directly below the code cell that follows, try this prompt:
Update the cell above to follow PEP 8 standards.
result=5+5;print(result)
Looking for more prompts to try? The following tutorial has more: 10 Ways to Speed Up Your Analysis With the Workspace AI Assistant