Skip to content

Commit

Permalink
Make inspect more usable (#748)
Browse files Browse the repository at this point in the history
- Print the name of the dataframe
- Print data types in a single line with a max length, so the inspect output still looks like a tree
  • Loading branch information
dimaryaz authored Aug 8, 2018
1 parent 4cf83a2 commit 25e3c9d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions compiler/quilt/tools/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,8 +1160,11 @@ def _print_node(node, prefix, child_prefix, name, path):
elif node.metadata['q_target'] == TargetType.PANDAS.value:
df = store.load_dataframe(node.hashes)
assert isinstance(df, pd.DataFrame)
info = "shape %s, type \"%s\"" % (df.shape, df.dtypes)
print(prefix + name_prefix + ": " + info)
types = ", ".join("%r: %s" % (name, dtype) for name, dtype in df.dtypes.items())
if len(types) > 64:
types = types[:63] + "…"
info = "shape %s, types %s" % (df.shape, types)
print(prefix + name_prefix + name + ": " + info)
else:
print(prefix + name_prefix + name)

Expand Down

0 comments on commit 25e3c9d

Please sign in to comment.