ipython-notebook

Including a notebook in another notebook in IPython?

点点圈 提交于 2019-12-30 05:06:05
问题 I have a notebook which I intend to use as a library for other notebooks. It has some functions that can ready certain types of files etc. How can I include that notebook in a new notebook that should be able to use the functions in the library notebook? 回答1: googling for notebook import hook yield some examples. This is still experimental, but you are welcomed to improved it. I would suggest also using the --script flag that save an importable .py file every time you save the notebook. 回答2:

read-only cells in ipython notebook

岁酱吖の 提交于 2019-12-30 04:03:25
问题 Is there a way to mark a cell in the ipython notebook readonly using the json format in the ipynb file? (E.g., a cell attribute "readonly":false or some such.) If not, is there a jquery hack to find suppress the double click event in the cell? 回答1: Yes, Use the steps below Select view on the menubar Point to Cell Toolbar and select Edit Metadata An "Edit Metadata" button will appear at the top-right corner of the cell. Click on that button and edit the json that pops up. Set the editable key

How to preview a part of a large pandas DataFrame, in iPython notebook?

南笙酒味 提交于 2019-12-30 00:27:12
问题 I am just getting started with pandas in the IPython Notebook and encountering the following problem: When a DataFrame read from a CSV file is small, the IPython Notebook displays it in a nice table view. When the DataFrame is large, something like this is ouput: In [27]: evaluation = readCSV("evaluation_MO_without_VNS_quality.csv").filter(["solver", "instance", "runtime", "objective"]) In [37]: evaluation Out[37]: <class 'pandas.core.frame.DataFrame'> Int64Index: 333 entries, 0 to 332 Data

how to save the output of a cell in iPython notebook?

爷,独闯天下 提交于 2019-12-29 04:36:28
问题 I would like to be able to save the TEXT output of an iPython notebook cell into a file on disk. I have 2 additional requirements/requests: be able to re-run the cell and overwrite my output with whatever the latest is. also display the output within the notebook. I have figured out how to use the %%capture magic for some basic saving of an iPython notebook's cell into a file, but it does not seem flexible enough: it keeps appending every time I re-run the cell and I cannot get it to display

New ipython notebook templating

流过昼夜 提交于 2019-12-28 13:24:14
问题 Is it possible to define some template content cells which all new ipython notebooks include when being created? I'd like my notebooks to include some standard CSS using this method and possibly also have a markdown cell with links I'm frequently using . 回答1: Thanks to @Jakob for the help. To get permanent customised CSS within the notebooks, I needed to create <myprofile>/static/custom/custom.css in my .ipython user folder folder. This worked quite ok. I used the firefox's webdev tools to

New ipython notebook templating

落花浮王杯 提交于 2019-12-28 13:23:27
问题 Is it possible to define some template content cells which all new ipython notebooks include when being created? I'd like my notebooks to include some standard CSS using this method and possibly also have a markdown cell with links I'm frequently using . 回答1: Thanks to @Jakob for the help. To get permanent customised CSS within the notebooks, I needed to create <myprofile>/static/custom/custom.css in my .ipython user folder folder. This worked quite ok. I used the firefox's webdev tools to

How do I comment out multiple lines in Jupyter Ipython notebook? [closed]

馋奶兔 提交于 2019-12-28 03:17:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I want to comment out a block of multiple lines in Jupyter (Ipython Notebook), but can't find out how to do that in this current version. It used to be in one of the drop down menus but is no longer there. How do you comment out multi-line blocks of code at once? This is not a duplicate because the solution given

How do I convert a IPython Notebook into a Python file via commandline?

☆樱花仙子☆ 提交于 2019-12-28 03:15:06
问题 I'm looking at using the *.ipynb files as the source of truth and programmatically 'compiling' them into .py files for scheduled jobs/tasks. The only way I understand to do this is via the GUI. Is there a way to do it via command line? 回答1: If you don't want to output a Python script every time you save, or you don't want to restart the IPython kernel: On the command line , you can use nbconvert: $ jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb As a bit of a hack, you can even call the

Automatically run %matplotlib inline in IPython Notebook

*爱你&永不变心* 提交于 2019-12-28 01:42:17
问题 Every time I launch IPython Notebook, the first command I run is %matplotlib inline Is there some way to change my config file so that when I launch IPython, it is automatically in this mode? 回答1: The configuration way IPython has profiles for configuration, located at ~/.ipython/profile_* . The default profile is called profile_default . Within this folder there are two primary configuration files: ipython_config.py ipython_kernel_config.py Add the inline option for matplotlib to ipython

Ipython1.1 notebook font change not working via css file

只愿长相守 提交于 2019-12-25 08:56:54
问题 I have tried to change some setting especially the fonts in my ipython 1.1 notebook via creating a profile and editing the costum.css but it is not working in windows 7. My custom.css file is in Users/"user_name"/.ipyton/profile_default/static/css directory and I have added these line to the file <style> div.cell.code_cell { /* Areat containing both code and output */ font-family: Consolas, monospace; } </style> What am I doing wrong 回答1: You don't need the <style> tags in the custom.css file