CodeNinjaPI
CodeNinjaPI

Reputation: 104

How do I replace all NaNs in a pandas dataframe with the string "None"

I have a dataframe and some of them are empty. I want to make it a None string so I can parse it easier than a NaN value.

Upvotes: 0

Views: 39

Answers (1)

kninjaboi
kninjaboi

Reputation: 201

df = df.replace(np.nan, 'None', regex=True)

Use the code above.

Upvotes: 1

Related Questions