thank you in advance for your help. I have a dataset with columns that contain string values. For example, the flg column contains e, e*, e s, and e g, and the saddr and daddr columns contain IP addresses. The dataset contains two missing values. I used the fillna() methods and replaced the values with 0. To convert the string values to numeric, to.numeric() where I removed the space between letters and then used the fillna(0). However, when I previewed my data, the values in these columns were replaced with 0. I tried using the mean() and ffill, but I receive 'ValueError: Input contains NaN, infinity or a value too large for dtype('float64'). I am not sure what I am doing wrong.
dataframe1.fillna(0, inplace=True)
# Convert string values to numeric values
columns = ['flgs', 'proto', 'saddr', 'daddr', 'state', 'category', 'subcategory']
for x in columns:
dataframe1[x] = pd.to_numeric(dataframe1[x].str.replace(' ', ''), errors = 'coerce').fillna(0)