Skip to content

Commit

Permalink
Added load_datatables function call to table visualization (#1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajchili authored and k8s-ci-robot committed Aug 28, 2019
1 parent 2f7d55b commit c642889
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions backend/src/apiserver/visualization/types/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
# itables is requires as importing it changes the way pandas DataFrames are
# rendered.
import itables.interactive
from itables.javascript import load_datatables
import itables.options as opts
import pandas as pd
from tensorflow.python.lib.io import file_io

# flake8: noqa TODO
# Forcefully load required JavaScript and CSS for datatables.
load_datatables()

# Remove maxByte limit to prevent issues where entire table cannot be rendered
# due to size of data.
Expand All @@ -32,7 +34,7 @@
files = file_io.get_matching_files(source)

# Read data from file and write it to a DataFrame object.
if variables.get("headers", False) == False:
if not variables.get("headers", False):
# If no headers are provided, use the first row as headers
for f in files:
dfs.append(pd.read_csv(f))
Expand All @@ -43,6 +45,6 @@

# Display DataFrame as output.
df = pd.concat(dfs)
if variables.get("headers", False) != False:
if variables.get("headers", False):
df.columns = variables.get("headers")
show(df)

0 comments on commit c642889

Please sign in to comment.