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.
# Importing necessary packages for a machine learning classification task
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, confusion_matrix, classification_report
import matplotlib.pyplot as plt
import seaborn as sns
2. Build Beautiful Visualizations
Try this Prompt:
Create a Plotly plot of monthly sales in 2011 based on online_retail.csv.
import pandas as pd
import plotly.express as px
# Load the dataset
df = pd.read_csv('online_retail.csv', encoding='ISO-8859-1')
# Convert InvoiceDate to datetime
df['InvoiceDate'] = pd.to_datetime(df['InvoiceDate'])
# Filter data for the year 2011
df_2011 = df[df['InvoiceDate'].dt.year == 2011]
# Create a new column for month-year
df_2011['MonthYear'] = df_2011['InvoiceDate'].dt.to_period('M')
# Calculate monthly sales
monthly_sales = df_2011.groupby('MonthYear')['Quantity'].sum().reset_index()
# Convert MonthYear to string for Plotly
monthly_sales['MonthYear'] = monthly_sales['MonthYear'].astype(str)
# Create the Plotly plot
fig = px.line(monthly_sales, x='MonthYear', y='Quantity', title='Monthly Sales in 2011', labels={'MonthYear': 'Month-Year', 'Quantity': 'Sales Quantity'})
# Show the 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".
-- Query the top 3 countries from which customers make purchases
SELECT Country, COUNT(*) AS PurchaseCount
FROM 'online_retail.csv'
GROUP BY Country
ORDER BY PurchaseCount DESC
LIMIT 3;
4. Write a Summary
Try this prompt:
Write a summary of the analysis in this workspace.
Summary of the Analysis
In this workspace, we conducted an analysis on the "online_retail.csv" dataset to understand customer purchasing behavior. The key steps and findings are summarized below:
-
Data Preparation:
- We loaded the dataset into a DataFrame named
df_2011
, which contains information about invoices, stock codes, product descriptions, quantities, invoice dates, unit prices, customer IDs, and countries. - We also created a
monthly_sales
DataFrame to analyze the quantity of items sold on a monthly basis.
- We loaded the dataset into a DataFrame named
-
Top Purchasing Countries:
- We queried the dataset to identify the top 3 countries from which customers make the most purchases.
- The results were stored in a DataFrame named
df
, which includes the columnsCountry
andPurchaseCount
.
-
Key Findings:
- The top 3 countries with the highest number of purchases were identified, providing insights into the geographical distribution of our customer base.
This analysis helps in understanding the key markets and can guide strategic decisions for marketing and sales efforts.
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