Issue
I want to be able to calculate the mean, min and max of A
:
import numpy as np
A = ['33.33', '33.33', '33.33', '33.37']
NA = np.asarray(A)
AVG = np.mean(NA, axis=0)
print AVG
This does not work, unless converted to:
A = [33.33, 33.33, 33.33, 33.37]
Is it possible to perform this conversion automatically?
Solution
you want astype
NA = NA.astype(float)
Answered By - gzc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.