This time to bring you an object how to convert to float data, object conversion to float data note what, the following is the actual case, take a look.
Data type conversions:
Today, there is a problem, that is, the dataframe type of data is the STR type number, want to convert the number to int or float; Baidu did not find good, may also enter the key words are not found;
Dataframe.info () After the discovery data is all object
One way before that is:
First Traindata=np.array (traindata,dtype=np.float) after the
TRAINDATA=PD. DataFrame (traindata) conversion
But look very cumbersome, whim, try to the following method, a sentence on the proud Pride
TRAINDATA=PD. DataFrame (Traindata,dtype=np.float), the inside of the float can also be converted to int, estimated that the other is ok but did not try!
Re-enter Dataframe.info () try, object all become int, done!
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
2018 PHP Real-Combat development function Summary Daquan
A detailed explanation of v-for iterative grammar in Vue2.0
V-for index in HTML how to use