I've got a dataset tag that is filled from a script. What's the best way for me to quickly inspect the dataset to see the values? I would typically temporarily bind it to a dataset in a view/window and inspect it there, but wondering if there's something quicker.
I'm pretty sure you can click the value in the tag browser to open a table with the dataset's value...
Otherwise, I'd either do just as you said, or print it in the script console.
here's a print_ds function:
def print_ds(ds, show_rownums=False):
"""
Print a dataset in a markdown compatible format.
params:
ds: Dataset to print
show_rownums: If true, a column is added at index 0 with the row number
"""
headers = list(ds.columnNames)
if ds.rowCount == 0:
print "| {} |".format(' | '.join(headers))
return
columns = [ds.getColumnAsList(i) for i in xrange(ds.columnCount)]
if show_rownums:
headers = [""] + headers
columns = [range(ds.rowCount)] + columns
widths = [
max(
max(len(unicode(value)) for value in col),
len(header)
) for header, col in izip(headers, columns)
]
print '| {} |'.format(' | '.join(h.ljust(w) for h, w in izip(headers, widths)))
print '|{}|'.format('|'.join('-'*(w+2) for w in widths))
print '\n'.join('| {} |'.format(' | '.join(unicode(v).ljust(w) for v, w in izip(row, widths))) for row in izip(*columns))
and here's what you could use in the script console:
Clicking (or double clicking) the value does not work, but expanding the tag and finding the value prop, I can expand that down and it gives a "folder" for each column that can then be expanded to view the values of the column.