I have specified the data type as int64 while making array of id column. But still I get it as float in my csv file. And i am also not getting full acuracy in this challenge. Plss Help
Here is my code-
I have specified the data type as int64 while making array of id column. But still I get it as float in my csv file. And i am also not getting full acuracy in this challenge. Plss Help
Here is my code-
Hey @sanchit123manchanda, you can use the .astype function on a particular column of your dataframe as follows :
dataframe = dataframe.astype({'col_name_1':'uint8','col_name_2':'int32', etc. ...})
Hope this helps
OK, but can you tell me why the idx column is float and not int even when i have declared its dtype as int64.
This is because you are combining it with pred and pred is of type float32. Try running this code :
idx = np.arange(0,100,dtype = 'int64')
idx =idx.reshape((-1,1))
print(idx)
You would see that idx that you will get is of datatype integer only.
when you stack 2 numpy arrays together(having different datatypes) , the datatype having more priority will get set for both the columns. So here in your code, int64 of idx column will be changed to float32 of pred.
Hope this helps.
Happy Learning