如何组织你的 jupyter notebook
在一个 Jupyter Notebook 中引用另一个 Notebook 的 Python 函数或类有以下几种常见方法。选择合适的方法取决于你的需求和项目结构: 方法 1: 使用 import_ipynb 模块 这是专门为导入 Jupyter Notebook 中的代码而设计的方法。 1. 安装 import_ipynb pip install import-ipynb 2. 导入另一个 Notebook 假设有一个 helper_functions.ipynb,你想在当前 Notebook 中使用它的内容。 import import_ipynb import helper_functions # 使用 helper_functions 中定义的函数或类 result = helper_functions.some_function() my_class = helper_functions.SomeClass() 方法 2: 将 Notebook 转换为 Python 文件 将另一个 Notebook 转换为 .py […]