Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 557163563
  • Loading branch information
craigcitro authored and colaboratory-team committed Aug 15, 2023
1 parent 5adc434 commit 694a0e6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions google/colab/data_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

from google.colab import _interactive_table_helper
from google.colab import _quickchart_hint_button
from google.colab import autoviz as _autoviz
from google.colab import widgets as _widgets
import IPython as _IPython
from IPython import display as _display

Expand All @@ -46,6 +48,7 @@
'disable_dataframe_formatter',
'load_ipython_extension',
'unload_ipython_extension',
'display_dataframe',
]

# For details on updating gviz js, refer to: <internal>/gviz/update_data_table
Expand Down Expand Up @@ -282,6 +285,30 @@ def _gen_js(self, dataframe):
)


def display_dataframe(df):
"""Display a dataframe as a table, possibly with additional information.
This function is *not* intended to have a stable output: over time, the
details of what is displayed will change. Currently, this also includes
summary information and a selection of automatically generated charts.
Args:
df: a pd.DataFrame to be displayed
Returns:
None
"""
t = _widgets.TabBar(['Data', 'Charts', 'Summary'])
with t.output_to('Data'):
_display.display(DataTable(df, include_index=False))
with t.output_to('Charts', select=False):
_autoviz.quickchart(df)
with t.output_to('Summary', select=False):
s = df.describe(datetime_is_numeric=True, include='all').fillna('').T
_display.display(DataTable(s))
return


class _JavascriptModuleFormatter(_IPython.core.formatters.BaseFormatter):
format_type = _traitlets.Unicode(_JAVASCRIPT_MODULE_MIME_TYPE)
print_method = _traitlets.ObjectName('_repr_javascript_module_')
Expand Down

0 comments on commit 694a0e6

Please sign in to comment.