Skip to content

Commit f4e4978

Browse files
authored
Merge pull request #39 from ilia-kats/pandas3_compat
compatibility with pandas 3 string dtype
2 parents eac627d + fa13a24 commit f4e4978

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mofapy2/build_model/save_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def saveMetaData(self):
186186

187187
ctype = self.samples_metadata[g][col].dtype
188188

189-
if ctype == "object":
189+
if ctype in ("object", "str"):
190190
try:
191191
# Try to encode as ASCII strings
192192
group_meta.create_dataset(
@@ -244,7 +244,7 @@ def saveMetaData(self):
244244
].astype(orig_type)
245245

246246
ctype = self.features_metadata[m][col].dtype
247-
ctype = "|S" if ctype == "object" else ctype.type
247+
ctype = "|S" if ctype in ("object", "str") else ctype.type
248248
view_meta.create_dataset(
249249
col, data=np.array(self.features_metadata[m][col], dtype=ctype)
250250
)

0 commit comments

Comments
 (0)