Supercharge Your Data Science Labs: A Complete Guide to Using Jupyter Notebooks in zyLabs

Avatar photo Dr. Pamela Fellers

Give your students the professional IDE experience they need while keeping the auto-grading features you love


📚 Why Jupyter Notebooks Are Game-Changers for CS Education

As computer science and data science instructors, we’re always looking for ways to bridge the gap between classroom learning and real-world practice. While zyBooks’ Coding Rooms IDE serves many programming courses well, Jupyter Notebooks offer something special for data science, machine learning, and research-focused curricula.

The beauty of Jupyter lies in its interactive, exploratory nature. Students can run individual code cells, see immediate output, embed rich markdown explanations, and visualize data—all within the same document. This mirrors exactly how data scientists work in industry, making it an invaluable educational tool.

The good news? You don’t have to choose between professional tools and pedagogical features. zyLabs can be seamlessly converted to run Jupyter Notebooks while preserving automatic grading, test cases, and other essential classroom management features.

📊 The Trade-offs: What You Gain and What You Should Know

Before diving into implementation, let’s be honest about the benefits and limitations:

What You Gain

  • Professional relevance: Students learn the IDE they’ll actually use in data science careers
  • Interactive exploration: Run individual cells, combine code with rich text explanations
  • Embedded visualizations: Plots and charts appear directly in the notebook
  • Collaborative learning: Pair programming capabilities for group projects
  • Maintained auto-grading: Your test cases and automatic assessment still work

What to Consider

  • Additional setup time: zyBooks Maintained Labs (ZMLs) become custom labs requiring conversion
  • History tracking limitations: Edit history shows raw JSON instead of clean diffs
  • Pair programming differences: Students don’t share real-time cursors (though work syncs automatically)

For most data science and machine learning courses, the benefits significantly outweigh these limitations.


📋 Step-by-Step Conversion Guide

Converting existing zyLabs to Jupyter Notebooks takes just four straightforward steps. Here’s your roadmap:


Step 1: Environment Setup

Start by cloning your existing lab, then navigate to the workspace settings in the Template tab. Select “Jupyter Notebook” as the IDE and reload the workspace.

Pro tip: If you’re creating a brand new lab, simply choose Jupyter Notebook during initial setup—no cloning needed.

Step 2: Template Creation

Add a new .ipynb file in the Template tab and give it a descriptive name. Copy your existing starter code from main.py into the notebook cells. Remember that Jupyter’s power comes from multiple cells, so consider breaking your template into logical sections—imports, data loading, analysis, and visualization.

Don’t forget to update the workspace settings to make your new .ipynb file the default, then delete the old main.py.

Step 3: Solution Step

You have two approaches here:

Option 1 (Preserve Original)

Switch the Model Solution tab to Jupyter Notebook IDE, create a matching .ipynb file, and transfer your solution code from main.py

Option 2 (Start fresh)

Use the “reset lab to template” which copies your template notebook, then modify it with the complete solution.

Choose Option 1 if you want to keep your original Python solution file as backup.

Step 4: Test Case Updates

This is where attention to detail matters. Your existing test cases need updates to work with notebook files:

For compare output tests: Verify the “File to run for output” points to your .ipynb file and regenerate expected outputs.

For unit tests: This requires more significant updates since notebook execution differs from Python file execution. You’ll need to modify how you load and execute student code, particularly for tests that check objects or perform string matching on student submissions.


🔧 Advanced Implementation: Unit Test Modifications

The most technical aspect of conversion involves updating unit tests. Here are the key patterns you’ll need:

Testing Student Objects

When your unit test needs to access objects created in student notebooks (like machine learning models), you’ll replace importlib with nbformat and modify your execution approach. Instead of loading a Python module, you’ll read the notebook, extract code cells, and execute them in a controlled namespace.

Code Analysis and String Matching

For tests that examine student code structure, you’ll need to extract code cells from the JSON notebook format rather than reading a plain-text Python file. This involves parsing the notebook’s JSON structure and combining code cells into a searchable string.

Best Practices for Success

Start small: Convert one lab first to get comfortable with the process before tackling your entire curriculum.

Test thoroughly: Run your converted test cases on the model solution multiple times to ensure reliability.

Leverage notebook features: Don’t just port Python code—enhance with markdown cells, inline visualizations, and logical cell divisions.

Prepare students: If this is their first Jupyter experience, consider a brief orientation lab covering notebook basics.

Plan for debugging: Students new to notebooks may struggle with cell execution order—build in safeguards and clear instructions.

🎯 The Bottom Line

Converting zyLabs to Jupyter Notebooks represents more than a technical upgrade—it’s an investment in your students’ professional readiness. While the initial setup requires some effort, you’re providing students with experience in the industry-standard environment for data science while maintaining the pedagogical benefits of automatic grading and structured assessments.

The result? Students who are better prepared for data science careers and more engaged with interactive, exploratory programming practices. In a field where hands-on experience with professional tools is crucial, this conversion bridges the gap between academic learning and industry practice.

Ready to get started? Clone your first lab and begin the four-step conversion process. Your students—and their future employers—will thank you.


Need help with your zyLabs conversion? The zyBooks support team can provide additional guidance for complex test case modifications and advanced Jupyter features.

Avatar photo
Author Bio

Dr. Pamela Fellers

Pamela Fellers is a statistics content developer at zyBooks. She earned her BS in Mathematics from Chadron State College and her MS and PhD in Statistics from the University of Nebraska at Lincoln. Before joining zyBooks in 2021, Pamela was an assistant professor at Grinnell College in Iowa.

or, go back to the blog.

More action with less text.

zyBooks strike the perfect balance between text volume and engaged learning, with studies showing that students spend more time learning. Performance has been proven to increase and we have research to show it.

Get A Demo
zyBooks textbooks increase student engagement