Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Introduction to pandas Exploring pandas Combining DataFrames

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

cannot import utils render module

Trying to follow along with this note and my editor keeps telling me there's an error and cannot find the Python Utils render module.

I'm probably doing this the wrong way but I like to follow along with the code in VS Code and can't find the error on google. Help! :-)

from utils import render
$ python dataframes-combine.py
Traceback (most recent call last):
  File "dataframes-combine.py", line 7, in <module>
    from utils import render
ImportError: cannot import name 'render'

2 Answers

Michael Hulet
Michael Hulet
47,912 Points

This looks like it's a file that Treehouse made that automatically loads from their GitHub repository in Binder. You can find the file itself here and the repository it's in on GitHub

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Thanks Michael, so it's not an official Python module as I was previously thinking? No wonder I was only finding brick walls. :)

Michael Hulet
Michael Hulet
47,912 Points

Nope, this is a Treehouse-specific thing, in this case, hence why Google wasn't being nearly as helpful as usual 😅

after i downloaded the file how where should i save it on my mac so my jupyter notebook can recognize it?

Not to put too fine a point on it, but if you aren't using Binder there is no need to include that import. So for example, I'm following along in a Jupyter Notebook and it handles the rendering natively. You might also find fun extensions for VS Code that will implement that notebook-style interactivity.

It's an old post here but I am currently taking the Pandas course and also bumped into the same error. Barry's suggestion works as I, as well, follow along in a Jupyter Notebook (I have Anaconda installed on my computer).

In the code at Github there were these lines:

for label, value in balances.items():
    render("The label {} has a value of {}".format(label, value))

So here, I just substituted 'render' with 'print' and everything worked.