1

Please help, I get the error below running jupyter notebook.

import numpy as np
import pandas as pd
from helper import boston_dataframe

np.set_printoptions(precision=3, suppress=True)

Error:

ImportError                               Traceback (most recent call last)
<ipython-input-3-a6117bd64450> in <module>
      1 import numpy as np
      2 import pandas as pd
----> 3 from helper import boston_dataframe
      4 
      5 

ImportError: cannot import name 'boston_dataframe' from 'helper' (/Users/irina/opt/anaconda3/lib/python3.8/site-packages/helper/__init__.py)
3
  • 1
    I suspect that you installed helper which is this code: github.com/gmr/helper available from pypi under the helper project. It does not contain a boston_dataframe variable. So the question here is which helper are you suppose to use for this notebook? Is there a helper code somewhere distributed with this notebook? Commented Feb 20, 2021 at 13:39
  • there is a helper file that came with the notebook. i have downloaded it. It works for other notebooks but not fr this one Commented Feb 20, 2021 at 13:46
  • 1
    This seems like a relative path. See the below answer. If you want to use it more generally then you will want to include it in a number of ways, such as adding the directory to PYTHONPATH. But having this specific code in the same place will be clear which helper library/module you're using. Commented Feb 20, 2021 at 13:57

1 Answer 1

2

Since you are not giving the where you get the notebook, I have to guess that you get it from this course Supervised Learning: Regression provided IBM.

In the zip folder in week 1, it provides helper.py.

labwork

What you need to do it is to change the directory to where this file is. Change IPython/Jupyter notebook working directory

Alternatively, you can load boston data from sklearn then load it to Pandas Dataframe

Advices for you:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.