Skip to content

Commit

Permalink
Avoid numpy strings
Browse files Browse the repository at this point in the history
  • Loading branch information
giadarol committed Jun 18, 2024
1 parent 5c508f9 commit 10766f6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xdeps/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def __init__(
count_sep="##",
offset_sep="%%",
index_cache=None,
cast_strings=True
):
self._data = data

Expand All @@ -226,6 +227,9 @@ def __init__(
vv = data[kk]
if not hasattr(vv, 'dtype'):
raise ValueError(f"Column `{kk}` is not a numpy array")
else:
if cast_strings and vv.dtype.kind in "SU":
data[kk] = np.array(vv, dtype=object)
self._index = index
self._count_sep = count_sep
self._offset_sep = offset_sep
Expand All @@ -237,6 +241,7 @@ def __init__(
self._nrows = nrows.pop()
self.rows = _RowView(self)
self.cols = _ColView(self)
self.header = header

def to_pandas(self, index=None, columns=None):

Expand Down

0 comments on commit 10766f6

Please sign in to comment.