Yes, your loop-based solution works fine, but if you're looking for a more "pandastic", vectorized, and concise approach, you can leverage df.update()
along with pd.concat
and dictionary comprehension to achieve the same result in a more elegant way.