code: def data_table(df, n=1000, page_size=10):
      if df is not None:
          df = df.head(n)
          columns = [{"name": "Index", "id": "Index"}] + [
              {"name": c, "id": c} for c in df.columns
          ]
          data = []
          for i in range(df.shape[0]):
              d = {c: v for c, v in zip(df.columns, df.values[i])}
              d.update({"Index": df.index[i]})
              data.append(d)
  
          table = dash_table.DataTable(
              id="table",
              columns=columns,
              data=data,
              style_cell_conditional=[{"textAlign": "center"}],
              style_table={"overflowX": "scroll"},
              editable=False,
              column_selectable="single",
              page_action="native",
              page_size=page_size,
              page_current=0,
              style_header=dict(backgroundColor=TABLE_HEADER_COLOR),
              style_data=dict(backgroundColor=TABLE_DATA_COLOR),
          )
          return table
      else:
          return dash_table.DataTable()
  
imports: import plotly
  import plotly.graph_objects
  from plotly.subplots import make_subplots
  from dash import dash_table, dcc
  from merlion.dashboard.settings import *
label_desc: Use image node_id 1 for calling a global function with example usage: data_table(df, n, page_size) and returns: table, dash_table