MKHN15
MKHN15

Reputation: 31

How to convert DataFrame columns to float and permanently keep it that way

So I was successfully able to change the strings to float, but I want it to permanently stay that way, something like a inplace=True. However, I wasn't able to do the inplace=True and receive an error when I try. Basically I want to see the changes kept in place when I do nba.head().

I would appreciate all help :).

nba[["G","GS","MP"]] = nba[["G","GS","MP"]].apply(pd.to_numeric)

Upvotes: 0

Views: 886

Answers (1)

Corralien
Corralien

Reputation: 120429

Try:

nba[["G","GS","MP"]] = nba[["G","GS","MP"]].astype(float)

Upvotes: 1

Related Questions