Skip to content

Commit

Permalink
Add compatibility np.array() call for numpy 1.24
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed May 28, 2023
1 parent feb3a4c commit 2590133
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions matminer/featurizers/site/chemical.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ def fit(self, X, y=None):
Returns:
self
"""
if isinstance(X, (list, tuple)):
# Required for numpy 1.24 due to changes in the way numpy casts
# object arrays.
X = np.array(X, dtype=object)

structs = np.atleast_2d(X)[:, 0]
if not all([isinstance(struct, Structure) for struct in structs]):
raise TypeError("This fit requires an array-like input of Pymatgen " "Structures and sites!")
Expand Down

0 comments on commit 2590133

Please sign in to comment.