numexpr icon indicating copy to clipboard operation
numexpr copied to clipboard

NE3: Byte and Unicode string support

Open robbmcleod opened this issue 8 years ago • 3 comments

NE2 had very limited support for ascii-encoded strings (with the contains function and comparisons). Likely additional function could be added to NE3 if someone who does string processing could be found to implement them.

The main question is how to interact with the Python Unicode object, and how to get the byte-depth used (i.e. UTF-8 versus UTF-16 versus UTF-32).

robbmcleod avatar Mar 14 '17 03:03 robbmcleod

I guess you already have one, but in case you need a small test for python3:

import numexpr as ne

data_text = {'a': 'b'}
data_byte = {'a': b'b'}
condition = "(a=='a')"

try:
    r_text = ne.evaluate(condition, data_text)
except Exception as error:
    print('Exception when text', error)

r_byte = ne.evaluate(condition, data_byte)
print('Byte version', r_byte)

This code prints:

Exception when text unknown type str32
Byte version False

It fails when trying using python3's string but it works for byte. I also notice that we don't need the byte version for the condition (paramter ex).

zorion avatar Dec 13 '19 15:12 zorion

Hi is this planned to be released? Very intested in the unicode support

Message to comment on stale issues. If none provided, will not mark issues stale

github-actions[bot] avatar Mar 13 '24 01:03 github-actions[bot]