From 685a83c471a729562bc421e0a1b7f363aaa3237a Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Mon, 8 Jun 2026 09:35:44 +0200 Subject: [PATCH] Refactor deprecated numpy.core.defchararray methods --- fermipy/catalog.py | 2 +- fermipy/utils.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fermipy/catalog.py b/fermipy/catalog.py index 8d974ef9..ea88333a 100644 --- a/fermipy/catalog.py +++ b/fermipy/catalog.py @@ -77,7 +77,7 @@ def strip_columns(tab): """Strip whitespace from string columns.""" for colname in tab.colnames: if tab[colname].dtype.kind in ['S', 'U']: - tab[colname] = np.core.defchararray.strip(tab[colname]) + tab[colname] = np.char.strip(tab[colname]) def row_to_dict(row): diff --git a/fermipy/utils.py b/fermipy/utils.py index 77092758..0583e554 100644 --- a/fermipy/utils.py +++ b/fermipy/utils.py @@ -15,7 +15,6 @@ from scipy.optimize import brentq from scipy.ndimage import label import scipy.special as special -from numpy.core import defchararray from numpy.polynomial.polynomial import polyfit try: from astropy.extern import six @@ -239,8 +238,7 @@ def find_rows_by_string(tab, names, colnames=['assoc']): continue col = tab[[colname]].copy() - col[colname] = defchararray.replace(defchararray.lower(col[colname]).astype(str), - ' ', '') + col[colname] = np.char.replace(np.char.lower(col[colname]).astype(str),' ', '') for name in names: mask |= col[colname] == name return mask