{"id":9490,"library":"arraykit","title":"Arraykit","description":"Arraykit provides low-level array utilities, often used by StaticFrame, for efficient data manipulation, type checking, and array transformations. It is currently at version 1.2.1 and follows an infrequent release cadence, often aligning with StaticFrame updates.","status":"active","version":"1.2.1","language":"en","source_language":"en","source_url":"https://github.com/static-frame/arraykit","tags":["array","numpy","utilities","data-science","staticframe"],"install":[{"cmd":"pip install arraykit","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core functionality relies on NumPy arrays and data types.","package":"numpy","optional":false}],"imports":[{"note":"Commonly used for flexible conversion of various inputs to NumPy arrays.","symbol":"astype_array","correct":"from arraykit import astype_array"},{"note":"Useful for checking if a value can be placed in a NumPy object array.","symbol":"is_objectable","correct":"from arraykit import is_objectable"},{"note":"For parsing delimited string data into arrays.","symbol":"delimited_to_arrays","correct":"from arraykit import delimited_to_arrays"}],"quickstart":{"code":"import numpy as np\nfrom arraykit import astype_array\n\n# Convert a list to a NumPy array with a specified dtype\ndata_int = [1, 2, 3, 4]\narray_float = astype_array(data_int, dtype=np.float64)\nprint(f\"Original list: {data_int}\")\nprint(f\"Converted array (float64): {array_float}, dtype: {array_float.dtype}\\n\")\n\n# Convert mixed data; typically results in an object dtype if types are incompatible\nmixed_data = [10, 'hello', 20.5, True]\narray_object = astype_array(mixed_data)\nprint(f\"Original mixed data: {mixed_data}\")\nprint(f\"Converted array (object): {array_object}, dtype: {array_object.dtype}\\n\")\n\n# Using is_objectable\nfrom arraykit import is_objectable\nprint(f\"Is 'hello' objectable? {is_objectable('hello')}\")\nprint(f\"Is np.datetime64('2023-01-01') objectable? {is_objectable(np.datetime64('2023-01-01'))}\")","lang":"python","description":"This quickstart demonstrates how to use `astype_array` to convert various Python sequences into NumPy arrays with optional dtype specification. It also shows `is_objectable` for checking type compatibility with object arrays."},"warnings":[{"fix":"Ensure that `datetime64` scalars used for lookups or comparisons have identical time units (e.g., 'ns', 's') to the `datetime64` values stored within `AutoMap` or `FrozenAutoMap`.","message":"NumPy `datetime64` scalar lookups in `AutoMap` and `FrozenAutoMap` (internal `arraykit` classes) explicitly require matching units for comparisons and indexing.","severity":"breaking","affected_versions":">=1.0.8"},{"fix":"Familiarize yourself with NumPy's type system and how it handles type conversions. Ensure data passed to arraykit functions conforms to expected array-like structures.","message":"Arraykit relies heavily on NumPy. Users unfamiliar with NumPy dtypes and array-like structures may encounter unexpected behavior or errors when passing incompatible data types to arraykit functions.","severity":"gotcha","affected_versions":"all"},{"fix":"Always refer to the official documentation or source code for the correct import path of specific functions. Avoid `from arraykit import *` to prevent namespace pollution and improve clarity.","message":"As a utility library, arraykit functions are typically imported directly from the top-level package (e.g., `from arraykit import some_function`). Attempting to access functions via nested modules might fail or be incorrect.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Run `pip install arraykit` to install the package.","cause":"The 'arraykit' package has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'arraykit'"},{"fix":"Upgrade your arraykit installation to the latest version (`pip install --upgrade arraykit`) or verify the function name against the documentation for your installed version.","cause":"The specific function `astype_array` was added in version 1.1.0. This error occurs if you are using an older version of arraykit or have a typo in the function name.","error":"AttributeError: module 'arraykit' has no attribute 'astype_array'"},{"fix":"Ensure that all elements in the input sequence are compatible with the target `dtype`. If the sequence contains mixed types (e.g., strings and numbers), consider using `dtype=object` or pre-process the data to handle non-numeric values.","cause":"This error typically occurs when using `astype_array` (or similar functions) to convert a sequence containing non-numeric strings to a numeric NumPy dtype (e.g., `np.int64`, `np.float64`).","error":"ValueError: invalid literal for int() with base 10: 'a'"}]}