Quantcast
Channel: Print all variables defined in one Jupyter cell - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Joe T. Boka for Print all variables defined in one Jupyter cell

$
0
0

You can try something like this, using the inspect library.

import inspectk = 0.0417g = 0.829lx = 6.6m = k*g*lx**2def get_name(lst=[]):    local_vars = inspect.currentframe().f_back.f_locals.items()    for i in local_vars:        lst.append(i)    return dict(lst)import pandas as pddf = pd.DataFrame(get_name(), index=[0])result = df.T.loc[df.dtypes != object]print(result)          0g     0.829k     0.0417lx    6.6m     1.50584

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>