diff --git a/facets_overview/python/base_generic_feature_statistics_generator.py b/facets_overview/python/base_generic_feature_statistics_generator.py index b7562ba..3b7bc37 100644 --- a/facets_overview/python/base_generic_feature_statistics_generator.py +++ b/facets_overview/python/base_generic_feature_statistics_generator.py @@ -270,17 +270,14 @@ def GetDatasetsProto(self, datasets, features=None, sorted_vals = sorted(zip(counts, vals), reverse=True) sorted_vals = sorted_vals[:histogram_categorical_levels_count] for val_index, val in enumerate(sorted_vals): - if val[1].dtype.type is np.str_: - printable_val = val[1] - else: - try: - if (sys.version_info.major < 3 or - isinstance(data, (bytes, bytearray))): - printable_val = val[1].decode('UTF-8', 'strict') - else: - printable_val = val[1] - except (UnicodeDecodeError, UnicodeEncodeError): - printable_val = '__BYTES_VALUE__' + try: + if (sys.version_info.major < 3 or + isinstance(data, (bytes, bytearray))): + printable_val = val[1].decode('UTF-8', 'strict') + else: + printable_val = val[1] + except (UnicodeDecodeError, UnicodeEncodeError): + printable_val = '__BYTES_VALUE__' bucket = featstats.rank_histogram.buckets.add( low_rank=val_index, high_rank=val_index,