0

I have a dataset like below. Some of the attributes are in object type data. I want to convert them to numeric tye data. but when I use pd.to numeric function, all the object type data converts to 'nan'

                                          Flow ID    Source IP  ...  Idle Min   Class
    523320       10.42.0.211-10.42.0.1-3145-53-17  10.42.0.211  ...         0  BENIGN
    502082       10.42.0.151-10.42.0.1-9436-53-17  10.42.0.151  ...         0  BENIGN
    579158  192.229.173.173-10.42.0.42-80-50469-6   10.42.0.42  ...         0  BENIGN
    59163       10.42.0.211-10.42.0.1-39702-53-17  10.42.0.211  ...         0  Malwre
    217478       10.42.0.151-10.42.0.1-4616-53-17  10.42.0.151  ...         0  Malwre

The data type is shown below

    Flow ID              object
    Source IP            object
    Source Port           int64
    Destination IP       object
    Destination Port      int64

    Idle Mean           float64
    Idle Std            float64
    Idle Max              int64
    Idle Min              int64
    Class                object

Now I want to use all my data and convert all the data into int or float.

0 Answers0