Avoid dtype=object
Using dtype=object to store strings is one of the most error-prone and inefficient things you can do in pandas. Unfortunately, for the longest time, dtype=object was the only way to work with string data; this wasn’t “solved” until the 1.0 release.
I intentionally put “solved” in quotes because, while pandas 1.0 did introduce the pd.StringDtype(), it was not used by default by many construction and I/O methods until the 3.0 release. In effect, unless you told pandas otherwise, you would end up with dtype=object for all your string data in the 2.x series. For what it’s worth, the pd.StringDtype() that was introduced in 1.0 helped to assert you only stored strings, but it was never optimized for performance until the pandas 3.0 release.
If you are using the 3.0 release of pandas and beyond, chances are you will still come across legacy code that reads like ser = ser.astype(object). More often than not, such calls should...