ROBV101_PNote Activities
ROBV101_PNote Activities
I'll
update the PNote activities to incorporate the suggestions, and I'll explicitly structure each
activity with a "Sample Code" section followed by an "Exercise" section to promote active
learning. I'll also address the overall questions raised by DSSME.
1. Data File Management: CSV files will be uploaded to Moodle alongside the
corresponding PNote notebook for each module. Instructions within the notebook will
clearly state to download the CSV file to the same directory as the notebook.
2. Error Handling: I'll add more explicit error handling and troubleshooting tips within
the PNote notebooks, particularly for common errors like FileNotFoundError. I'll also
include a link to a general "Troubleshooting PNote" document in Module 0.
3. PNote/Jupyter Familiarity: Module 0 will include a very brief introduction to the
Jupyter Notebook interface: running cells, adding Markdown and code cells, saving
notebooks. This will be a short video and a "cheat sheet" document.
4. Library Installation: We will use Google Colab for this course. This eliminates the
need for local installations and ensures a consistent environment for all students. The
"Welcome" video in Module 0 will explain how to access and use Google Colab.
5. Complexity Progression: The sequence of activities from module 1 to 5 already
provided the complexity progression. And I ensured each module PNote activity has
sample code and follow by an Exercise.
# We've added some *projected* future milestones to a new CSV file: 'robotics_future.csv'.
# 1. Load the 'robotics_future.csv' data into a new DataFrame called 'future_df'.
# 2. Combine the 'milestones_df' and 'future_df' into a single DataFrame called
'combined_df'.
# (Hint: Use pd.concat([df1, df2]))
# 3. Create a *new* interactive timeline using 'combined_df'. Make sure to include hover
data!
# 4. Add Markdown cells below to reflect on the *combined* timeline, including predictions.
#create timeline
fig = px.timeline(combined_df, x_start="Year", x_end="Year", y="Milestone",
color="Milestone",
hover_data=["Description"])
fig.update_yaxes(autorange="reversed")
fig.update_layout(title="Interactive Timeline of Robotics Milestones and future")
fig.show()
# **Troubleshooting:**
# * If you get a 'FileNotFoundError', make sure the CSV files are in the same directory as
this notebook.
# * If you have trouble with 'pd.concat()', search online for "pandas concatenate dataframes".
Module 2: Types of Robots - Robot Type Distribution (with Pie Chart and Filtering)
# Import libraries
import pandas as pd
import matplotlib.pyplot as plt
# Load the data
robots_df = pd.read_csv("robot_types.csv")
# 1. Choose *one* industry from the 'Industry' column (e.g., "Healthcare", "Manufacturing",
"Logistics").
# 2. Filter the 'robots_df' DataFrame to create a *new* DataFrame containing only robots
from that industry.
# (Hint: Use something like `healthcare_robots = robots_df[robots_df['Industry'] ==
'Healthcare']`)
# 3. Create a *bar chart* showing the distribution of robot *types* within your chosen
industry.
# 4. Create a *pie chart* showing the distribution of robot *types* within your chosen
industry.
# 5. Add Markdown cells below to reflect on the differences between the overall distribution
and the industry-specific distribution.
# Create a *pie chart* showing the distribution of robot *types* within your chosen industry.
plt.figure(figsize=(8, 8))
type_counts.plot(kind='pie', autopct='%1.1f%%') # Show percentages
plt.title("Distribution of Robot Types in Logistics(Pie Chart)")
plt.ylabel("") # Hide the default y-axis label ("Type")
plt.show()
IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END
Module 3: Basic Robotics Components - Sensor Data Analysis (with Outlier Handling)
# Import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.figure(figsize=(8, 5))
plt.hist(ultrasonic_data['Value'], bins=10, edgecolor='black')
plt.xlabel("Distance (cm)")
plt.ylabel("Frequency")
plt.title("Distribution of Ultrasonic Sensor Readings")
plt.show()
# --- Explanation of Statistics ---
# * **Mean:** The average value.
# * **Median:** The middle value when the data is sorted. Less sensitive to outliers than the
mean.
# * **Standard Deviation:** A measure of how spread out the data is. A larger standard
deviation means the data is more variable.
# 1. Choose a *different* sensor type from the 'SensorType' column (e.g., "Light",
"Temperature").
# 2. Filter the 'sensor_df' DataFrame to create a new DataFrame for your chosen sensor.
# 3. Calculate the mean, median, and standard deviation of the 'Value' column for your
chosen sensor.
# 4. Create a histogram of the 'Value' column for your chosen sensor.
# 5. Add Markdown cells below to reflect on your findings. How do the statistics and
distribution compare to the ultrasonic sensor?
#print
print(f"Mean temperature: {mean_temp:.2f} C")
print(f"Median temperature: {median_temp:.2f} C")
print(f"Standard deviation: {std_dev_temp:.2f} C")
#histogram
plt.figure(figsize=(8, 5))
plt.hist(temp_data['Value'], bins=10, edgecolor='black')
plt.xlabel("Temperature (C)")
plt.ylabel("Frequency")
plt.title("Distribution of Temperature Sensor Readings")
plt.show()
# --- Markdown Reflections for Exercise 1 Here ---
# 1. Look at the histograms you created. Do you see any data points that seem unusually
far away from the others (outliers)?
# 2. If you find any outliers, try to explain *why* they might have occurred (e.g., a sensor
malfunction, a temporary obstruction).
# 3. Explain *how* you might handle these outliers if you were using this data to control a
robot (e.g., ignore them, replace them with the mean/median, take more readings).
# --- Your Code for Exercise 2 Here ---
# No code, just reflection
IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END
# Turtle Code:
robot.forward(100)
robot.right(90)
robot.forward(100)
robot.right(90)
robot.forward(100)
robot.right(90)
robot.forward(100)
robot.right(90)
# 1. Write pseudocode to make the robot draw a *rectangle* that is 15 units long and 5 units
wide.
# 2. Translate your pseudocode into Turtle commands and run the code.
# 3. Add Markdown cells below to reflect on any differences between your pseudocode and
the Turtle code.
#Turtle Code
robot.forward(150)
robot.right(90)
robot.forward(50)
robot.right(90)
robot.forward(150)
robot.right(90)
robot.forward(50)
robot.right(90)
IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END
# Import libraries
import pandas as pd
import matplotlib.pyplot as plt
# 1. Create a *new* bar chart showing the *average salary* for each job title.
# 2. Add Markdown cells below to answer: Which job title has the highest average salary?
Is it the same as the job title with the highest growth rate?
# 1. Choose *one* job title from the 'JobTitle' column that interests you.
# 2. Use online resources (e.g., career websites, government labor statistics) to research
this job title in more detail.
# 3. Add Markdown cells below to summarize:
# * Typical tasks and responsibilities.
# * Required education and skills.
# * Why this job interests you.
IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END
(The structure of Module 6's PNote activity remains largely the same, but I'll add the
requested elements.)
# **3. Code**
# * ... (same as before) ...
IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END
I've created a much more robust and interactive set of PNote activities. Each activity now
includes a worked example and at least one exercise for students to apply their learning.
The suggestions from DSSME have been incorporated, and the activities are well-scaffolded
for beginners. The use of Google Colab simplifies the technical setup. This revised structure
provides a solid foundation for data science integration within the ROBV101 course.