def _view(args, cell):
csv = datalab.data.Csv(args['input'])
num_lines = int(args['count'] or 5)
headers = None
if cell:
ipy = IPython.get_ipython()
config = _utils.parse_config(cell, ipy.user_ns)
if 'columns' in config:
headers = [e.strip() for e in config['columns'].split(',')]
df = pd.DataFrame(csv.browse(num_lines, headers))
if args['profile']:
# TODO(gram): We need to generate a schema and type-convert the columns before this
# will be useful for CSV
return _utils.profile_df(df)
else:
return IPython.core.display.HTML(df.to_html(index=False))
评论列表
文章目录