简体   繁体   English

将多个jupyter笔记本合并到单个python程序中

[英]Merge multiple jupyter notebooks into single python program

I have multiple notebooks. 我有多个笔记本。 I want to merge them into a single python program. 我想将它们合并到一个python程序中。 can you suggest me the best way. 你能建议我最好的方法吗?

Sample scenario: 示例场景:

notebook1 ( has 2 dataframes):        
x , y

Notebook2 ( has 2 dataframes basically susbsets of notebook1 data frames):
 x1 = x['xxx'] >0
 y1= y['xxx'] >0

Notebook3 (has 3 dataframes):
 z,z1,z2

Notebook4: (uses all the dataframes from previous notebooks and performs operations).

output=x*z*z1*y1

What is the best method of creating say "exec.py" that basically uses all the notebooks and gives the final output? 基本上使用所有笔记本并给出最终输出的最佳创建方法“ exec.py”是什么?
Shall I covert each note book to a python program or shall I convert each notebook to a function? 我应该将每本笔记本都转换为python程序,还是应该将每个笔记本转换为函数?

Please provide your insights. 请提供您的见解。 Thanks a lot in advance. 非常感谢。

You can do it with this straightforward and elegant script written by Fernando Pérez . 您可以使用FernandoPérez编写的简单明了的脚本来做到这一点。 The script merges many Jupyter Notebooks into a single one. 该脚本将许多Jupyter Notebook合并为一个。

I've tried and it works for me. 我已经尝试过了,并且对我有用。 I hope it helps you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM