Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

np.float deprecation raises AttributeError: module 'numpy' has no attribute 'float'. #224

@dsm-72

Description

@dsm-72
test = de.test.pairwise(
    data=adata,
    grouping='group_label',
    test='t-test',
    lazy=False,
    noise_model=None,
    keep_full_test_objs=True
)

yields

File [~/mambaforge/envs/ENV/lib/python3.10/site-packages/diffxpy/testing/det.py:1567](https://file+.vscode-resource.vscode-cdn.net/Users/USER/Projects/PROJECT/examples/~/mambaforge/envs/ENV/lib/python3.10/site-packages/diffxpy/testing/det.py:1567), in DifferentialExpressionTestTT.__init__(self, data, sample_description, grouping, gene_names, is_logged, is_sig_zerovar)
   1564 x0, x1 = split_x(data, grouping)
   1566 # Only compute p-values for genes with non-zero observations and non-zero group-wise variance.
-> 1567 mean_x0 = np.asarray(np.mean(x0, axis=0)).flatten().astype(dtype=np.float)
   1568 mean_x1 = np.asarray(np.mean(x1, axis=0)).flatten().astype(dtype=np.float)
   1569 # Avoid unnecessary mean computation:


File [~/mambaforge/envs/ENV/lib/python3.10/site-packages/numpy/__init__.py:305](https://file+.vscode-resource.vscode-cdn.net/Users/USER/Projects/PROJECT/examples/~/mambaforge/envs/ENV/lib/python3.10/site-packages/numpy/__init__.py:305), in __getattr__(attr)
    300     warnings.warn(
    301         f"In the future `np.{attr}` will be defined as the "
    302         "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    304 if attr in __former_attrs__:
--> 305     raise AttributeError(__former_attrs__[attr])
    307 # Importing Tester requires importing all of UnitTest which is not a
    308 # cheap import Since it is mainly used in test suits, we lazy import it
    309 # here to save on the order of 10 ms of import time for most users
    310 #
    311 # The previous way Tester was imported also had a side effect of adding
    312 # the full `numpy.testing` namespace
    313 if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions