I have a data-frame:
df = pd.DataFrame({"ID": [1,2,3,4,5,6,7], "value": [10,10.00,"123JK",20,10-11,11.00,12.00]})
ID value
1 10
2 10.00
3 123JK
4 20
5 10-11
6 11.00
7 12.00
I want to convert only the floating value to integer such that:
ID value
1 10
2 10
3 123JK
4 20
5 10-11
6 11
7 12
I tried following code:
df['ID'] = df['ID'].apply(pd.to_numeric, errors='ignore')
df['ID'].astype(np.int64,errors='ignore')
But It does not convert all the floating value to integer.