From 38d95a1155b9c591c2922a0ef6c0fe2f383cc62f Mon Sep 17 00:00:00 2001 From: ajpotts Date: Thu, 26 Feb 2026 13:10:50 -0500 Subject: [PATCH] Closes #5443: Remove deprecated functions --- arkouda/__init__.py | 9 +- arkouda/client_dtypes.py | 33 -- arkouda/core/__init__.py | 2 +- arkouda/core/logger.py | 356 +----------------- arkouda/numpy/__init__.py | 5 - arkouda/numpy/dtypes.py | 156 -------- arkouda/numpy/util.py | 2 +- arkouda/pandas/categorical.py | 35 -- arkouda/pandas/dataframe.py | 18 +- arkouda/pandas/index.py | 34 +- arkouda/pandas/io.py | 6 +- arkouda/pandas/match.py | 2 +- arkouda/pandas/series.py | 20 +- .../.akdata/id_9joRTHi_/id_9joRTHi_21.md | 3 + .../id_9joRTHi_/id_9joRTHi_21_LOCALE0000.data | Bin 0 -> 287 bytes tests/pandas/.akdata/id_9joRTHi_/server.md | 1 + .../.akdata/id_NZD0n7J_/id_NZD0n7J_21.md | 3 + .../id_NZD0n7J_/id_NZD0n7J_21_LOCALE0000.data | Bin 0 -> 287 bytes tests/pandas/.akdata/id_NZD0n7J_/server.md | 1 + .../.akdata/id_Ux6NDMz_/id_Ux6NDMz_21.md | 3 + .../id_Ux6NDMz_/id_Ux6NDMz_21_LOCALE0000.data | Bin 0 -> 287 bytes tests/pandas/.akdata/id_Ux6NDMz_/server.md | 1 + .../.akdata/id_wgoFwns_/id_wgoFwns_23.md | 3 + .../id_wgoFwns_/id_wgoFwns_23_LOCALE0000.data | Bin 0 -> 287 bytes tests/pandas/.akdata/id_wgoFwns_/server.md | 1 + tests/pandas/categorical_test.py | 5 - tests/pandas/dataframe_test.py | 12 +- 27 files changed, 56 insertions(+), 655 deletions(-) create mode 100644 tests/pandas/.akdata/id_9joRTHi_/id_9joRTHi_21.md create mode 100644 tests/pandas/.akdata/id_9joRTHi_/id_9joRTHi_21_LOCALE0000.data create mode 100644 tests/pandas/.akdata/id_9joRTHi_/server.md create mode 100644 tests/pandas/.akdata/id_NZD0n7J_/id_NZD0n7J_21.md create mode 100644 tests/pandas/.akdata/id_NZD0n7J_/id_NZD0n7J_21_LOCALE0000.data create mode 100644 tests/pandas/.akdata/id_NZD0n7J_/server.md create mode 100644 tests/pandas/.akdata/id_Ux6NDMz_/id_Ux6NDMz_21.md create mode 100644 tests/pandas/.akdata/id_Ux6NDMz_/id_Ux6NDMz_21_LOCALE0000.data create mode 100644 tests/pandas/.akdata/id_Ux6NDMz_/server.md create mode 100644 tests/pandas/.akdata/id_wgoFwns_/id_wgoFwns_23.md create mode 100644 tests/pandas/.akdata/id_wgoFwns_/id_wgoFwns_23_LOCALE0000.data create mode 100644 tests/pandas/.akdata/id_wgoFwns_/server.md diff --git a/arkouda/__init__.py b/arkouda/__init__.py index b4e30e90037..b9445841e7f 100644 --- a/arkouda/__init__.py +++ b/arkouda/__init__.py @@ -37,7 +37,7 @@ __version__ = get_versions()["version"] del get_versions -from arkouda.core.logger import LogLevel, disableVerbose, enableVerbose, disable_verbose, enable_verbose, write_log +from arkouda.core.logger import LogLevel, disable_verbose, enable_verbose, write_log from arkouda.core.client import ( connect, @@ -384,11 +384,6 @@ where, zeros, zeros_like, - isSupportedInt, - isSupportedNumber, - isSupportedBool, - isSupportedFloat, - isSupportedDType, ) from arkouda.pandas import ( Row, @@ -414,7 +409,7 @@ ArkoudaArrayLike, ) -from arkouda.client_dtypes import BitVector, bit_vectorizer, BitVectorizer, Fields, IPv4, ip_address, is_ipv4, is_ipv6 +from arkouda.client_dtypes import BitVector, bit_vectorizer, Fields, IPv4, ip_address, is_ipv4, is_ipv6 from arkouda.pandas.groupbyclass import GROUPBY_REDUCTION_TYPES, GroupBy, broadcast, groupable, unique from arkouda.pandas.categorical import Categorical diff --git a/arkouda/client_dtypes.py b/arkouda/client_dtypes.py index 537703bc0c9..dbd880f2570 100644 --- a/arkouda/client_dtypes.py +++ b/arkouda/client_dtypes.py @@ -49,8 +49,6 @@ """ -import warnings - from functools import partial from ipaddress import ip_address as _ip_address from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union @@ -106,37 +104,6 @@ def bit_vectorizer(width=64, reverse=False): return partial(BitVector, width=width, reverse=reverse) -def BitVectorizer(*args, **kwargs): - """ - Deprecated alias for :func:`bit_vectorizer`. - - This function exists for backward compatibility only. Use - :func:`bit_vectorizer` instead. - - Parameters - ---------- - *args : tuple - Positional arguments forwarded to :func:`bit_vectorizer`. - **kwargs : dict - Keyword arguments forwarded to :func:`bit_vectorizer`. - - Returns - ------- - bitvectorizer : callable - A function that takes an array and returns a BitVector instance. - - See Also - -------- - bit_vectorizer : Preferred replacement. - """ - warnings.warn( - "BitVectorizer is deprecated; use bit_vectorizer", - DeprecationWarning, - stacklevel=2, - ) - return bit_vectorizer(*args, **kwargs) - - class BitVector(pdarray): """ Represent integers as bit vectors, e.g. a set of flags. diff --git a/arkouda/core/__init__.py b/arkouda/core/__init__.py index caa9da1a583..a78ccfc50b0 100644 --- a/arkouda/core/__init__.py +++ b/arkouda/core/__init__.py @@ -2,4 +2,4 @@ # isort: skip_file # arkouda/core/__init__.py -from arkouda.core.logger import LogLevel,enable_verbose,disable_verbose,write_log,enableVerbose,disableVerbose +from arkouda.core.logger import LogLevel,enable_verbose,disable_verbose,write_log diff --git a/arkouda/core/logger.py b/arkouda/core/logger.py index 1f46b9b4243..384a4cc927d 100644 --- a/arkouda/core/logger.py +++ b/arkouda/core/logger.py @@ -57,7 +57,6 @@ """ import os -import warnings from dataclasses import dataclass from enum import Enum @@ -72,7 +71,7 @@ Logger, StreamHandler, ) -from typing import Any, Final, List, Optional, Union, cast +from typing import Final, List, Optional, Union, cast from typeguard import typechecked @@ -82,8 +81,6 @@ "enable_verbose", "disable_verbose", "write_log", - "enableVerbose", - "disableVerbose", ] loggers = {} @@ -221,32 +218,6 @@ def __init__( the individual handlers. """ - # --- log_level alias handling --- - if "logLevel" in kwargs: - if log_level is not _UNSET: - raise TypeError("Pass only one of 'logLevel' or 'log_level'") - warnings.warn( - "'logLevel' is deprecated; use 'log_level' instead", - DeprecationWarning, - stacklevel=2, - ) - log_level = kwargs.pop("logLevel") - elif log_level is _UNSET: - log_level = LogLevel.INFO - - # --- log_format alias handling --- - if "logFormat" in kwargs: - if log_format is not _UNSET: - raise TypeError("Pass only one of 'logFormat' or 'log_format'") - warnings.warn( - "'logFormat' is deprecated; use 'log_format' instead", - DeprecationWarning, - stacklevel=2, - ) - log_format = kwargs.pop("logFormat") - elif log_format is _UNSET: - log_format = "[%(name)s] Line %(lineno)d %(levelname)s: %(message)s" - if not isinstance(log_level, LogLevel): raise TypeError("log_level must be a LogLevel") @@ -304,67 +275,10 @@ def change_log_level(self, level: LogLevel, handlerNames: Optional[List[str]] = if name == handler.name: handler.setLevel(new_level) - def changeLogLevel(self, *args: Any, **kwargs: Any) -> None: - """ - Deprecated alias for :meth:`change_log_level`. - - This method exists for backward compatibility only. Use - :meth:`change_log_level` instead. - - Parameters - ---------- - *args : tuple - Positional arguments forwarded to :meth:`change_log_level`. - **kwargs : dict - Keyword arguments forwarded to :meth:`change_log_level`. - - Returns - ------- - None - - See Also - -------- - change_log_level : Preferred replacement. - """ - warnings.warn( - "changeLogLevel is deprecated; use change_log_level", - DeprecationWarning, - stacklevel=2, - ) - return self.change_log_level(*args, **kwargs) - def enable_verbose(self) -> None: """Enable verbose output by setting the log level for all handlers to DEBUG.""" self.change_log_level(LogLevel.DEBUG) - def enableVerbose(self): - """ - Deprecated alias for :meth:`enable_verbose`. - - This method exists for backward compatibility only. Use - :meth:`enable_verbose` instead. - - Returns - ------- - None - - Warns - ----- - DeprecationWarning - Always raised. ``enableVerbose`` is deprecated and will be removed - in a future release. - - See Also - -------- - enable_verbose : Preferred replacement. - """ - warnings.warn( - "enableVerbose is deprecated; use enable_verbose", - DeprecationWarning, - stacklevel=2, - ) - return self.enable_verbose() - @typechecked def disable_verbose(self, log_level: LogLevel | _Unset = _UNSET, **kwargs) -> None: """ @@ -384,61 +298,17 @@ def disable_verbose(self, log_level: LogLevel | _Unset = _UNSET, **kwargs) -> No TypeError Raised if log_level is not a LogLevel enum """ - if "logLevel" in kwargs: - if not isinstance(log_level, _Unset): - raise TypeError("Pass only one of 'logLevel' or 'log_level'") - warnings.warn( - "'logLevel' is deprecated; use 'log_level' instead", - DeprecationWarning, - stacklevel=2, - ) - log_level = kwargs.pop("logLevel") - elif isinstance(log_level, _Unset): - log_level = LogLevel.INFO - if kwargs: raise TypeError(f"Unexpected keyword argument(s): {', '.join(kwargs)}") + if log_level is _UNSET: + log_level = LogLevel.INFO + if not isinstance(log_level, LogLevel): raise TypeError("log_level must be a LogLevel") self.change_log_level(log_level) - def disableVerbose(self, logLevel: LogLevel = LogLevel.INFO): - """ - Deprecated alias for :meth:`disable_verbose`. - - This method exists for backward compatibility only. Use - :meth:`disable_verbose` instead. - - Parameters - ---------- - logLevel : LogLevel, default LogLevel.INFO - The log level to set for all handlers, disabling verbose - (DEBUG-level) output. - - Returns - ------- - None - - Warns - ----- - DeprecationWarning - Always raised. ``disableVerbose`` is deprecated and will be removed - in a future release. - - See Also - -------- - disable_verbose : Preferred replacement. - enable_verbose : Enable verbose (DEBUG-level) output. - """ - warnings.warn( - "disableVerbose is deprecated; use disable_verbose", - DeprecationWarning, - stacklevel=2, - ) - return self.disable_verbose(logLevel) - @typechecked def get_handler(self, name: str) -> Handler: """ @@ -467,47 +337,6 @@ def get_handler(self, name: str) -> Handler: return handler raise ValueError(f"The name {name} does not match any handler") - def getHandler(self, name: str): - """ - Deprecated alias for :meth:`get_handler`. - - This method exists for backward compatibility only. Use - :meth:`get_handler` instead. - - Parameters - ---------- - name : str - The name of the handler to retrieve. - - Returns - ------- - Handler - The handler with the matching ``Handler.name``. - - Raises - ------ - TypeError - Raised if ``name`` is not a string. - ValueError - Raised if no configured handler matches ``name``. - - Warns - ----- - DeprecationWarning - Always raised. ``getHandler`` is deprecated and will be removed - in a future release. - - See Also - -------- - get_handler : Preferred replacement. - """ - warnings.warn( - "getHandler is deprecated; use get_handler", - DeprecationWarning, - stacklevel=2, - ) - return self.get_handler(name) - @typechecked def get_arkouda_logger( @@ -517,30 +346,6 @@ def get_arkouda_logger( log_level: Optional[LogLevel] = None, # keep as-is (env fallback) **kwargs, ) -> ArkoudaLogger: - if "logFormat" in kwargs: - # If caller passed both names, always error (regardless of value) - if log_format is not None: - raise TypeError("Pass only one of 'logFormat' or 'log_format'") - warnings.warn( - "'logFormat' is deprecated; use 'log_format' instead", - DeprecationWarning, - stacklevel=2, - ) - log_format = kwargs.pop("logFormat") - - if "logLevel" in kwargs: - if log_level is not None: - raise TypeError("Pass only one of 'logLevel' or 'log_level'") - warnings.warn( - "'logLevel' is deprecated; use 'log_level' instead", - DeprecationWarning, - stacklevel=2, - ) - log_level = kwargs.pop("logLevel") - - if kwargs: - raise TypeError(f"Unexpected keyword argument(s): {', '.join(kwargs)}") - # Resolve defaults BEFORE validation if log_format is None: log_format = ArkoudaLogger.DEFAULT_LOG_FORMAT @@ -568,58 +373,6 @@ def get_arkouda_logger( return logger -def getArkoudaLogger( - name: str, - handlers: Optional[List[Handler]] = None, - logFormat: Optional[str] = ArkoudaLogger.DEFAULT_LOG_FORMAT, - logLevel: Optional[LogLevel] = None, -): - """ - Deprecated alias for :func:`get_arkouda_logger`. - - This function exists for backward compatibility only. Use - :func:`get_arkouda_logger` instead. - - Parameters - ---------- - name : str - The name of the ArkoudaLogger. - handlers : list of logging.Handler, optional - A list of handlers to attach to the logger. - logFormat : str, optional - The log message format string. - logLevel : LogLevel, optional - The logging level to use. If not provided, the value is - read from the ``ARKOUDA_LOG_LEVEL`` environment variable. - - Returns - ------- - ArkoudaLogger - The configured ArkoudaLogger instance. - - Warns - ----- - DeprecationWarning - Always raised. ``getArkoudaLogger`` is deprecated and will be removed - in a future release. - - See Also - -------- - get_arkouda_logger : Preferred replacement. - """ - warnings.warn( - "getArkoudaLogger is deprecated; use get_arkouda_logger", - DeprecationWarning, - stacklevel=2, - ) - return get_arkouda_logger( - name=name, - handlers=handlers, - logFormat=logFormat, - logLevel=logLevel, - ) - - @typechecked def get_arkouda_client_logger(name: str) -> ArkoudaLogger: """ @@ -653,77 +406,12 @@ def get_arkouda_client_logger(name: str) -> ArkoudaLogger: return get_arkouda_logger(name=name, log_format=ArkoudaLogger.CLIENT_LOG_FORMAT) -def getArkoudaClientLogger(name: str): - """ - Deprecated alias for :func:`get_arkouda_client_logger`. - - This function exists for backward compatibility only. Use - :func:`get_arkouda_client_logger` instead. - - Parameters - ---------- - name : str - The name of the ArkoudaLogger. - - Returns - ------- - ArkoudaLogger - A logger configured to emit unformatted messages to stdout. - - Warns - ----- - DeprecationWarning - Always raised. ``getArkoudaClientLogger`` is deprecated and will be - removed in a future release. - - See Also - -------- - get_arkouda_client_logger : Preferred replacement. - get_arkouda_logger : Base logger factory. - """ - warnings.warn( - "getArkoudaClientLogger is deprecated; use get_arkouda_client_logger", - DeprecationWarning, - stacklevel=2, - ) - return get_arkouda_client_logger(name=name) - - def enable_verbose() -> None: """Enable verbose logging (DEBUG log level) for all ArkoudaLoggers.""" for logger in loggers.values(): logger.enable_verbose() -def enableVerbose(): - """ - Deprecated alias for :func:`enable_verbose`. - - This function exists for backward compatibility only. Use - :func:`enable_verbose` instead. - - Returns - ------- - None - - Warns - ----- - DeprecationWarning - Always raised. ``enableVerbose`` is deprecated and will be removed - in a future release. - - See Also - -------- - enable_verbose : Enable verbose (DEBUG-level) logging for all loggers. - """ - warnings.warn( - "enableVerbose is deprecated; use enable_verbose", - DeprecationWarning, - stacklevel=2, - ) - return enable_verbose() - - @typechecked def disable_verbose(logLevel: LogLevel = LogLevel.INFO) -> None: """ @@ -747,42 +435,6 @@ def disable_verbose(logLevel: LogLevel = LogLevel.INFO) -> None: logger.disable_verbose(logLevel) -def disableVerbose(logLevel: LogLevel = LogLevel.INFO): - """ - Deprecated alias for :func:`disable_verbose`. - - This function exists for backward compatibility only. Use - :func:`disable_verbose` instead. - - Parameters - ---------- - logLevel : LogLevel, default LogLevel.INFO - The log level to apply to all ArkoudaLoggers, disabling - verbose (DEBUG-level) output. - - Returns - ------- - None - - Warns - ----- - DeprecationWarning - Always raised. ``disableVerbose`` is deprecated and will be removed - in a future release. - - See Also - -------- - disable_verbose : Disable verbose logging for all loggers. - enable_verbose : Enable verbose logging for all loggers. - """ - warnings.warn( - "disableVerbose is deprecated; use disable_verbose", - DeprecationWarning, - stacklevel=2, - ) - return disable_verbose(logLevel) - - @typechecked def write_log(log_msg: str, tag: str = "ClientGeneratedLog", log_lvl: LogLevel = LogLevel.INFO): """ diff --git a/arkouda/numpy/__init__.py b/arkouda/numpy/__init__.py index 8538aa749f4..4f67e0ad8b5 100644 --- a/arkouda/numpy/__init__.py +++ b/arkouda/numpy/__init__.py @@ -151,11 +151,6 @@ uint32, uint64, uint8, - isSupportedDType, - isSupportedFloat, - isSupportedInt, - isSupportedNumber, - isSupportedBool ) from arkouda.numpy.exceptions import RankWarning, TooHardError from arkouda.numpy.lib import add_docstring, add_newdoc, emath diff --git a/arkouda/numpy/dtypes.py b/arkouda/numpy/dtypes.py index c4803453cd1..4698d414222 100644 --- a/arkouda/numpy/dtypes.py +++ b/arkouda/numpy/dtypes.py @@ -2,7 +2,6 @@ import builtins import sys -import warnings from enum import Enum from typing import ( # noqa: F401 @@ -158,11 +157,6 @@ "ULongLongDType", "UShortDType", "VoidDType", - "isSupportedDType", - "isSupportedInt", - "isSupportedFloat", - "isSupportedBool", - "isSupportedNumber", ] @@ -881,36 +875,6 @@ def is_supported_int(num) -> TypeGuard[int_scalars]: return isinstance(num, ARKOUDA_SUPPORTED_INTS) -def isSupportedInt(num): - """ - Deprecated alias for :func:`is_supported_int`. - - This function exists for backward compatibility only. Use - :func:`is_supported_int` instead. - - Parameters - ---------- - num : object - A scalar value to test. - - Returns - ------- - bool - True if ``num`` is an arkouda-supported integer dtype, - otherwise False. - - See Also - -------- - is_supported_int : Preferred replacement. - """ - warnings.warn( - "isSupportedInt is deprecated; use is_supported_int instead", - DeprecationWarning, - stacklevel=2, - ) - return is_supported_int(num) - - def is_supported_float(num) -> TypeGuard[float_scalars]: """ Whether a scalar is an arkouda supported float dtype. @@ -937,36 +901,6 @@ def is_supported_float(num) -> TypeGuard[float_scalars]: return isinstance(num, ARKOUDA_SUPPORTED_FLOATS) -def isSupportedFloat(num): - """ - Deprecated alias for :func:`is_supported_float`. - - This function exists for backward compatibility only. Use - :func:`is_supported_float` instead. - - Parameters - ---------- - num : object - A scalar value to test. - - Returns - ------- - bool - True if ``num`` is an arkouda-supported float dtype, - otherwise False. - - See Also - -------- - is_supported_float : Preferred replacement. - """ - warnings.warn( - "isSupportedFloat is deprecated; use is_supported_float instead", - DeprecationWarning, - stacklevel=2, - ) - return is_supported_float(num) - - def is_supported_number(num) -> TypeGuard[numeric_scalars]: """ Whether a scalar is an arkouda supported numeric dtype. @@ -993,36 +927,6 @@ def is_supported_number(num) -> TypeGuard[numeric_scalars]: return isinstance(num, ARKOUDA_SUPPORTED_NUMBERS) -def isSupportedNumber(num): - """ - Deprecated alias for :func:`is_supported_number`. - - This function exists for backward compatibility only. Use - :func:`is_supported_number` instead. - - Parameters - ---------- - num : object - A scalar value to test. - - Returns - ------- - bool - True if ``num`` is an arkouda-supported numeric dtype, - otherwise False. - - See Also - -------- - is_supported_number : Preferred replacement. - """ - warnings.warn( - "isSupportedNumber is deprecated; use is_supported_number instead", - DeprecationWarning, - stacklevel=2, - ) - return is_supported_number(num) - - def is_supported_bool(num) -> TypeGuard[bool_scalars]: """ Whether a scalar is an arkouda supported boolean dtype. @@ -1049,36 +953,6 @@ def is_supported_bool(num) -> TypeGuard[bool_scalars]: return isinstance(num, ARKOUDA_SUPPORTED_BOOLS) -def isSupportedBool(num): - """ - Deprecated alias for :func:`is_supported_bool`. - - This function exists for backward compatibility only. Use - :func:`is_supported_bool` instead. - - Parameters - ---------- - num : object - A scalar value to test. - - Returns - ------- - bool - True if ``num`` is an arkouda-supported boolean dtype, - otherwise False. - - See Also - -------- - is_supported_bool : Preferred replacement. - """ - warnings.warn( - "isSupportedBool is deprecated; use is_supported_bool instead", - DeprecationWarning, - stacklevel=2, - ) - return is_supported_bool(num) - - def is_supported_dtype(scalar: object) -> builtins.bool: """ Whether a scalar is an arkouda supported dtype. @@ -1104,36 +978,6 @@ def is_supported_dtype(scalar: object) -> builtins.bool: return isinstance(scalar, ARKOUDA_SUPPORTED_DTYPES) -def isSupportedDType(num): - """ - Deprecated alias for :func:`is_supported_dtype`. - - This function exists for backward compatibility only. Use - :func:`is_supported_dtype` instead. - - Parameters - ---------- - num : object - A scalar value to test. - - Returns - ------- - bool - True if ``num`` is an arkouda-supported dtype, - otherwise False. - - See Also - -------- - is_supported_dtype : Preferred replacement. - """ - warnings.warn( - "isSupportedDType is deprecated; use is_supported_dtype instead", - DeprecationWarning, - stacklevel=2, - ) - return is_supported_dtype(num) - - def resolve_scalar_dtype(val: object) -> str: """Try to infer what dtype arkouda_server should treat val as.""" # ---- 1. Arkouda bigint scalar instances ---- diff --git a/arkouda/numpy/util.py b/arkouda/numpy/util.py index 34b9fd3c43b..672c77f4d95 100644 --- a/arkouda/numpy/util.py +++ b/arkouda/numpy/util.py @@ -1059,7 +1059,7 @@ def map( # Normalize mapping index keys into a "groupable" (single array OR tuple-of-arrays) mindex = mapping.index if isinstance(mindex, MultiIndex): - mkeys = tuple(mindex.index) + mkeys = tuple(mindex.values) else: mkeys = mindex.values diff --git a/arkouda/pandas/categorical.py b/arkouda/pandas/categorical.py index 31820d7b0e9..f2db438332c 100644 --- a/arkouda/pandas/categorical.py +++ b/arkouda/pandas/categorical.py @@ -49,7 +49,6 @@ import itertools import json -import warnings from collections import defaultdict from typing import ( @@ -163,24 +162,6 @@ def __init__(self, values, **kwargs) -> None: self.logger = get_arkouda_logger(name=__class__.__name__) # type: ignore - # --- deprecated kwarg aliases for na_value --- - _new = "na_value" - _deprecated = [k for k in ("naValue", "NAvalue") if k in kwargs] - - cls_name = type(self).__name__ - - if _new in kwargs and _deprecated: - raise TypeError(f"{cls_name}() got both '{_new}' and '{_deprecated[0]}'. Use '{_new}'.") - - if _deprecated: - old = _deprecated[0] - warnings.warn( - f"'{old}' is deprecated; use '{_new}' instead", - DeprecationWarning, - stacklevel=2, - ) - kwargs[_new] = kwargs.pop(old) - if "codes" in kwargs and "categories" in kwargs: # This initialization is called by Categorical.from_codes() # The values arg is ignored @@ -262,22 +243,6 @@ def __init__(self, values, **kwargs) -> None: self.dtype = akdtype(str_) self.registered_name: Optional[str] = None - @property - def NAvalue(self): - """ - Deprecated alias for `na_value`. - - Returns - ------- - Same value as `na_value`. - """ - warnings.warn( - "Categorical.NAvalue is deprecated; use Categorical.find_na instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.na_value - @property def nbytes(self): """ diff --git a/arkouda/pandas/dataframe.py b/arkouda/pandas/dataframe.py index a188eab9814..d31d2e2eeda 100644 --- a/arkouda/pandas/dataframe.py +++ b/arkouda/pandas/dataframe.py @@ -955,7 +955,7 @@ def __getattr__(self, key): if key not in self.columns.values: raise AttributeError(f"Attribute {key} not found") # Should this be cached? - return Series(data=self[key], index=self.index.index) + return Series(data=self[key], index=self.index.values) def __dir__(self): """ @@ -1027,7 +1027,7 @@ def __getitem__(self, key): for k in self._columns: result[k] = UserDict.__getitem__(self, k)[key] # To stay consistent with numpy, provide the old index values - return DataFrame(initialdata=result, index=self.index.index[key]) + return DataFrame(initialdata=result, index=self.index.values[key]) # Select rows or columns using a list if isinstance(key, (list, tuple)): @@ -1069,7 +1069,7 @@ def __getitem__(self, key): s = key for k in self._columns: rtn_data[k] = UserDict.__getitem__(self, k)[s] - return DataFrame(initialdata=rtn_data, index=self.index.index[arange(self._nrows)[s]]) + return DataFrame(initialdata=rtn_data, index=self.index.values[arange(self._nrows)[s]]) else: raise IndexError("Invalid selector: unknown error.") @@ -1211,7 +1211,7 @@ def _get_head_tail(self): newdf[col] = self[col].categories[self[col].codes[idx]] else: newdf[col] = self[col][idx] - newdf._set_index(self.index.index[idx]) + newdf._set_index(self.index.values[idx]) return newdf.to_pandas(retain_index=True) def _get_head_tail_server(self): @@ -1306,7 +1306,7 @@ def _get_head_tail_server(self): df_dict[msg[1]] = create_pdarray(msg[2]) new_df = DataFrame(df_dict) - new_df._set_index(self.index.index[idx]) + new_df._set_index(self.index.values[idx]) return new_df.to_pandas(retain_index=True)[self._columns] def transfer(self, hostname, port): @@ -1473,10 +1473,10 @@ def _drop_row(self, keys): for k in keys: if not isinstance(k, int): raise TypeError("Index keys must be integers.") - idx_list.append(self.index.index[(last_idx + 1) : k]) + idx_list.append(self.index.values[(last_idx + 1) : k]) last_idx = k - idx_list.append(self.index.index[(last_idx + 1) :]) + idx_list.append(self.index.values[(last_idx + 1) :]) idx_to_keep = concatenate(idx_list) for key in self.keys(): @@ -3678,7 +3678,7 @@ def copy(self, deep=True): res[key] = val[:] # if this is not a slice, renaming indexes with update both - res._set_index(Index(self.index.index[:])) + res._set_index(Index(self.index.values[:])) return res else: @@ -3843,7 +3843,7 @@ def isin(self, values: Union[pdarray, Dict, Series, DataFrame]) -> DataFrame: # create the dataframe with all false df_def = {col: zeros(self._nrows, dtype=akbool) for col in self.columns.values} # identify the indexes in both - rows_self, rows_val = intersect(self.index.index, values.index.index, unique=True) + rows_self, rows_val = intersect(self.index.values, values.index.values, unique=True) # used to sort the rows with only the indexes in both sort_self = self.index[rows_self].argsort() diff --git a/arkouda/pandas/index.py b/arkouda/pandas/index.py index ee47020db5d..513bd35df1e 100644 --- a/arkouda/pandas/index.py +++ b/arkouda/pandas/index.py @@ -280,7 +280,7 @@ def __repr__(self): Printable representation of the Index object. """ - return f"Index({repr(self.index)}, dtype='{self.dtype}')" + return f"Index({repr(self.values)}, dtype='{self.dtype}')" def __len__(self): """ @@ -292,7 +292,7 @@ def __len__(self): Number of elements in the Index. """ - return len(self.index) + return len(self.values) def _get_arrays_for_comparison( self, other @@ -430,34 +430,6 @@ def names(self): """Return Index or MultiIndex names.""" return [self.name] - @property - def index(self): - """ - Deprecated alias for `values`. - - This property is maintained for backward compatibility and returns the same - array as the `values` attribute. It will be removed in a future release; - use `values` directly instead. - - Returns - ------- - arkouda.numpy.pdarray - The underlying values of this object (same as `values`). - - Deprecated - ---------- - Use the `values` attribute directly. This alias will be removed in a future release. - - Examples - -------- - >>> import arkouda as ak - >>> idx = ak.Index(ak.array([1, 2, 3])) - >>> idx.index - array([1 2 3]) - - """ - return self.values - @property def shape(self): """ @@ -1054,7 +1026,7 @@ def to_dict(self, label): label = "idx" elif isinstance(label, list): label = label[0] - data[label] = self.index + data[label] = self.values return data def _check_types(self, other): diff --git a/arkouda/pandas/io.py b/arkouda/pandas/io.py index fda1d811448..ecf19793b53 100644 --- a/arkouda/pandas/io.py +++ b/arkouda/pandas/io.py @@ -1,7 +1,7 @@ """ Input/output utilities for Arkouda. -The `arkouda.pandas.io` module provides a comprehensive interface for reading from and writing to +The `arkouda.io` module provides a comprehensive interface for reading from and writing to various file formats including HDF5, Parquet, CSV, and Zarr. It supports importing/exporting data between Arkouda and Pandas, data checkpointing, and server snapshot/restore functionality. @@ -57,8 +57,8 @@ See Also -------- -arkouda.pandas.DataFrame, arkouda.pdarray, arkouda.strings.Strings, arkouda.numpy.segarray.SegArray, -arkouda.pandas.categorical.Categorical, arkouda.pandas.index.Index, arkouda.pandas.index.MultiIndex +arkouda.DataFrame, arkouda.pdarray, arkouda.strings.Strings, arkouda.segarray.SegArray, +arkouda.categorical.Categorical, arkouda.index.Index, arkouda.index.MultiIndex """ diff --git a/arkouda/pandas/match.py b/arkouda/pandas/match.py index ec08b01dfb2..0b96413a121 100644 --- a/arkouda/pandas/match.py +++ b/arkouda/pandas/match.py @@ -35,7 +35,7 @@ See Also -------- -arkouda.strings.Strings +arkouda.numpy.strings.Strings arkouda.core.client.regexMaxCaptures """ diff --git a/arkouda/pandas/series.py b/arkouda/pandas/series.py index a8b6ec9e3b3..ee91dad2358 100644 --- a/arkouda/pandas/series.py +++ b/arkouda/pandas/series.py @@ -713,14 +713,14 @@ def finalize(selector) -> Series: # ---- Series key: preserve its index, lookup by its values (Arkouda Series) if isinstance(key, Series): - return Series(index=key.index, data=lookup(self.index.index, self.values, key.values)) + return Series(index=key.index, data=lookup(self.index.values, self.values, key.values)) # ---- Direct index objects if isinstance(key, MultiIndex): return finalize(self.index.lookup(key.index)) if isinstance(key, Index): - return finalize(self.index.lookup(key.index)) + return finalize(self.index.lookup(key.values)) # ---- pdarray key if isinstance(key, pdarray): @@ -799,8 +799,8 @@ def binop(self, other) -> Series: return cls((self.index, operator(self.values, other.values))) else: idx = self.index._merge(other.index).index - a = lookup(self.index.index, self.values, idx, fillvalue=0) - b = lookup(other.index.index, other.values, idx, fillvalue=0) + a = lookup(self.index.values, self.values, idx, fillvalue=0) + b = lookup(other.index.values, other.values, idx, fillvalue=0) return cls((idx, operator(a, b))) else: return cls((self.index, operator(self.values, other))) @@ -823,7 +823,7 @@ def aggop(self) -> Series: @typechecked def add(self, b: Series) -> Series: - index = self.index.concat(b.index).index + index = self.index.concat(b.index).values values = concatenate([self.values, b.values], ordered=False) @@ -852,7 +852,7 @@ def topn(self, n: int = 10) -> Series: idx = argmaxk(v, n) idx = idx[-1 : -n - 1 : -1] - return Series(index=k.index[idx], data=v[idx]) + return Series(index=k.values[idx], data=v[idx]) def _reindex(self, idx): if isinstance(self.index, MultiIndex): @@ -921,13 +921,13 @@ def sort_values(self, ascending: bool = True) -> Series: def tail(self, n: int = 10) -> Series: """Return the last n values of the series.""" idx_series = self.index[-n:] - return Series(index=idx_series.index, data=self.values[-n:]) + return Series(index=idx_series.values, data=self.values[-n:]) @typechecked def head(self, n: int = 10) -> Series: """Return the first n values of the series.""" idx_series = self.index[0:n] - return Series(index=idx_series.index, data=self.values[0:n]) + return Series(index=idx_series.values, data=self.values[0:n]) @typechecked def to_pandas(self) -> pd.Series: @@ -1391,7 +1391,7 @@ def concat( if value_labels is not None: # Expect value_labels to always be not None; were doing the check for mypy for col, label in zip(arrays, value_labels): - data[str(label)] = lookup(col.index.index, col.values, idx.index, fillvalue=0) + data[str(label)] = lookup(col.index.values, col.values, idx.values, fillvalue=0) return arkouda.pandas.dataframe.DataFrame(data) else: @@ -1401,7 +1401,7 @@ def concat( for other in arrays[1:]: idx = idx.concat(other.index) v = concatenate([v, other.values], ordered=True) - return Series(index=idx.index, data=v) + return Series(index=idx.values, data=v) def map(self, arg: Union[dict, Series]) -> Series: """ diff --git a/tests/pandas/.akdata/id_9joRTHi_/id_9joRTHi_21.md b/tests/pandas/.akdata/id_9joRTHi_/id_9joRTHi_21.md new file mode 100644 index 00000000000..859867c87f9 --- /dev/null +++ b/tests/pandas/.akdata/id_9joRTHi_/id_9joRTHi_21.md @@ -0,0 +1,3 @@ +{"entryName":"id_9joRTHi_21", "entryType":"PrimitiveTypedArraySymEntry"} +{"dtype":"int64", "size":10, "ndim":1, "numTargetLocales":1, "numChunks":1} +{"filename":".akdata/id_9joRTHi_/id_9joRTHi_21_LOCALE0000.data", "numElems":10} diff --git a/tests/pandas/.akdata/id_9joRTHi_/id_9joRTHi_21_LOCALE0000.data b/tests/pandas/.akdata/id_9joRTHi_/id_9joRTHi_21_LOCALE0000.data new file mode 100644 index 0000000000000000000000000000000000000000..5747ef73be46af3fad066b15644b7f9b0eee0243 GIT binary patch literal 287 zcmb7Ay$*sf5I#sH9f|3YHtEns!T>}D21gS|2jUwvNTP#+1@*<8eKwCMPA*>Va+mMB z|7yJ}kfA}dB?oi(ivNiakRwk~V2A+*TJnjJd`gZW`GFGa%@`n4X$dmu>qB$0=o7F2 z$@X@z5DBG~jzLpW2|=jdI1&*(J<@m+^M6LFbUb4m0<`bA>DWiaoSXniOlRHY+6-CU db(wXpy_;L(`eS=G#VTLsh0>ae9%L20<^>;WAQS)q literal 0 HcmV?d00001 diff --git a/tests/pandas/.akdata/id_9joRTHi_/server.md b/tests/pandas/.akdata/id_9joRTHi_/server.md new file mode 100644 index 00000000000..005f82f014d --- /dev/null +++ b/tests/pandas/.akdata/id_9joRTHi_/server.md @@ -0,0 +1 @@ +{"serverid":"id_9joRTHi_", "numLocales":1} diff --git a/tests/pandas/.akdata/id_NZD0n7J_/id_NZD0n7J_21.md b/tests/pandas/.akdata/id_NZD0n7J_/id_NZD0n7J_21.md new file mode 100644 index 00000000000..ba58219d9f1 --- /dev/null +++ b/tests/pandas/.akdata/id_NZD0n7J_/id_NZD0n7J_21.md @@ -0,0 +1,3 @@ +{"entryName":"id_NZD0n7J_21", "entryType":"PrimitiveTypedArraySymEntry"} +{"dtype":"int64", "size":10, "ndim":1, "numTargetLocales":1, "numChunks":1} +{"filename":".akdata/id_NZD0n7J_/id_NZD0n7J_21_LOCALE0000.data", "numElems":10} diff --git a/tests/pandas/.akdata/id_NZD0n7J_/id_NZD0n7J_21_LOCALE0000.data b/tests/pandas/.akdata/id_NZD0n7J_/id_NZD0n7J_21_LOCALE0000.data new file mode 100644 index 0000000000000000000000000000000000000000..5747ef73be46af3fad066b15644b7f9b0eee0243 GIT binary patch literal 287 zcmb7Ay$*sf5I#sH9f|3YHtEns!T>}D21gS|2jUwvNTP#+1@*<8eKwCMPA*>Va+mMB z|7yJ}kfA}dB?oi(ivNiakRwk~V2A+*TJnjJd`gZW`GFGa%@`n4X$dmu>qB$0=o7F2 z$@X@z5DBG~jzLpW2|=jdI1&*(J<@m+^M6LFbUb4m0<`bA>DWiaoSXniOlRHY+6-CU db(wXpy_;L(`eS=G#VTLsh0>ae9%L20<^>;WAQS)q literal 0 HcmV?d00001 diff --git a/tests/pandas/.akdata/id_NZD0n7J_/server.md b/tests/pandas/.akdata/id_NZD0n7J_/server.md new file mode 100644 index 00000000000..001bec42d34 --- /dev/null +++ b/tests/pandas/.akdata/id_NZD0n7J_/server.md @@ -0,0 +1 @@ +{"serverid":"id_NZD0n7J_", "numLocales":1} diff --git a/tests/pandas/.akdata/id_Ux6NDMz_/id_Ux6NDMz_21.md b/tests/pandas/.akdata/id_Ux6NDMz_/id_Ux6NDMz_21.md new file mode 100644 index 00000000000..f903f4aae6c --- /dev/null +++ b/tests/pandas/.akdata/id_Ux6NDMz_/id_Ux6NDMz_21.md @@ -0,0 +1,3 @@ +{"entryName":"id_Ux6NDMz_21", "entryType":"PrimitiveTypedArraySymEntry"} +{"dtype":"int64", "size":10, "ndim":1, "numTargetLocales":1, "numChunks":1} +{"filename":".akdata/id_Ux6NDMz_/id_Ux6NDMz_21_LOCALE0000.data", "numElems":10} diff --git a/tests/pandas/.akdata/id_Ux6NDMz_/id_Ux6NDMz_21_LOCALE0000.data b/tests/pandas/.akdata/id_Ux6NDMz_/id_Ux6NDMz_21_LOCALE0000.data new file mode 100644 index 0000000000000000000000000000000000000000..5747ef73be46af3fad066b15644b7f9b0eee0243 GIT binary patch literal 287 zcmb7Ay$*sf5I#sH9f|3YHtEns!T>}D21gS|2jUwvNTP#+1@*<8eKwCMPA*>Va+mMB z|7yJ}kfA}dB?oi(ivNiakRwk~V2A+*TJnjJd`gZW`GFGa%@`n4X$dmu>qB$0=o7F2 z$@X@z5DBG~jzLpW2|=jdI1&*(J<@m+^M6LFbUb4m0<`bA>DWiaoSXniOlRHY+6-CU db(wXpy_;L(`eS=G#VTLsh0>ae9%L20<^>;WAQS)q literal 0 HcmV?d00001 diff --git a/tests/pandas/.akdata/id_Ux6NDMz_/server.md b/tests/pandas/.akdata/id_Ux6NDMz_/server.md new file mode 100644 index 00000000000..061633c86bf --- /dev/null +++ b/tests/pandas/.akdata/id_Ux6NDMz_/server.md @@ -0,0 +1 @@ +{"serverid":"id_Ux6NDMz_", "numLocales":1} diff --git a/tests/pandas/.akdata/id_wgoFwns_/id_wgoFwns_23.md b/tests/pandas/.akdata/id_wgoFwns_/id_wgoFwns_23.md new file mode 100644 index 00000000000..f2ac91e9985 --- /dev/null +++ b/tests/pandas/.akdata/id_wgoFwns_/id_wgoFwns_23.md @@ -0,0 +1,3 @@ +{"entryName":"id_wgoFwns_23", "entryType":"PrimitiveTypedArraySymEntry"} +{"dtype":"int64", "size":10, "ndim":1, "numTargetLocales":1, "numChunks":1} +{"filename":".akdata/id_wgoFwns_/id_wgoFwns_23_LOCALE0000.data", "numElems":10} diff --git a/tests/pandas/.akdata/id_wgoFwns_/id_wgoFwns_23_LOCALE0000.data b/tests/pandas/.akdata/id_wgoFwns_/id_wgoFwns_23_LOCALE0000.data new file mode 100644 index 0000000000000000000000000000000000000000..5747ef73be46af3fad066b15644b7f9b0eee0243 GIT binary patch literal 287 zcmb7Ay$*sf5I#sH9f|3YHtEns!T>}D21gS|2jUwvNTP#+1@*<8eKwCMPA*>Va+mMB z|7yJ}kfA}dB?oi(ivNiakRwk~V2A+*TJnjJd`gZW`GFGa%@`n4X$dmu>qB$0=o7F2 z$@X@z5DBG~jzLpW2|=jdI1&*(J<@m+^M6LFbUb4m0<`bA>DWiaoSXniOlRHY+6-CU db(wXpy_;L(`eS=G#VTLsh0>ae9%L20<^>;WAQS)q literal 0 HcmV?d00001 diff --git a/tests/pandas/.akdata/id_wgoFwns_/server.md b/tests/pandas/.akdata/id_wgoFwns_/server.md new file mode 100644 index 00000000000..28757764cb3 --- /dev/null +++ b/tests/pandas/.akdata/id_wgoFwns_/server.md @@ -0,0 +1 @@ +{"serverid":"id_wgoFwns_", "numLocales":1} diff --git a/tests/pandas/categorical_test.py b/tests/pandas/categorical_test.py index f1f1e61a667..a863d71c832 100644 --- a/tests/pandas/categorical_test.py +++ b/tests/pandas/categorical_test.py @@ -637,8 +637,3 @@ def test_copy_empty_categorical(self): if a is not None: assert a is not b assert_equal(a, b) - - def test_categorical_NAvalue_deprecated_returns_find_na(self): - cat = Categorical(ak.array(["a", "b"])) - with pytest.deprecated_call(): - assert cat.NAvalue == cat.na_value diff --git a/tests/pandas/dataframe_test.py b/tests/pandas/dataframe_test.py index 56bd12603d9..1ae36be9b47 100644 --- a/tests/pandas/dataframe_test.py +++ b/tests/pandas/dataframe_test.py @@ -559,7 +559,7 @@ def test_append(self): assert_frame_equal(ref_df, df.to_pandas()) idx = np.arange(8) - assert idx.tolist() == df.index.index.tolist() + assert idx.tolist() == df.index.values.tolist() df_keyerror = self.build_ak_keyerror() with pytest.raises(KeyError): @@ -1017,7 +1017,7 @@ def test_isin(self): # test against series i = ak.Index(ak.arange(2)) - s = ak.Series(data=ak.array([3, 9]), index=i.index) + s = ak.Series(data=ak.array([3, 9]), index=i.values) test_df = df.isin(s) assert test_df["col_A"].tolist() == [False, False] assert test_df["col_B"].tolist() == [False, True] @@ -1077,11 +1077,11 @@ def test_head_tail_resetting_index(self): bool_idx = df[df["cnt"] > 3] bool_idx.__repr__() - assert bool_idx.index.index.tolist() == list(range(4, 65)) + assert bool_idx.index.values.tolist() == list(range(4, 65)) slice_idx = df[:] slice_idx.__repr__() - assert slice_idx.index.index.tolist() == list(range(65)) + assert slice_idx.index.values.tolist() == list(range(65)) # verify it persists non-int Index idx = ak.concatenate([ak.zeros(5, bool), ak.ones(60, bool)]) @@ -1091,11 +1091,11 @@ def test_head_tail_resetting_index(self): bool_idx.__repr__() # the new index is first False and rest True (because we lose first 4), # so equivalent to arange(61, bool) - assert bool_idx.index.index.tolist() == ak.arange(61, dtype=bool).tolist() + assert bool_idx.index.values.tolist() == ak.arange(61, dtype=bool).tolist() slice_idx = df[:] slice_idx.__repr__() - assert slice_idx.index.index.tolist() == idx.tolist() + assert slice_idx.index.values.tolist() == idx.tolist() def test_subset(self): df = ak.DataFrame(