Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datashader/datashape/coretypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def from_numpy_dtype(self, dt):
elif np.issubdtype(dt, np.timedelta64):
unit, _ = np.datetime_data(dt)
return TimeDelta(unit=unit)
elif np.issubdtype(dt, np.unicode_):
elif np.__version__[0] < "2" and np.issubdtype(dt, np.unicode_):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does numpy2 not have nay unicode dtypes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the recommendation is to use np.str_ instead, but this is checked further down, which is why I did it this way.

https://numpy.org/devdocs/numpy_2_0_migration_guide.html

return String(dt.itemsize // 4, 'U32')
elif np.issubdtype(dt, np.str_) or np.issubdtype(dt, np.bytes_):
return String(dt.itemsize, 'ascii')
Expand Down