0

I want to change all columns of type object to str and I do not understand why this command does not work:

df.select_dtypes(include=["object"]) = df.select_dtypes(include=
["object"]).astype(str)
Muntram van Chen
  • 403
  • 1
  • 5
  • 10

1 Answers1

0

It does not work, because obviously object dtype is string.

You can test it by:

print (df.select_dtypes(include=["object"]).applymap(type))
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252