Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswex committed May 14, 2019
1 parent 9f14743 commit 550118f
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 550118f

Please sign in to comment.