-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Description
Calling astype on a Data object with singleton entries yields an error. To reproduce, use:
data = tsc.loadExample('fish-series')
data.seriesMean().astype('int').first()
The error is TypeError: astype() takes no keyword arguments. It appears that when calling astype on a numpy.float64 (or other scalar), it doesn't take the same any additional arguments that work when calling it on an array. For example,
x = np.array([1.0,2.0,3.0])
x.astype('int', casting='unsafe')
works fine but this doesn't
x = np.float64(1.0)
x.astype('int', casting='unsafe')
One potential solution would be to check the length of the index before calling astype, and to only include the additional arguments if it's greater than 1.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels