I know Python (but not Pandas), and that question looks fine to me. You have a single specific problem, and you've shown us what you've currently tried. It gives the desired output, but you want to know if there's a better way (more readable &/or more efficient). That's fine, question code on SO isn't required to be broken, IMHO. Because your question is focused it means that possible answers can also be focused.
However, if you posted a complete application that does a whole bunch of different things, and you wanted us to improve the whole program, then the question would not be a good fit for Stack Overflow. That's essentially a bunch of different SO questions bundled together, and while each item in the bundle may be useful to future readers the whole bundle is unlikely to be so.
The bottom line is that we want questions where the answers are likely to help multiple future readers as well as the OP.
We sometimes get complete but broken programs posted by new coders, where their code has several unrelated problems, and all of those problems need to be fixed in order to achieve a working program. That's not a great fit for SO, but it's tolerable (IMHO) when the code is for a small homework exercise. It can be very instructive for a student to see a working version of their code, with brief explanations of what they were doing wrong. And such answers can be helpful to other students in the future.
OTOH, there are a handful of common problems that arise in such code, and there's no real need to write a new specific answer because a good duplicate target already exists, eg Asking the user for input until they give a valid response. Of course, there's a good chance that there are existing questions with nice solutions about the same (or very similar) homework problem, in which case the new question should be closed as a dupe, although in some cases it may be useful to write a short specific answer for the new question.