Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

python - loading custom functions in Jupyter Notebook

I saved this function so I can reuse it many Jupyter Notebooks with out having to define every time for each notebook.

def strip_accents(s):
    return ''.join(c for c in unicodedata.normalize('NFD', s)
              if unicodedata.category(c) != 'Mn')

I can import it fine to my Jupyter Notebook, but it wont work and I get this error.

NameError: name 'unicodedata' is not defined

even though I have imported unicodedata in the notebook. Functions that don't rely on an outside module work fine. My question is how I can load my functions that rely on outside modules so that they run.

question from:https://stackoverflow.com/questions/65928339/loading-custom-functions-in-jupyter-notebook

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...