Recently I encountered the following problem:
I have an array of strings:
name in ['Mueller', 'Meier', 'Schulze', 'Schmidt']
I face problems with its encoding in Python 3
:
name.encode('cp1252')
Here is the full snippet:
target_name = [name.encode('cp1252')
for name in
['Mueller', 'Meier', 'Schulze', 'Schmidt']]
assert_array_equal(arr['surname'],
target_name)
And here is the point where I also get the error. The error states:
Fail in test..... dtype='<|S7>'
I've been searching for a solution for some time, what I found so far is the need of changing the encoding. I applied:
name = np.char.encode('cp1252')
However I get another type of error with it.
Could someone help me with the error tracking?