numpyencoder icon indicating copy to clipboard operation
numpyencoder copied to clipboard

incomplete support of numpy types

Open shaimach opened this issue 7 years ago • 3 comments

Hi,

Current code does not support bool_, void and complex types. This causes issues when encoding certain dtype-s (e.g. from h5py files).

Adding the following lines will resolve the issue:

    elif isinstance(obj,(np.complex_,np.complex64,np.complex128)):
        return {'real': obj.real, 'imag': obj.imag}
    
    elif isinstance(obj, (np.bool_)):
        return bool(obj)

    elif isinstance(obj, (np.void)): 
        return None        

shaimach avatar Jul 15 '19 19:07 shaimach

Thanks for your suggestion. Sorry it has taken so long to get around to this. I'm going to work on implementing this now.

hmallen avatar Apr 24 '20 05:04 hmallen

Changes implemented and project moved to v0.2.0.

hmallen avatar Apr 24 '20 05:04 hmallen

Thank you !

On Fri, 24 Apr 2020, 8:32 Hunter Allen, [email protected] wrote:

Closed #1 https://github.com/hmallen/numpyencoder/issues/1.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hmallen/numpyencoder/issues/1#event-3267898113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH3Q4OXSGCFM3JMBL6J42TROEP6TANCNFSM4ID2AT7A .

shaimach avatar Apr 24 '20 10:04 shaimach