Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 574494933
  • Loading branch information
drewbryant authored and colaboratory-team committed Oct 20, 2023
1 parent d1d9c52 commit 4414dfc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions google/colab/_quickchart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Automated chart generation for data frames."""
import collections.abc
import itertools
import logging

Expand Down Expand Up @@ -260,9 +261,10 @@ def _matches_datetime_pattern(colname):
) or any(colname == c for c in _DATETIME_COLNAMES)

for colname in df.columns:
if _matches_datetime_pattern(
colname
) or _is_monotonically_increasing_numeric(df[colname]):
if (
_matches_datetime_pattern(colname)
or _is_monotonically_increasing_numeric(df[colname])
) and _all_values_scalar(df[colname]):
timelike_cols.append(colname)

return {
Expand All @@ -286,6 +288,15 @@ def _is_monotonically_increasing_numeric(series):
)


def _all_values_scalar(series):
def _is_non_scalar(x):
return isinstance(x, collections.abc.Iterable) and not isinstance(
x, (bytes, str)
)

return not any(_is_non_scalar(x) for x in series)


def _get_axis_bounds(series, padding_percent=0.05, zero_rtol=1e-3):
"""Gets the min/max axis bounds for a given data series.
Expand Down

0 comments on commit 4414dfc

Please sign in to comment.