简体   繁体   English

Jupyter 笔记本魔术命令 - 使用 %who DataFrame 获取 DataFrame 列表?

[英]Jupyter notebook magic command - use %who DataFrame to get list of DataFrames?

I can print all interactive variables, with some minimal formatting using %who .我可以使用%who以最小的格式打印所有交互式变量。

If I only want defined DataFrames, %who DataFrame works great.如果我只想要定义的 DataFrames, %who DataFrame效果很好。

Is there a way to send the output of %who DataFrame to a list?有没有办法将%who DataFrame的输出发送到列表?

I believe %who_ls is what you're looking for:我相信%who_ls是你要找的:

Return a sorted list of all interactive variables.返回所有交互变量的排序列表。

If arguments are given, only variables of types matching these arguments are returned.如果给出参数,则仅返回与这些参数匹配的类型的变量。

Example use -示例使用 -

In [1]: x, y, z = 1, 1, 1

In [2]: ints = %who_ls int

In [3]: print(ints)
['x', 'y', 'z']

您想使用此命令将 who 的输出放入变量中:

df_list = %who_ls DataFrame

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

相关问题 Bash电池魔术(%%)在Jupyter笔记本(Windows 7)中给出“找不到命令”错误 - Bash cell magic (%%) giving “command not found” error in Jupyter notebook (Windows 7) 从脚本以编程方式调用 Jupyter Notebook 魔术命令 - Call Jupyter Notebook magic command programmatically, from script Jupyter Lab/Notebook 魔术命令 %load 与平台无关的路径 - Jupyter Lab/Notebook magic command %load with platform independent path 是否可以将%who DataFrame转换为IPython Notebook中的列表? - Is it possible to convert %who DataFrame to a list in IPython Notebook? 如何在 jupyter notebook 中为 SQL 行魔术、单元魔术和自定义命令添加语法高亮? - How to add syntax highlight to SQL line magic, cell magic and custom command in jupyter notebook? jupyter笔记本 - 检查魔法是否可用 - jupyter notebook - check if magic is available Jupyter 处理笔记本异常的魔法 - Jupyter magic to handle notebook exceptions jupyter:“ notebook”不是Jupyter命令 - jupyter: 'notebook' is not a Jupyter command Jupyter:“笔记本”不是 jupyter 命令 - Jupyter: "notebook" is not a jupyter command 无论数据帧索引的长度如何,迭代 colors 列表 - Jupyter Notebook - Iterate list of colors regardless of length of index of dataframes - Jupyter Notebook
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM