在IPython Notebook中显示所有pandas数据帧 [英] Show all pandas dataframes in an IPython Notebook
本文介绍了在IPython Notebook中显示所有pandas数据帧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何识别在当前笔记本会话中创建的所有Pandas DataFrame?
How could I identify all the Pandas DataFrames created in my current notebook session?
在SAS中看到工作库中的所有成员都是理想的。
Something like in SAS seeing all the members in the Work library would be ideal.
谢谢。
推荐答案
解决方案
Solution
%who DataFrame
解释
所有对象
Explanation
All objects
...查看工作库中的所有成员非常理想。
... seeing all the members in the Work library would be ideal.
In [1]:
a = 10
b = 'abs'
c = [1, 2, 3]
%who
显示所有使用的名称:
%who
shows all used names:
In [2]:
%who
a b c
方便地列出:
In [3]:
%who_ls
Out[3]:
['a', 'b', 'c']
或者作为数据类型的表:
Or as table with data types:
In [4]:
%whos
Variable Type Data/Info
----------------------------
a int 10
b str abs
c list n=3
过滤DataFrames
Filter for DataFrames
In [5]:
import pandas as pd
df1 = pd.DataFrame({'a': [100, 200, 300]})
df2 = pd.DataFrame({'b': [100, 200, 300]})
In [6]:
%whos DataFrame
Variable Type Data/Info
---------------------------------
df1 DataFrame a\n0 100\n1 200\n2 300
df2 DataFrame b\n0 100\n1 200\n2 300
In [7]:
%who DataFrame
df1 df2
In [8]:
%who_ls DataFrame
Out[8]:
['df1', 'df2']
这篇关于在IPython Notebook中显示所有pandas数据帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文