Step 1: Load the dataset
We get quite a wordy response from Copilot, so let’s break down the response into parts and explain what we get.
You should receive a response similar to the response below:
[Prompt response]
Sure, let’s start with step 1: loading the dataset.
# Step 1: Load the Dataset
import pandas as pd
# Define the file path
file_path = '/path/to/your/file.csv' # replace with your file path
# Load the dataset
df = pd.read_csv(file_path)
# Display the first few rows of the DataFrame
print(df.head())
Please replace '/path/to/your/file.csv'
with your actual filename or path to the file. Once you’ve done this, you can run the code to load your dataset.
Let me know once you’ve successfully loaded the data, and we can proceed to the next step.
[End of response]
Figure 17.2: Showing part of the Copilot prompt and the start of the Copilot result on loading data
Let’s try the output...