As shown in figure, why not here '+ years' instead of' \ + years'? Thank you!
CodePudding user response:
You are using is pandas Series, the Series of STR attribute is not string, but the pandas StringMethods> The import pandas as pd
> A=pd. Series ([' 10 + years'])
> A.u actress-comedian ()
Array ([' 10 + years'], dtype=object)
> Type (a)
So you here with the replace is a function of pandas library encapsulation, rather than the STR function, if you are directly to STR operations, then you should use the replace (' + years', ')