갈루아의 반서재

다음과 같이 주피터 노트북의 데이터프레임을 html 포맷으로 변환할 수 있다.

1
2
3
(tensorflow)root@localhost:~/tensorflow# jupyter nbconvert mnist_for_beginner.ipynb
[NbConvertApp] Converting notebook mnist_for_beginner.ipynb to html
[NbConvertApp] Writing 260242 bytes to mnist_for_beginner.html
cs


변환 관련 옵션 및 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Options
-------
 
Arguments that take values are actually convenience aliases to full
Configurables, whose aliases are listed on the help line. For more information
on full configurables, see '--help-all'.
 
--execute
    Execute the notebook prior to export.
--allow-errors
    Continue notebook execution even if one of the cells throws an error and include the error message in the cell output (the default behaviour is to abort conversion). This flag is only relevant if '--execute' was specified, too.
--stdout
    Write notebook output to stdout instead of files.
--stdin
    read a single notebook file from stdin. Write the resulting notebook with default basename 'notebook.*'
--inplace
    Run nbconvert in place, overwriting the existing notebook (only
    relevant when converting to notebook format)
-y
    Answer yes to any questions instead of prompting.
--debug
    set log level to logging.DEBUG (maximize logging output)
--generate-config
    generate default config file
--nbformat=<Enum> (NotebookExporter.nbformat_version)
    Default: 4
    Choices: [1234]
    The nbformat version to write. Use this to downgrade notebooks.
--output-dir=<Unicode> (FilesWriter.build_directory)
    Default: ''
    Directory to write output to.  Leave blank to output to the current
    directory
--writer=<DottedObjectName> (NbConvertApp.writer_class)
    Default: 'FilesWriter'
    Writer class used to write the  results of the conversion
--log-level=<Enum> (Application.log_level)
    Default: 30
    Choices: (01020304050'DEBUG''INFO''WARN''ERROR''CRITICAL')
    Set the log level by value or name.
--reveal-prefix=<Unicode> (SlidesExporter.reveal_url_prefix)
    Default: u''
    The URL prefix for reveal.js. This can be a a relative URL for a local copy
    of reveal.js, or point to a CDN.
    For speaker notes to work, a local reveal.js prefix must be used.
--to=<Unicode> (NbConvertApp.export_format)
    Default: 'html'
    The export format to be used, either one of the built-in formats, or a
    dotted object name that represents the import path for an `Exporter` class
--template=<Unicode> (TemplateExporter.template_file)
    Default: u''
    Name of the template file to use
--output=<Unicode> (NbConvertApp.output_base)
    Default: ''
    overwrite base name use for output files. can only be used when converting
    one notebook at a time.
--post=<DottedOrNone> (NbConvertApp.postprocessor_class)
    Default: u''
    PostProcessor class used to write the results of the conversion
--config=<Unicode> (JupyterApp.config_file)
    Default: u''
    Full path of a config file.
 
To see all available configurables, use `--help-all`
 
Examples
--------
 
    The simplest way to use nbconvert is
 
    > jupyter nbconvert mynotebook.ipynb
 
    which will convert mynotebook.ipynb to the default format (probably HTML).
 
    You can specify the export format with `--to`.
    Options include ['custom''html''latex''markdown''notebook''pdf''python''rst''script''slides']
 
    > jupyter nbconvert --to latex mynotebook.ipynb
 
    Both HTML and LaTeX support multiple output templates. LaTeX includes
    'base''article' and 'report'.  HTML includes 'basic' and 'full'. You
    can specify the flavor of the format used.
 
    > jupyter nbconvert --to html --template basic mynotebook.ipynb
 
    You can also pipe the output to stdout, rather than a file
 
    > jupyter nbconvert mynotebook.ipynb --stdout
 
    PDF is generated via latex
 
    > jupyter nbconvert mynotebook.ipynb --to pdf
 
    You can get (and serve) a Reveal.js-powered slideshow
 
    > jupyter nbconvert myslides.ipynb --to slides --post serve
 
    Multiple notebooks can be given at the command line in a couple of
    different ways:
 
    > jupyter nbconvert notebook*.ipynb
    > jupyter nbconvert notebook1.ipynb notebook2.ipynb
 
    or you can specify the notebooks list in a config file, containing::
 
        c.NbConvertApp.notebooks = ["my_notebook.ipynb"]
 
    > jupyter nbconvert --config mycfg.py
 
cs