Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

02.2 Comparison of isolated and CV methods.ipynb , ML_isolated(train,test,output_csv,features,step,flexible,i) give me error ValueError: could not convert string to float: 'b' #6

Open
AhmedmostafaElabdli1 opened this issue Apr 7, 2024 · 1 comment

Comments

@AhmedmostafaElabdli1
Copy link

image

and i found in altro train IOTDevID csv data
image

@kahramankostas
Copy link
Owner

Thank you very much for bringing attention to this issue. As you mentioned, the error stems from the presence of "b" values in the CSV files. To address this, we have developed a small script that replaces the "b" values with 0. You can locate this script in the root of the repository under the name b-error-fixer.ipynb.
We greatly appreciate your contribution and assistance in resolving this issue.
Thank you once again.

#!/usr/bin/env python
# coding: utf-8

# In[8]:


import os
import pandas as pd
from tqdm import tqdm
import warnings
warnings.filterwarnings('ignore')
def find_the_way(path,file_format):
    files_add = []
    # r=root, d=directories, f = files
    for r, d, f in os.walk(path):
        for file in f:
            if file_format in file:
                files_add.append(os.path.join(r, file))  
    return files_add
files_add=find_the_way('./CSVS','.csv')
files_add


# In[9]:


for i in  tqdm(files_add):
    df=pd.read_csv(i)
    df.replace('b', 0, inplace=True)
    df.to_csv(i,index=False)
    #print(i)```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants