I have DF with float street numbers, sometime it is "NaN" or "x-y" (ex: 30-32) but often x.y (ex: 32.0 instead of 30) I need to change this to int (if there is no "-" in the number of course). Ive tried
chunk.loc["-" not in chunk["Street Number"] & chunk["Street Number"].notna(), 'Street Number'] = chunk["Street Number"].astype(int)
I know there is an issue after my "=" sign. How to update dataframe value conditionaly with its own value please ? Ive also tried with
chunk[["Street Number"]].astype(int)
There is no error
Sample of DF :
0 | NaN
1 | 1.0
2 | 6.0
3 | 170.0
4 | 61.0
5 | 51-52
I tried to force dtype "Street Number": np.uint16 but I got ValueError: Integer column has NA values in column 12