Help! How to convert object type to unit8 type in python?

clipboard.png
"0"

clipboard.png
then I use dtypes to look at the data type and find that it is of object type. I want to convert these two columns to the same unit8 type as the data type in the blue mine. How can I change it? I"ve tried a lot of things, but they didn"t work. Ask the gods for advice!

Mar.06,2021

maybe you should use astype :

   

Hello, God. I modified it in the way you provided, but it reminds me that there is no unit8 attribute in numpy. What's going on? I'm already leading the bag at the front, too.

Menu