Skip to content

Instantly share code, notes, and snippets.

@masnick
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masnick/378d39a92191db263fd2 to your computer and use it in GitHub Desktop.
Save masnick/378d39a92191db263fd2 to your computer and use it in GitHub Desktop.
IPython notebook snipped for a list of variables in a dataframe
# Assumes `df` is a Pandas DataFrame object
import IPython.core.display as di
for k, v in df.columns.to_series().groupby(df.dtypes).groups.iteritems():
di.display_html("<ul><li><b>%s</b><ul>%s</ul></li></ul>" % (k, ''.join(["<li>%s</li>" % vv for vv in sorted(v)])), raw=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment