I have a daframe with several columns but some of them starts with test_
Below a sample with ONLY these test_ columns:
c = pd.DataFrame({'test_pierce':[10,30,40,50],'test_failure':[30,10,20,10] })
What I need to do:
For every column in my dataframe that starts with test_ I want to create another column just after to classify it's value like this:
if test_ > 30.0:
Y
else:
N
To get this output:
d = pd.DataFrame({'test_pierce':[10,30,40,50],'class_test_pierce':['N','N','Y','Y'],'test_failure':[30,10,20,10], 'class_test_failure':['N','N','N','N'] })
What I did:
I have the columns I need to classify:
cols = [c for c in c.columns if c.startswith('test_')]
I couldn't proceed from here tho
