You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a function called to_field which accepts something that can be coerced into a Numpy array and returns a new field containing that data. Other arguments such as dtype may be needed. The method should use np.asarray to coerce the input to an array. The dtype of the array should be checked to see if it's a known type, if not raise an exception.
For example:
n=np.random.rand(10,dtype=np.float32)
f=exetera.core.fields.to_field([1,2,3]) # using asarray this can be used to create a field from Python array dataf=exetera.core.fields.to_field(n) # returns a new field containing float32f1=exetera.core.fields.to_field(n) +n# allows adding numpy arrays to the new field
Do we want a to_categorical_field as well?
The text was updated successfully, but these errors were encountered:
Create a function called
to_field
which accepts something that can be coerced into a Numpy array and returns a new field containing that data. Other arguments such asdtype
may be needed. The method should usenp.asarray
to coerce the input to an array. The dtype of the array should be checked to see if it's a known type, if not raise an exception.For example:
Do we want a
to_categorical_field
as well?The text was updated successfully, but these errors were encountered: