Really, we can't help you: we have no access to yoru code or the data it is working with.
But two weeks for a single line of text looks like a problem to me - and it's either your code or the data it's working with that is at fault.
So start debugging it: pdb — The Python Debugger — Python 3.10.4 documentation
] may help to start working out where the problem is, but it needs access to your code while it's running and with your data to even begin working anything out. Even then, it's probably going to take quite a bit of time to work out where the problem is, let alone how to fix it!
Good luck - but we can't do anything for you.