'How to remove the '\t' delimiter from the Column in dataframe with mostly float type values

I have in my Dataframe Float type columns with few '\t' while all other values are float type.

I cannot remove them without making them the float values 'NaN'. I used following command, then all the float values become NaN.

df["col"] = df["col"].str.replace("\t","")

[1]: https://i.stack.imgur.com/Btx9k.png

I tried few other things as well (like astype(float), isnumeric() etc.) but nothing seem to work. I know it seems like a simple thing, but I am unable to solve.



Solution 1:[1]

I have found the solution which is as follows

for r in range(0,len(df)):
    if type(df['col_name'][r]) == str:
        df['col_name'][r] = df['PCC PHY Throughput DL_All Logs'][r].replace("\t", "") 
        # If want to convert to NaN so that later drop it, uncomment the following and comment the above line          
        #df['PCC PHY Throughput DL_All Logs'][r] = np.nan

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SJa