Maybe this discussion can give you a clearer understanding of what the function does. Did you read this? (especially the last section) https://pandas.pydata.org/docs/reference/api/pandas.errors.DtypeWarning.html