diff --git a/google/colab/_quickchart.py b/google/colab/_quickchart.py index e0c5d584..9a1cbce2 100644 --- a/google/colab/_quickchart.py +++ b/google/colab/_quickchart.py @@ -63,15 +63,11 @@ def _ensure_dataframe_registry(): chart_sections = [] if numeric_cols: - selected_numeric_cols = numeric_cols[:max_chart_instances] - chart_sections += [ - _quickchart_helpers.value_plots_section( - df, selected_numeric_cols, _DATAFRAME_REGISTRY - ), + chart_sections.append( _quickchart_helpers.histograms_section( - df, selected_numeric_cols, _DATAFRAME_REGISTRY - ), - ] + df, numeric_cols[:max_chart_instances], _DATAFRAME_REGISTRY + ) + ) if categorical_cols: selected_categorical_cols = categorical_cols[:max_chart_instances] @@ -90,6 +86,27 @@ def _ensure_dataframe_registry(): ), ] + if time_cols: + chart_sections.append( + _quickchart_helpers.time_series_line_plots_section( + df, + _select_time_series_cols( + time_cols=time_cols, + numeric_cols=numeric_cols, + categorical_cols=categorical_cols, + k=max_chart_instances, + ), + _DATAFRAME_REGISTRY, + ), + ) + + if numeric_cols: + chart_sections.append( + _quickchart_helpers.value_plots_section( + df, numeric_cols[:max_chart_instances], _DATAFRAME_REGISTRY + ) + ) + if len(categorical_cols) >= 2: chart_sections += [ _quickchart_helpers.heatmaps_section( @@ -110,20 +127,6 @@ def _ensure_dataframe_registry(): ), ] - if time_cols: - chart_sections.append( - _quickchart_helpers.time_series_line_plots_section( - df, - _select_time_series_cols( - time_cols=time_cols, - numeric_cols=numeric_cols, - categorical_cols=categorical_cols, - k=max_chart_instances, - ), - _DATAFRAME_REGISTRY, - ), - ) - if not chart_sections: print('No charts were generated by quickchart') return chart_sections