如何在我的 jupyter notebook 上列出、展示创建的对象 IDE

How to list, present created objects on my jupyter notebook IDE

我创建了很多对象名称,500多个对象。

好吧,我的问题是:如何查看创建的对象或如何清除 space,以便我可以在目录中保存一些 space。

完全不会影响我的存储空间?

1) 为了检查全局创建的对象,我建议 variable inspector extension. For installing refer to the docs.

2) 要清理全局变量,您可以 运行:

  • %reset 有提示
  • %reset -f 没有提示
  • %reset_selective <regular_expression> 清除与正则表达式匹配的选定变量

更多关于%reset and %reset_selective

上扩展:

## create some variables/objects
a = 5
b = 10
import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randint(1,100, size=(4,2)), columns=list('AB'))
print(a,b,'\n', df)

## check
%who
# >>> a b df np pd


#%%% Delete all

## clear with prompt
%reset
## clear without confirmation prompt
%reset -f

# check
%who


#%%% Delete specific

#%%%%  %reset_selective <regular_expression>

## clear with prompt
%reset_selective df

## clear without prompt
%reset_selective -f df

# multiple
%reset_selective -f [a,b]
# %reset_selective -f a,b  << doesn't work

## check
%who



#%%%% del
# clears without prompt

del a
## multiple
del [a,b]
# or
del a,b

## check
%who