I have the following column in my dataframe:
Column1 Column2 Column3 Column4
a 1 2 a
1 2 a c
b 3 c d
3 2 1 b
4 2 1 a
c 1 d a
The type of these columns is object, I would like to convert Column1, Column2 and Column3 to numeric type int8 while keeping Column4 as type object. To do so, I had tried to use pd.to_numeric(data.Column1) (I was planning to do the same after with Column2 and Column3) but I get the following error:
ValueError: Unable to parse string "a" at position 0
Which is obvious why it is happening. I was wondering if there is any way that would allow me to get rid of of that rows formed by strings in these 3 columns so after that, I would get:
Column1 Column 2 Column 3 Column 4
3 2 1 b
4 2 1 a
Is there a way to achieve so? Or is there another way that would allow me to?
Edit: I have checked the question in Remove non-numeric rows in one column with pandas, but it didn't solve my problem, as I have more columns in my dataset than just two and one of them I don't want to convert it to numeric.