有一点已经众所周知。把变量名称或没有定义输出结果的语句放在cell的最后一行,无需print语句,Jupyter也会显示变量值。当使用Pandas DataFrames时这一点尤其有用,因为输出结果为整齐的表格。
鲜为人知的是,你可以通过修改内核选项ast_note_interactivity,使得Jupyter对独占一行的所有变量或者语句都自动显示,这样你就可以马上看到多个语句的运行结果了。

In [1]: from IPython.core.interactiveshell import InteractiveShell
        InteractiveShell.ast_node_interactivity = "all"
In [2]: from pydataset import data
        quakes = data('quakes')
        quakes.head()
        quakes.tail()
Out[2]:
        lat long    depth   mag stations
        1   -20.42  181.62  562 4.8 41
        2   -20.62  181.03  650 4.2 15
        3   -26.00  184.10  42  5.4 43
        4   -17.97  181.66  626 4.1 19
        5   -20.42  181.96  649 4.0 11
Out[2]:
        lat long    depth   mag stations
        996 -25.93  179.54  470 4.4 22
        997 -12.28  167.06  248 4.7 35
        998 -20.13  184.20  244 4.5 34
        999 -17.40  187.80  40  4.5 14
        1000    -21.59  170.56  165 6.0 119

如果你想在各种情形下(Notebook和Console)Jupyter都同样处理

创建文件~/.ipython/profile_default/ipython_config.py即可实现

c = get_config()
# Run all nodes interactively
c.InteractiveShell.ast_node_interactivity = "all"

[转]设置Jupyter-Notebook表格打印多个变量的值的更多相关文章

  1. ubuntu下设置jupyter notebook 2017年07月29日 19:28:34 小旋锋 阅读数:8329 标签: ubuntu 更多 个人分类: python 二三事 来源:http://blog.csdn.net/suzyu12345/article/details/51037905 Ipython Notebook现在已经改名为Ipython jupyter,是最知名最好用的

    ubuntu下设置jupyter notebook     来源:http://blog.csdn.net/suzyu12345/article/details/51037905 Ipython No ...

  2. 设置 Jupyter notebook 工作空间 / 默认路径

    常用的启动 Jupyter notebook 的两种方式是:命令行窗口启动和开始菜单启动.设置 Jupyter notebook 的默认路径也有两种常用方式: 修改配置文件 设置快捷方式. 1 通过修 ...

  3. 使用 gradle 在编译时动态设置 Android resValue / BuildConfig / Manifes中<meta-data>变量的值

    转载请说明来源: http://www.cnblogs.com/lizhilin2016/p/7390079.html 最近lz 在开始做一个新的Demo, 在项目中集成了bugly用于收集项目中的崩 ...

  4. Jupyter Notebook 介绍 安装和使用技巧

    Jupyter Notebook介绍.安装及使用教程 原文链接:https://www.jianshu.com/p/91365f343585 目录一.什么是Jupyter Notebook? 1. 简 ...

  5. jupyter notebook的两个使用技巧

    1.设置jupyter notebook的密码: Jupyter-notebook password 2.查看jupyter notebook的token: Jupyter notebook list

  6. 使用服务器上的Jupyter notebook。

    1.jupyter notebook --generate-config #产生配置文件 2.from notebook.auth import passwd #进入python环境,生成密码密文.第 ...

  7. jupyter Notebook 设置密码

    由于服务器关闭了图形界面 所以在服务器上安装Jupyter Notebook 随后本机web访问,利用本机的显卡可以执行plt相关图形命令 本次介绍如何设置Jupyter Notebook的密码设定 ...

  8. 使用阿里云服务器部署jupyter notebook远程访问

    安装annaconda 与jupyter notebook annaconda在已经自带了jupyter notebook.jupyter lab.ipython 等一系列工具,不需要再单独安装这些工 ...

  9. 使用 gradle 在编译时动态设置 Android resValue / BuildConfig / Manifes中&lt;meta-data&gt;变量的值

    转载请标明出处:http://blog.csdn.net/xx326664162/article/details/49247815 文章出自:薛瑄的博客 你也能够查看我的其它同类文章.也会让你有一定的 ...

随机推荐

  1. Asp.net mvc 知多少(四)

    本系列主要翻译自<ASP.NET MVC Interview Questions and Answers >- By Shailendra Chauhan,想看英文原版的可访问http:/ ...

  2. 通过gitbub桌面工具同步

    1.先创建目录,和选择路径 2.commit -> sync 3. cd ~/.ssh 查看公钥 在github 添加公钥. 4. 克隆文件git clone git@github.con:cu ...

  3. gradle发布jar包

    在.gradle文件中添加以下代码 apply plugin: 'application' mainClassName = 'com.excel.ExcelApplication' jar { doF ...

  4. Bat脚本命令说明

    命名参考 使用方式如果不知道如何使用就到cmd窗口键入help 命名名 例如:"help del" 命令名 注释 ASSOC 显示或修改文件扩展名关联. ATTRIB 显示或更改文 ...

  5. cell的复用机制

    以下全部都是转载自别人的博客:http://blog.sina.com.cn/s/blog_9c3c519b01016aqu.html 转自:http://www.2cto.com/kf/201207 ...

  6. Udacity并行计算课程笔记-The GPU Hardware and Parallel Communication Patterns

    本小节笔记大纲: 1.Communication patterns gather,scatter,stencil,transpose 2.GPU hardware & Programming ...

  7. ArcGIS API for JavaScript 4.2学习笔记[16] 弹窗自定义功能按钮及为要素自定义按钮(第五章完结)

    这节对Popups这一章的最后两个例子进行介绍和解析. 第一个[Popup Actions]介绍了弹窗中如何自定义工具按钮(名为actions),以PopupTemplate+FeatureLayer ...

  8. Python学习(五):易忘知识点

    1.列表比较函数cmp >>> a = [1,2,3,4] >>> b = [1,2,3,4,5] >>> c = [1,2,3,4] >& ...

  9. lesson - 12 课程笔记

    一.w 命令 作用: 用于显示已经登录系统的用户列表, 并显示用户正在执行的指令. 执行这个命令可得知目前登入系统的用户有哪些人, 以及他们正在执行的程序.  单独执行w 命令会显示所有的用户, 您也 ...

  10. springBoot系列教程07:异常捕获

    发生异常是很正常的事,异常种类也是千奇百怪,发生异常并不可怕,只要正确的处理,并正确的返回错误信息并无大碍,如果不进行捕获或者处理,分分钟服务器宕机是很正常的事 所以处理异常时,最基本的要求就是发生异 ...