In [17]: a[a != np.array(None)]
Out[17]: array([1, 45, 23, 23, 1234, 3432, -1232, -34, 233], dtype=object)

The above works because a != np.array(None) is a boolean array which maps out non-None values:

In [20]: a != np.array(None)
Out[20]: array([ True,  True,  True,  True,  True,  True,  True,  True,  True, False], dtype=bool)

Selecting elements of an array in this manner is called boolean array indexing.

Answer from John1024 on Stack Overflow
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: Remove NaN (np.nan) from an array | note.nkmk.me
January 23, 2024 - In NumPy, to remove rows or columns containing NaN (np.nan) from an array (ndarray), use np.isnan() to identify NaN and methods like any() or all() to extract rows or columns that do not contain NaN. ...
🌐
Stack Overflow
stackoverflow.com › questions › 72377041 › removing-nones-array-from-numpy-array
python - Removing None's array from numpy array - Stack Overflow
I have numpy array a = np.array([[None, None],[72,10][None,None][77,10]]) I would like remove [None, None] from numpy array. Is there an efficient way to remove Nones array from numpy arrays and r...
🌐
ProjectPro
projectpro.io › recipes › drop-all-missing-values-from-numpy-array
How to remove nan values from numpy array - Projectpro
December 23, 2022 - Droping the missing values or nan values can be done by using the function "numpy.isnan()" it will give us the indexes which are having nan values and when combined with other function which is "numpy.logical_not()" where the boolean values ...
🌐
Statology
statology.org › home › how to remove nan values from numpy array (3 methods)
How to Remove NaN Values from NumPy Array (3 Methods)
May 27, 2022 - Since NaN values are not finite, they’re removed from the array. The following code shows how to remove NaN values from a NumPy array by using the logical_not() function:
🌐
CodeSpeedy
codespeedy.com › home › remove null values from a numpy array in python
Remove null values from a numpy array in Python - CodeSpeedy
January 8, 2020 - In the second step, we remove the null values where em.nan are the null values in the numpy array from the array. Inside the function of em.isnan return a logical array True when arr is not a number.
🌐
w3resource
w3resource.com › python-exercises › numpy › python-numpy-exercise-91.php
NumPy: Remove all rows in a NumPy array that contain non-numeric values - w3resource
August 29, 2025 - # Importing the NumPy library and aliasing it as 'np' import numpy as np # Creating a NumPy array 'x' containing various data types including integers, NaN (Not a Number), and booleans x = np.array([[1, 2, 3], [4, 5, np.nan], [7, 8, 9], [True, False, True]]) # Printing a message indicating the original array will be displayed print("Original array:") # Printing the original array 'x' with its elements print(x) # Printing a message indicating the removal of all non-numeric elements from the array print("Remove all non-numeric elements of the said array") # Removing rows that contain NaN (Not a Number) using np.isnan to check for NaN and 'any' along axis 1 (rows) # The '~' operator negates the boolean array to select rows where there are no NaN values result = x[~np.isnan(x).any(axis=1)] # Printing the resulting array after removing rows with non-numeric elements print(result)
Find elsewhere
🌐
YouTube
youtube.com › watch
Remove rows with Null values in Numpy Array - Python Numpy Tutorial - YouTube
Watch Video to understand How to remove rows which contains Null values in a Numpy Array? #numpyarray #settingnullvaluesinanumpyarray #nullvalues #howtoremo...
Published: October 29, 2022
🌐
PyTutorial
pytutorial.com › remove-none-from-list-and-array-in-python-examples
PyTutorial | Remove None From List, List of List and Array In Python (Examples)
April 18, 2023 - # Example of using the delete() function to remove None values from an array import numpy as np my_array = np.array([1, None, 2, None, 3, None, 4]) new_array = np.delete(my_array, np.where(my_array == None)) print(new_array)
🌐
Delft Stack
delftstack.com › home › howto › numpy › numpy remove element from array
How to Remove Elements From Array in NumPy | Delft Stack
February 2, 2024 - The arr is the NumPy array we wish to delete elements from. obj is a list of integer numbers. These numbers represent the indexes of the elements that should be deleted from the array. Lastly, the axis is an optional argument. axis refers to the axis along which the elements targetted by the obj should be deleted. If a None value is assigned to this parameter, arr is flattened, and deletion is carried out on this flattened array.
🌐
w3resource
w3resource.com › numpy › manipulation › delete.php
NumPy: numpy.delete() function - w3resource
April 25, 2026 - In the second example, np.delete(arr, [1, 2, 5], None) removes the elements with indices 1, 2, and 5 from the arr array along both rows and columns because the None argument is used for the second argument, which means the operation is performed ...
🌐
GitHub
github.com › numpy › numpy › issues › 12952
numpy.delete None · Issue #12952 · numpy/numpy
February 11, 2019 - It would be great if numpy.delete supported None as obj. In that case, the array is returned as is. Code example: import numpy as np x = [1, 2, 3, ] np.delete(x, None) # [1, 2, 3]
Author: numpy
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.2 Manual
A copy of arr with the elements specified by obj removed. Note that delete does not occur in-place. If axis is None, out is a flattened array.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-remove-nan-values-from-a-given-numpy-array
How to remove NaN values from a given NumPy array? - GeeksforGeeks
September 7, 2022 - Many times NumPy arrays may contain NaN values that need to be removed to ensure the array is free from unnecessary or invalid data. This can be achieved using the np.isnan() function along with the Bitwise NOT operator.
🌐
DataCamp
datacamp.com › doc › numpy › delete-numpy
NumPy delete()
If `axis` is `None`, the array is flattened before deletion. Note: The `obj` parameter can be an integer, a list of integers, or a slice object. The `np.delete()` function does not operate in-place; it returns a new array and leaves the original array unmodified. import numpy as np arr = np.array([1, 2, 3, 4, 5]) new_arr = np.delete(arr, 2) print(new_arr) This example removes the element at index `2` from the 1D array, resulting in `[1, 2, 4, 5]`.
🌐
Finxter
blog.finxter.com › home › learn python blog › how to remove specific elements in a numpy array
How to Remove Specific Elements in a Numpy Array - Be on the Right Side of Change
June 4, 2022 - arr represents the numpy array ... the column. axis = 0 indicates deletion of elements across the rows. If axis = None, then flatten the given array before applying delete on it....
🌐
NumPy
numpy.org › doc › 1.25 › reference › generated › numpy.delete.html
numpy.delete — NumPy v1.25 Manual
A copy of arr with the elements specified by obj removed. Note that delete does not occur in-place. If axis is None, out is a flattened array.