I have a python data frame with a column called "accredited This column should have the data of accreditation: "10/10/2011" Or put: "Not accredited" But in most of the cases when isn't accredited the column have some text, like: "This business is not accredited....." I want to replace the whole text and just put: "Not accredited"
Now, I wrote a function:
def notAcredited(string):
if ('Not' in string or 'not' in string):
return 'Not Accredited'
I'm implementing the function with a loop, is possible to do this with the ".apply" method?
for i in range(len(df_1000_1500)):
accreditacion = notAcredited(df_1000_1500['BBBAccreditation'][i])
if accreditacion == 'Not Accredited':
df_1000_1500['BBBAccreditation'][i] = accreditacion