How to Remove None Values from a List in Python

To remove None values from a list in Python, use a list comprehension with is not None. It returns a new list without None and keeps zeros and empty strings:

clean = [x for x in items if x is not None]

Every output below came from a real run on Python 3.12.5 and pandas 3.0.6 in the Windows Command Prompt.

Remove None from a list with a list comprehension

Here’s a week of store sales where two days never reported:

# Daily sales, Mon Oct 5 to Sun Oct 11, 2026 (None = register didn't report)
daily_sales = [1250.00, None, 980.50, 0.0, None, 1430.25, 615.75]

clean = [amount for amount in daily_sales if amount is not None]
print(clean)
print(f"Week total: ${sum(clean):,.2f}")
print(daily_sales)

Output:

[1250.0, 980.5, 0.0, 1430.25, 615.75]
Week total: $4,276.50
[1250.0, None, 980.5, 0.0, None, 1430.25, 615.75]
Command Prompt output of a Python list comprehension removing None values from a list of daily sales
The None days are gone, the $0.00 day stays, and the original list is unchanged.

I like this form because 0.0 survives; a real $0.00 day isn’t missing data. If you want an else branch in the expression, see list comprehensions with if-else in Python.

Why shouldn’t you filter None with a plain if x or filter(None)?

A bare if v tests truthiness, not None, so it also drops 0, "", False and empty lists. filter(None, values) does the same. A lambda with is not None is the safe filter() form:

values = [0, None, 12.5, "", False, "Austin", [], None]

print("is not None: ", [v for v in values if v is not None])
print("filter lambda:", list(filter(lambda v: v is not None, values)))
print("truthy only: ", [v for v in values if v])
print("filter(None):", list(filter(None, values)))

Output:

is not None:  [0, 12.5, '', False, 'Austin', []]
filter lambda: [0, 12.5, '', False, 'Austin', []]
truthy only:  [12.5, 'Austin']
filter(None): [12.5, 'Austin']
Command Prompt output comparing is not None with a truthy filter and filter(None) on a Python list with zeros and empty strings
The first two lines keep 0, the empty string, False and the empty list; the truthy filters drop them all.

Use the shorter form only when every falsy value should go. The two None tests are compared in is None vs == None in Python.

How do you remove None from the same list in place?

A comprehension makes a new list. If other code holds the old one, assign through a slice with items[:] = ... so every name sees the change:

orders = ["A-101", None, "A-102", None, "A-103"]
report = orders                       # a second name for the same list
orders[:] = [o for o in orders if o is not None]
print(orders, report, orders is report)

queue = ["TX", None, "CA", None]
while None in queue:
    queue.remove(None)
print(queue)

Output:

['A-101', 'A-102', 'A-103'] ['A-101', 'A-102', 'A-103'] True
['TX', 'CA']
Command Prompt output of Python removing None in place with slice assignment and a while loop with remove()
Slice assignment cleans the list both names point to, and the while loop with remove() empties out None one at a time.

The while loop works too, but it rescans the list each pass, so it’s slow on big lists. The same ideas apply to removing all instances of an element from a list.

Remove None from nested lists and dictionaries

For nested lists or JSON-style data, a small recursive function cleans every level:

def drop_none(data):
    if isinstance(data, list):
        return [drop_none(x) for x in data if x is not None]
    if isinstance(data, dict):
        return {k: drop_none(v) for k, v in data.items() if v is not None}
    return data

print(drop_none([[72, None, 75], [None, None], [68, None]]))
customer = {"name": "Emily Carter", "phone": None,
            "orders": [1001, None, 1002], "zip": "02134"}
print(drop_none(customer))

Output:

[[72, 75], [], [68]]
{'name': 'Emily Carter', 'orders': [1001, 1002], 'zip': '02134'}

The all-None row becomes [] and the phone key disappears. If you’d rather end up with one flat list, flatten the list of lists after cleaning it.

Replace None instead of removing it, or use pandas

Dropping values shifts positions, which matters when the index means a date. And sum() fails on None:

import pandas as pd

temps = [71.5, None, 73.0, None, 69.5]
try:
    print(sum(temps))
except TypeError as err:
    print("TypeError:", err)

print([t if t is not None else 0.0 for t in temps])
print(round(pd.Series(temps).mean(), 2))   # pandas skips None

Output:

TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'
[71.5, 0.0, 73.0, 0.0, 69.5]
71.33
Command Prompt output of Python sum failing on None, replacing None with 0.0, and a pandas mean that skips None
sum() raises a TypeError, the replacement keeps all five positions, and pandas averages only the three real readings.

pandas treats None as missing. For NaN itself, see removing NaN values from a list in Python, and for tables, converting a list to a pandas DataFrame.

Want more list practice? Try these next:

Frequently asked questions

How do I remove None from a list in Python?

Use [x for x in items if x is not None]. It keeps every other value.

Does filter(None, list) remove only None?

No. It removes every falsy value, so 0, empty strings and False go too.

How do I remove None from a list without creating a new list?

Assign through a slice: items[:] = [x for x in items if x is not None].

Why does sum() fail on a list with None?

Python can’t add a number to None, so it raises a TypeError. Remove or replace None first.

How do I replace None with 0 in a list?

Use [x if x is not None else 0 for x in items], which keeps the list length.

Where is filter() documented?

See filter() in the Python docs.