hexarray2decimal


Namehexarray2decimal JSON
Version 0.12 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/hexarray2decimal
SummaryConverts a numpy string array with hex values to int
upload_time2023-01-04 23:54:33
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords numpy hex hex2int
VCS
bugtrack_url
requirements numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Converts a numpy string array with hex values to int 

```python
# Tested with:
# Python 3.9.13
# Windows 10

pip install hexarray2decimal

from hexarray2decimal import numpy_hex_string_array_to_int

a1 = 20000 * ["0xffff", "0xa011", "0xb122", "0x99ff", "0x00ee", "0x0b54"]
a1r = numpy_hex_string_array_to_int(numpyarray=a1)
print(a1r)
# [65535 40977 45346 ... 39423   238  2900]


a1 = 20000 * ["0xff", "0xa0", "0xb1", "0x99", "0x00", "0x0b"]
a1r = numpy_hex_string_array_to_int(numpyarray=a1)
print(a1r)
# [255 160 177 ... 153   0  11]

a1 = 20000 * ["ff", "a0", "b1", "99", "00", "0b"]
a1r = numpy_hex_string_array_to_int(numpyarray=a1)
print(a1r)
# [255 160 177 ... 153   0  11]
a1 = 20000 * ["f", "a", "b", "9", "0", "c"]
a1r = numpy_hex_string_array_to_int(numpyarray=a1)
print(a1r)
# [15 10 11 ...  9  0 12]
a1 = 20000 * ["0xFF", "0xA1", "0xB2", "0x99", "0xE0", "0xCB"]
a1r = numpy_hex_string_array_to_int(numpyarray=a1)
print(a1r)
# [255 161 178 ... 153 224 203]


# Different string sizes may lead to unexpected behavior:
a1 = 20000 * ["fffff", "a", "b", "9", "0", "c"]
a1r = numpy_hex_string_array_to_int(numpyarray=a1)
print(a1r)
# [1048575  655360  720896 ...  589824       0  786432]
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/hexarray2decimal",
    "name": "hexarray2decimal",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "numpy,hex,hex2int",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8e/84/a32e52ba3638ca5008d16363d577561799aab005d8a401db52fa9bbdd6a6/hexarray2decimal-0.12.tar.gz",
    "platform": null,
    "description": "\n# Converts a numpy string array with hex values to int \n\n```python\n# Tested with:\n# Python 3.9.13\n# Windows 10\n\npip install hexarray2decimal\n\nfrom hexarray2decimal import numpy_hex_string_array_to_int\n\na1 = 20000 * [\"0xffff\", \"0xa011\", \"0xb122\", \"0x99ff\", \"0x00ee\", \"0x0b54\"]\na1r = numpy_hex_string_array_to_int(numpyarray=a1)\nprint(a1r)\n# [65535 40977 45346 ... 39423   238  2900]\n\n\na1 = 20000 * [\"0xff\", \"0xa0\", \"0xb1\", \"0x99\", \"0x00\", \"0x0b\"]\na1r = numpy_hex_string_array_to_int(numpyarray=a1)\nprint(a1r)\n# [255 160 177 ... 153   0  11]\n\na1 = 20000 * [\"ff\", \"a0\", \"b1\", \"99\", \"00\", \"0b\"]\na1r = numpy_hex_string_array_to_int(numpyarray=a1)\nprint(a1r)\n# [255 160 177 ... 153   0  11]\na1 = 20000 * [\"f\", \"a\", \"b\", \"9\", \"0\", \"c\"]\na1r = numpy_hex_string_array_to_int(numpyarray=a1)\nprint(a1r)\n# [15 10 11 ...  9  0 12]\na1 = 20000 * [\"0xFF\", \"0xA1\", \"0xB2\", \"0x99\", \"0xE0\", \"0xCB\"]\na1r = numpy_hex_string_array_to_int(numpyarray=a1)\nprint(a1r)\n# [255 161 178 ... 153 224 203]\n\n\n# Different string sizes may lead to unexpected behavior:\na1 = 20000 * [\"fffff\", \"a\", \"b\", \"9\", \"0\", \"c\"]\na1r = numpy_hex_string_array_to_int(numpyarray=a1)\nprint(a1r)\n# [1048575  655360  720896 ...  589824       0  786432]\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Converts a numpy string array with hex values to int",
    "version": "0.12",
    "split_keywords": [
        "numpy",
        "hex",
        "hex2int"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "06d03fe330da9aebf777f22da297acd59a3521e029262a519c08de0835e6bd5b",
                "md5": "2025eef51f653a78340711b49f600553",
                "sha256": "aa6d951621501206bca236bcb1f5b021af9c32136479d10c4bca02176d7c6393"
            },
            "downloads": -1,
            "filename": "hexarray2decimal-0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2025eef51f653a78340711b49f600553",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5602,
            "upload_time": "2023-01-04T23:54:32",
            "upload_time_iso_8601": "2023-01-04T23:54:32.041329Z",
            "url": "https://files.pythonhosted.org/packages/06/d0/3fe330da9aebf777f22da297acd59a3521e029262a519c08de0835e6bd5b/hexarray2decimal-0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e84a32e52ba3638ca5008d16363d577561799aab005d8a401db52fa9bbdd6a6",
                "md5": "0282ad6d9d47e5a23eb2d140a739c90b",
                "sha256": "0f779ddcef73d48170bc47c3300f14aaacfa3ea9d55e92cf931496fe64721d18"
            },
            "downloads": -1,
            "filename": "hexarray2decimal-0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "0282ad6d9d47e5a23eb2d140a739c90b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4199,
            "upload_time": "2023-01-04T23:54:33",
            "upload_time_iso_8601": "2023-01-04T23:54:33.388915Z",
            "url": "https://files.pythonhosted.org/packages/8e/84/a32e52ba3638ca5008d16363d577561799aab005d8a401db52fa9bbdd6a6/hexarray2decimal-0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-04 23:54:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "hexarray2decimal",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": []
        }
    ],
    "lcname": "hexarray2decimal"
}
        
Elapsed time: 0.07872s