Substring Index Python Pandas Interview Question