awkward repring on python3 bytes types · Issue #4455 · pandas-dev/pandas (original) (raw)

might be an edge case as i'm not sure how useful storing byte strings in Series objects is, nonetheless they are repring like tuple objects in Python 3

In [37]: import string

In [38]: d = string.digits * 10

In [39]: s = Series([d, tm.rands(10), tm.rands(10000)])

In [40]: s
Out[40]:
0    0123456789012345678901234567890123456789012345...
1                                           c0HYcb0BlY
2    IghbSU964QRgNimc0jZn2etcTFhRgHnHQepH1dwAqVZLar...
dtype: object

In [41]: b = lambda x, encoding='utf8': bytes(x, encoding=encoding)

In [42]: s.map(b)
Out[42]:
0      (48, 49, 50, 51, 52, 53, 54, 55, 56, 57, ...)
1          (99, 48, 72, 89, 99, 98, 48, 66, 108, 89)
2    (73, 103, 104, 98, 83, 85, 57, 54, 52, 81, ...)
dtype: object

PR coming soon with a couple of other output formatting fixes as well regarding py3 compat