docstr: Display a dataframe as an interactive table.
  
  This command works with dataframes from Pandas, PyArrow, Snowpark, and PySpark.
  It can also display several other types that can be converted to dataframes,
  e.g. numpy arrays, lists, sets and dictionaries.
  
  Parameters
  ----------
  data : pandas.DataFrame, pandas.Series, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None
      The data to display.
  
      If 'data' is a pandas.Styler, it will be used to style its
      underlying DataFrame. Streamlit supports custom cell
      values and colors. It does not support some of the more exotic
      pandas styling features, like bar charts, hovering, and captions.
  
  width : int or None
      Desired width of the dataframe expressed in pixels. If None, the width
      will be automatically calculated based on the column content.
  
  height : int or None
      Desired height of the dataframe expressed in pixels. If None, a
      default height is used.
  
  use_container_width : bool
      If True, set the dataframe width to the width of the parent container.
      This takes precedence over the width argument.
  
  hide_index : bool or None
      Whether to hide the index column(s). If None (default), the visibility of
      index columns is automatically determined based on the data.
  
  column_order : Iterable of str or None
      Specifies the display order of columns. This also affects which columns are
      visible. For example, ``column_order=("col2", "col1")`` will display 'col2'
      first, followed by 'col1', and will hide all other non-index columns. If
      None (default), the order is inherited from the original data structure.
  
  column_config : dict or None
      Configures how columns are displayed, e.g. their title, visibility, type, or
      format. This needs to be a dictionary where each key is a column name and
      the value is one of:
  
      * ``None`` to hide the column.
  
      * A string to set the display label of the column.
  
      * One of the column types defined under ``st.column_config``, e.g.
        ``st.column_config.NumberColumn("Dollar values”, format=”$ %d")`` to show
        a column as dollar amounts. See more info on the available column types
        and config options `here <https://docs.streamlit.io/library/api-reference/data/st.column_config>`_.
  
      To configure the index column(s), use ``_index`` as the column name.
  
  Examples
  --------
  >>> import streamlit as st
  >>> import pandas as pd
  >>> import numpy as np
  >>>
  >>> df = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))
  >>>
  >>> st.dataframe(df)  # Same as st.write(df)
  
  .. output::
     https://doc-dataframe.streamlit.app/
     height: 410px
  
  You can also pass a Pandas Styler object to change the style of
  the rendered DataFrame:
  
  >>> import streamlit as st
  >>> import pandas as pd
  >>> import numpy as np
  >>>
  >>> df = pd.DataFrame(np.random.randn(10, 20), columns=("col %d" % i for i in range(20)))
  >>>
  >>> st.dataframe(df.style.highlight_max(axis=0))
  
  .. output::
     https://doc-dataframe1.streamlit.app/
     height: 410px
  
  Or you can customize the dataframe via ``column_config``, ``hide_index``, or ``column_order``:
  
  >>> import random
  >>> import pandas as pd
  >>> import streamlit as st
  >>>
  >>> df = pd.DataFrame(
  >>>     {
  >>>         "name": ["Roadmap", "Extras", "Issues"],
  >>>         "url": ["https://roadmap.streamlit.app", "https://extras.streamlit.app", "https://issues.streamlit.app"],
  >>>         "stars": [random.randint(0, 1000) for _ in range(3)],
  >>>         "views_history": [[random.randint(0, 5000) for _ in range(30)] for _ in range(3)],
  >>>     }
  >>> )
  >>> st.dataframe(
  >>>     df,
  >>>     column_config={
  >>>         "name": "App name",
  >>>         "stars": st.column_config.NumberColumn(
  >>>             "Github Stars",
  >>>             help="Number of stars on GitHub",
  >>>             format="%d ⭐",
  >>>         ),
  >>>         "url": st.column_config.LinkColumn("App URL"),
  >>>         "views_history": st.column_config.LineChartColumn(
  >>>             "Views (past 30 days)", y_min=0, y_max=5000
  >>>         ),
  >>>     },
  >>>     hide_index=True,
  >>> )
  
  .. output::
     https://doc-dataframe-config.streamlit.app/
     height: 350px
docstr_tok: ["Display","a","dataframe","as","an","interactive","table",".","This","command","works","with","dataframes","from","Pandas",",","PyArrow",",","Snowpark",",","and","PySpark",".","It","can","also","display","several","other","types","that","can","be","converted","to","dataframes",",","e.g",".","numpy","arrays",",","lists",",","sets","and","dictionaries",".","Parameters","--","--","--","--","--","data",":","pandas.DataFrame",",","pandas.Series",",","pandas.Styler",",","pandas.Index",",","pyarrow.Table",",","numpy.ndarray",",","pyspark.sql.DataFrame",",","snowflake.snowpark.dataframe.DataFrame",",","snowflake.snowpark.table.Table",",","Iterable",",","dict",",","or","None","The","data","to","display",".","If","'data","'","is","a","pandas.Styler",",","it","will","be","used","to","style","its","underlying","DataFrame",".","Streamlit","supports","custom","cell","values","and","colors",".","It","does","not","support","some","of","the","more","exotic","pandas","styling","features",",","like","bar","charts",",","hovering",",","and","captions",".","width",":","int","or","None","Desired","width","of","the","dataframe","expressed","in","pixels",".","If","None",",","the","width","will","be","automatically","calculated","based","on","the","column","content",".","height",":","int","or","None","Desired","height","of","the","dataframe","expressed","in","pixels",".","If","None",",","a","default","height","is","used",".","use_container_width",":","bool","If","True",",","set","the","dataframe","width","to","the","width","of","the","parent","container",".","This","takes","precedence","over","the","width","argument",".","hide_index",":","bool","or","None","Whether","to","hide","the","index","column","(","s",")",".","If","None","(","default",")",",","the","visibility","of","index","columns","is","automatically","determined","based","on","the","data",".","column_order",":","Iterable","of","str","or","None","Specifies","the","display","order","of","columns",".","This","also","affects","which","columns","are","visible",".","For","example",",","``","column_order=","(","``","col2","''",",","``","col1","''",")","``","will","display","'col2'","first",",","followed","by","'col1","'",",","and","will","hide","all","other","non-index","columns",".","If","None","(","default",")",",","the","order","is","inherited","from","the","original","data","structure",".","column_config",":","dict","or","None","Configures","how","columns","are","displayed",",","e.g",".","their","title",",","visibility",",","type",",","or","format",".","This","needs","to","be","a","dictionary","where","each","key","is","a","column","name","and","the","value","is","one","of",":","*","``","None","``","to","hide","the","column",".","*","A","string","to","set","the","display","label","of","the","column",".","*","One","of","the","column","types","defined","under","``","st.column_config","``",",","e.g",".","``","st.column_config.NumberColumn","(","``","Dollar","values","\u201d",",","format=","\u201d","$","%","d","''",")","``","to","show","a","column","as","dollar","amounts",".","See","more","info","on","the","available","column","types","and","config","options","`","here","<","https",":","\/\/docs.streamlit.io\/library\/api-reference\/data\/st.column_config",">","`","_",".","To","configure","the","index","column","(","s",")",",","use","``","_index","``","as","the","column","name",".","Examples","--","--","--","--",">",">",">","import","streamlit","as","st",">",">",">","import","pandas","as","pd",">",">",">","import","numpy","as","np",">",">",">",">",">",">","df","=","pd.DataFrame","(","np.random.randn","(","50",",","20",")",",","columns=","(","``","col","%","d","''","%","i","for","i","in","range","(","20",")",")",")",">",">",">",">",">",">","st.dataframe","(","df",")","#","Same","as","st.write","(","df",")","..","output",":",":","https",":","\/\/doc-dataframe.streamlit.app\/","height",":","410px","You","can","also","pass","a","Pandas","Styler","object","to","change","the","style","of","the","rendered","DataFrame",":",">",">",">","import","streamlit","as","st",">",">",">","import","pandas","as","pd",">",">",">","import","numpy","as","np",">",">",">",">",">",">","df","=","pd.DataFrame","(","np.random.randn","(","10",",","20",")",",","columns=","(","``","col","%","d","''","%","i","for","i","in","range","(","20",")",")",")",">",">",">",">",">",">","st.dataframe","(","df.style.highlight_max","(","axis=0",")",")","..","output",":",":","https",":","\/\/doc-dataframe1.streamlit.app\/","height",":","410px","Or","you","can","customize","the","dataframe","via","``","column_config","``",",","``","hide_index","``",",","or","``","column_order","``",":",">",">",">","import","random",">",">",">","import","pandas","as","pd",">",">",">","import","streamlit","as","st",">",">",">",">",">",">","df","=","pd.DataFrame","(",">",">",">","{",">",">",">","``","name","''",":","[","``","Roadmap","''",",","``","Extras","''",",","``","Issues","''","]",",",">",">",">","``","url","''",":","[","``","https",":","\/\/roadmap.streamlit.app","''",",","``","https",":","\/\/extras.streamlit.app","''",",","``","https",":","\/\/issues.streamlit.app","''","]",",",">",">",">","``","stars","''",":","[","random.randint","(","0",",","1000",")","for","_","in","range","(","3",")","]",",",">",">",">","``","views_history","''",":","[","[","random.randint","(","0",",","5000",")","for","_","in","range","(","30",")","]","for","_","in","range","(","3",")","]",",",">",">",">","}",">",">",">",")",">",">",">","st.dataframe","(",">",">",">","df",",",">",">",">","column_config=","{",">",">",">","``","name","''",":","``","App","name","''",",",">",">",">","``","stars","''",":","st.column_config.NumberColumn","(",">",">",">","``","Github","Stars","''",",",">",">",">","help=","''","Number","of","stars","on","GitHub","''",",",">",">",">","format=","''","%","d","\u2b50","''",",",">",">",">",")",",",">",">",">","``","url","''",":","st.column_config.LinkColumn","(","``","App","URL","''",")",",",">",">",">","``","views_history","''",":","st.column_config.LineChartColumn","(",">",">",">","``","Views","(","past","30","days",")","''",",","y_min=0",",","y_max=5000",">",">",">",")",",",">",">",">","}",",",">",">",">","hide_index=True",",",">",">",">",")","..","output",":",":","https",":","\/\/doc-dataframe-config.streamlit.app\/","height",":","350px"]
code: def dataframe(
      self,
      data: Data = None,
      width: int | None = None,
      height: int | None = None,
      *,
      use_container_width: bool = False,
      hide_index: bool | None = None,
      column_order: Iterable[str] | None = None,
      column_config: ColumnConfigMappingInput | None = None,
  ) -> "DeltaGenerator":
      """Display a dataframe as an interactive table.
  
      This command works with dataframes from Pandas, PyArrow, Snowpark, and PySpark.
      It can also display several other types that can be converted to dataframes,
      e.g. numpy arrays, lists, sets and dictionaries.
  
      Parameters
      ----------
      data : pandas.DataFrame, pandas.Series, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None
          The data to display.
  
          If 'data' is a pandas.Styler, it will be used to style its
          underlying DataFrame. Streamlit supports custom cell
          values and colors. It does not support some of the more exotic
          pandas styling features, like bar charts, hovering, and captions.
  
      width : int or None
          Desired width of the dataframe expressed in pixels. If None, the width
          will be automatically calculated based on the column content.
  
      height : int or None
          Desired height of the dataframe expressed in pixels. If None, a
          default height is used.
  
      use_container_width : bool
          If True, set the dataframe width to the width of the parent container.
          This takes precedence over the width argument.
  
      hide_index : bool or None
          Whether to hide the index column(s). If None (default), the visibility of
          index columns is automatically determined based on the data.
  
      column_order : Iterable of str or None
          Specifies the display order of columns. This also affects which columns are
          visible. For example, ``column_order=("col2", "col1")`` will display 'col2'
          first, followed by 'col1', and will hide all other non-index columns. If
          None (default), the order is inherited from the original data structure.
  
      column_config : dict or None
          Configures how columns are displayed, e.g. their title, visibility, type, or
          format. This needs to be a dictionary where each key is a column name and
          the value is one of:
  
          * ``None`` to hide the column.
  
          * A string to set the display label of the column.
  
          * One of the column types defined under ``st.column_config``, e.g.
            ``st.column_config.NumberColumn("Dollar values”, format=”$ %d")`` to show
            a column as dollar amounts. See more info on the available column types
            and config options `here <https://docs.streamlit.io/library/api-reference/data/st.column_config>`_.
  
          To configure the index column(s), use ``_index`` as the column name.
  
      Examples
      --------
      >>> import streamlit as st
      >>> import pandas as pd
      >>> import numpy as np
      >>>
      >>> df = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))
      >>>
      >>> st.dataframe(df)  # Same as st.write(df)
  
      .. output::
         https://doc-dataframe.streamlit.app/
         height: 410px
  
      You can also pass a Pandas Styler object to change the style of
      the rendered DataFrame:
  
      >>> import streamlit as st
      >>> import pandas as pd
      >>> import numpy as np
      >>>
      >>> df = pd.DataFrame(np.random.randn(10, 20), columns=("col %d" % i for i in range(20)))
      >>>
      >>> st.dataframe(df.style.highlight_max(axis=0))
  
      .. output::
         https://doc-dataframe1.streamlit.app/
         height: 410px
  
      Or you can customize the dataframe via ``column_config``, ``hide_index``, or ``column_order``:
  
      >>> import random
      >>> import pandas as pd
      >>> import streamlit as st
      >>>
      >>> df = pd.DataFrame(
      >>>     {
      >>>         "name": ["Roadmap", "Extras", "Issues"],
      >>>         "url": ["https://roadmap.streamlit.app", "https://extras.streamlit.app", "https://issues.streamlit.app"],
      >>>         "stars": [random.randint(0, 1000) for _ in range(3)],
      >>>         "views_history": [[random.randint(0, 5000) for _ in range(30)] for _ in range(3)],
      >>>     }
      >>> )
      >>> st.dataframe(
      >>>     df,
      >>>     column_config={
      >>>         "name": "App name",
      >>>         "stars": st.column_config.NumberColumn(
      >>>             "Github Stars",
      >>>             help="Number of stars on GitHub",
      >>>             format="%d ⭐",
      >>>         ),
      >>>         "url": st.column_config.LinkColumn("App URL"),
      >>>         "views_history": st.column_config.LineChartColumn(
      >>>             "Views (past 30 days)", y_min=0, y_max=5000
      >>>         ),
      >>>     },
      >>>     hide_index=True,
      >>> )
  
      .. output::
         https://doc-dataframe-config.streamlit.app/
         height: 350px
  
      """
  
      # Convert the user provided column config into the frontend compatible format:
      column_config_mapping = process_config_mapping(column_config)
  
      proto = ArrowProto()
      proto.use_container_width = use_container_width
      if width:
          proto.width = width
      if height:
          proto.height = height
  
      if column_order:
          proto.column_order[:] = column_order
  
      proto.editing_mode = ArrowProto.EditingMode.READ_ONLY
  
      if isinstance(data, pa.Table):
          # For pyarrow tables, we can just serialize the table directly
          proto.data = type_util.pyarrow_table_to_bytes(data)
      else:
          # For all other data formats, we need to convert them to a pandas.DataFrame
          # thereby, we also apply some data specific configs
  
          # Determine the input data format
          data_format = type_util.determine_data_format(data)
  
          if type_util.is_pandas_styler(data):
              # If pandas.Styler uuid is not provided, a hash of the position
              # of the element will be used. This will cause a rerender of the table
              # when the position of the element is changed.
              delta_path = self.dg._get_delta_path_str()
              default_uuid = str(hash(delta_path))
              marshall_styler(proto, data, default_uuid)
  
          # Convert the input data into a pandas.DataFrame
          data_df = type_util.convert_anything_to_df(
              data, ensure_copy=False
          )
          apply_data_specific_configs(
              column_config_mapping,
              data_df,
              data_format,
              check_arrow_compatibility=False,
          )
          # Serialize the data to bytes:
          proto.data = type_util.data_frame_to_bytes(data_df)
  
      if hide_index is not None:
          update_column_config(
              column_config_mapping,
              INDEX_IDENTIFIER,
              {"hidden": hide_index},
          )
      marshall_column_config(proto, column_config_mapping)
  
      return self.dg._enqueue("arrow_data_frame", proto)
  
file_path: streamlit/lib/streamlit/elements/arrow.py
imports: from __future__ import annotations
  from collections.abc import Iterable
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Union, cast
  import pyarrow
  from typing_extensions import TypeAlias
  from streamlit import type_util
  from streamlit.elements.lib.column_config_utils import INDEX_IDENTIFIER, ColumnConfigMappingInput, apply_data_specific_configs, marshall_column_config, process_config_mapping, update_column_config
  from streamlit.elements.lib.pandas_styler_utils import marshall_styler
  from streamlit.proto.Arrow_pb2 import Arrow
  from streamlit.runtime.metrics_util import gather_metrics
label_desc: Use image node_id 1 for calling the ArrowMixin obj's underlying member method code with example usage: obj.dataframe(data, width, height) and returns: self