Skip to content

Commit 9ede529

Browse files
authored
Fix TypeError in JAXProblem._get_measurements (#3122)
Use pandas 2.x & 3.x compatible check for string dtypes. Fixes #3120.
1 parent ab5f225 commit 9ede529

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

python/sdist/amici/jax/petab.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ def _get_measurements(
286286
for col in [petab.OBSERVABLE_PARAMETERS, petab.NOISE_PARAMETERS]:
287287
n_pars[col] = 0
288288
if col in self._petab_problem.measurement_df:
289-
if np.issubdtype(
290-
self._petab_problem.measurement_df[col].dtype, np.number
289+
if pd.api.types.is_numeric_dtype(
290+
self._petab_problem.measurement_df[col].dtype
291291
):
292292
n_pars[col] = 1 - int(
293293
self._petab_problem.measurement_df[col].isna().all()
@@ -363,7 +363,7 @@ def get_parameter_override(x):
363363
mat_numeric = jnp.ones((len(m), n_pars[col]))
364364
par_mask = np.zeros_like(mat_numeric, dtype=bool)
365365
par_index = np.zeros_like(mat_numeric, dtype=int)
366-
elif np.issubdtype(m[col].dtype, np.number):
366+
elif pd.api.types.is_numeric_dtype(m[col].dtype):
367367
mat_numeric = np.expand_dims(m[col].values, axis=1)
368368
par_mask = np.zeros_like(mat_numeric, dtype=bool)
369369
par_index = np.zeros_like(mat_numeric, dtype=int)

0 commit comments

Comments
 (0)