df = df.replace({np.nan: None})

Note: For pandas versions <1.4, this changes the dtype of all affected columns to object.
To avoid that, use this syntax instead:

df = df.replace(np.nan, None)

Note 2: If you don't want to import numpy, np.nan can be replaced with native float('nan'):

df = df.replace({float('nan'): None})

Credit goes to this guy here on this Github issue, Killian Huyghe's comment and Matt's answer.

Answer from EliadL on Stack Overflow
🌐
Arab Psychology
scales.arabpsychology.com › home › how to easily replace nan with none in your pandas dataframe
How To Easily Replace NaN With None In Your Pandas DataFrame
November 22, 2025 - To restrict the replacement operation to one or more specific columns, we apply the replace() method directly to the selected Pandas Series (column). This maintains the integrity and efficiency of the remaining columns. If the goal is to perform this targeted replacement on several columns simultaneously, you can iterate through a list of column names or apply the replacement using a dictionary passed to the DataFrame’s replace() method, specifying different replacements for different columns, though for simplicity here, we focus on replacing np.nan with None in a single column.
Discussions

Replace None with NaN in pandas dataframe - Stack Overflow
I want to replace python None with pandas NaN. I tried: ... TypeError: 'regex' must be a string or a compiled regular expression or a list or dict of strings or regular expressions, you passed a 'bool' ... You can use DataFrame.fillna or Series.fillna which will replace the Python object None, ... More on stackoverflow.com
🌐 stackoverflow.com
python - Pandas Replace NaN with blank/empty string - Stack Overflow
I have a Pandas Dataframe as shown below: 1 2 3 0 a NaN read 1 b l unread 2 c NaN read I want to remove the NaN values with an empty string so that it looks like so:... More on stackoverflow.com
🌐 stackoverflow.com
python - How to replace NaN values in a dataframe column - Stack Overflow
I have a Pandas Dataframe as below: itm Date Amount 67 420 2012-09-30 00:00:00 65211 68 421 2012-09-09 00:00:00 29424 69 421 2012-09-16 00:00:00 29877 70 421 More on stackoverflow.com
🌐 stackoverflow.com
BUG: Replacing NaN with None in Pandas 1.3 does not work
I have checked that this issue has not already been reported. I have confirmed this bug exists on the latest version of pandas. (optional) I have confirmed this bug exists on the master branch of p... More on github.com
🌐 github.com
10
July 7, 2021
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.fillna.html
pandas.DataFrame.fillna — pandas 3.0.2 documentation
For Series this parameter is unused and defaults to 0. ... If True, fill in-place. Note: this will modify any other views on this object (e.g., a no-copy slice for a column in a DataFrame). ... This is the maximum number of entries along the entire axis where NaNs will be filled. Must be greater than 0 if not None...
🌐
Statology
statology.org › home › pandas: how to replace nan with none
Pandas: How to Replace NaN with None
December 1, 2022 - This tutorial explains how to replace NaN values with a None value in a pandas DataFrame, including an example.
🌐
Bobby Hadz
bobbyhadz.com › blog › replace-none-with-nan-in-pandas
How to replace None with NaN in Pandas DataFrame | bobbyhadz
April 11, 2024 - You can use the pandas.DataFrame.fillna() method to replace None with NaN in a pandas DataFrame.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › replacing-pandas-or-numpy-nan-with-a-none-to-use-with-mysqldb
Replacing Pandas or Numpy Nan with a None to use with MysqlDB - GeeksforGeeks
July 23, 2025 - The resulting DataFrame 'replaced_df' contains 'None' in place of 'NaN' values. ... import pandas as pd import numpy as np df = pd.DataFrame({'A': [1, np.nan,3], 'B': [np.nan, 5, 6], 'C': [7, 8, np.nan]}) replaced_df = df.replace({np.nan: None}) print(replaced_df)
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.Series.fillna.html
pandas.Series.fillna — pandas 3.0.1 documentation - PyData |
For Series this parameter is unused and defaults to 0. ... If True, fill in-place. Note: this will modify any other views on this object (e.g., a no-copy slice for a column in a DataFrame). ... This is the maximum number of entries along the entire axis where NaNs will be filled. Must be greater than 0 if not None...
🌐
Note.nkmk.me
note.nkmk.me › home › python › pandas
pandas: Replace NaN (missing values) with fillna() | note.nkmk.me
February 1, 2024 - Replace NaN with adjacent values: ffill(), bfill() The method argument in fillna() Modify the original object: inplace · fillna(), ffill(), and bfill() on pandas.Series · While this article primarily deals with NaN (Not a Number), it is important to note that in pandas, None is also treated as a missing value.
🌐
Arab Psychology
scales.arabpsychology.com › home › how to easily replace nan values with zero in pandas using fillna()
How To Easily Replace NaN Values With Zero In Pandas Using Fillna()
December 4, 2025 - Finally, recall the alternative method mentioned earlier: replace(). While df.replace(np.nan, 0) works, fillna() is specifically optimized for null handling, making it the more efficient and semantically correct choice for managing NaN values generated by Pandas or NumPy. Mastering these targeted imputation techniques is crucial for efficient and reliable data wrangling within the Pandas environment. To summarize the flexible methods available for handling missing data, the choice of syntax depends entirely on the scope of the required modification: Single Column Imputation: Use bracket notation to select the Series, apply .fillna(0), and reassign the result (df['col'] = df['col'].fillna(0)).
🌐
Note.nkmk.me
note.nkmk.me › home › python › pandas
Missing values in pandas (nan, None, pd.NA) | note.nkmk.me
August 2, 2023 - If you want to treat certain values as missing, you can use the replace() method to replace them with float('nan'), np.nan, or math.nan. pandas: Replace values in DataFrame and Series with replace()
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas replace nan with blank/empty string
Pandas Replace NaN with Blank/Empty String - Spark By {Examples}
November 19, 2024 - In this pandas DataFrame article, ... strings using several ways with examples. ... Use fillna('') to replace NaN values with an empty string in a DataFrame or Series....
🌐
JanBask Training
janbasktraining.com › community › data-science › pandas-replace-nan-with-none
Replace None with NaN in pandas dataframe | JanBask Training Community
July 8, 2021 - How pandas replace nan with none? How should I go about it? ... Use DataFrame.fillna or Series.fillna which will help in replacing the Python object None, not the string 'None'.
🌐
Finxter
blog.finxter.com › home › learn python blog › 5 best ways to replace nan with none in python lists
5 Best Ways to Replace NaN with None in Python Lists - Be on the Right Side of Change
February 16, 2024 - import pandas as pd original_series = pd.Series([1.2, 3.4, float('nan'), 4.5]) clean_series = original_series.fillna(None) print(clean_series) ... This snippet takes a Pandas Series object and replaces all occurrences of nan with None using fillna().
🌐
GitHub
github.com › pandas-dev › pandas › issues › 42423
BUG: Replacing NaN with None in Pandas 1.3 does not work · Issue #42423 · pandas-dev/pandas
July 7, 2021 - >>> import pandas as pd >>> import numpy as np >>> df = pd.DataFrame([0.5, np.nan]) >>> df.where(pd.notnull(df), None) 0 0 0.5 1 NaN · Replacing NaN values with None (or any other Python object) should work as in previous Pandas versions. >>> import pandas as pd >>> import numpy as np >>> df = pd.DataFrame([0.5, np.nan]) >>> df.where(pd.notnull(df), None) 0 0 0.5 1 None ·
Author   pvieito
🌐
IARP
iarp.github.io › python › pandas-replace-nan-nat-with-none.html
Pandas replace all NaN and NaT values with None | IARP
View On GitHub · GitHub Profile · Pandas replace all NaN and NaT values with None · data.replace({pandas.NaT: None}, inplace=True) · Hosted on GitHub Pages using the Dinky theme
🌐
Pandas
pandas.pydata.org › pandas-docs › stable › reference › api › pandas.Series.replace.html
pandas.Series.replace — pandas 3.0.0 documentation
For a DataFrame nested dictionaries, e.g., {'a': {'b': np.nan}}, are read as follows: look in column ‘a’ for the value ‘b’ and replace it with NaN. The optional value parameter should not be specified to use a nested dict in this way. You can nest regular expressions as well. Note that column names (the top-level dictionary keys in a nested dictionary) cannot be regular expressions. ... This means that the regex argument must be a string, compiled regular expression, or list, dict, ndarray or Series of such elements. If value is also None then this must be a nested dictionary or Series.
🌐
Saturn Cloud
saturncloud.io › blog › how-to-replace-none-with-nan-in-pandas-dataframe
How to Replace None with NaN in Pandas DataFrame | Saturn Cloud Blog
January 16, 2024 - This is a common task when working with data, as NaN values are often used to represent missing data in Pandas. In this article, we will explore the various methods to replace None with NaN in a Pandas DataFrame.