🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 121 (from laksa029)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

📄
INDEXABLE
CRAWLED
6 days ago
🤖
ROBOTS SERVER UNREACHABLE
Failed to connect to robots server: Operation timed out after 2002 milliseconds with 0 bytes received

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.2 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://www.skytowner.com/explore/removing_rows_containing_nan_in_a_numpy_array
Last Crawled2026-04-08 04:19:11 (6 days ago)
First Indexed2022-01-09 16:21:50 (4 years ago)
HTTP Status Code200
Meta TitleRemoving rows containing NaN in a NumPy array
Meta DescriptionTo remove rows containing NaN in a NumPy array, we can use a combination of the isnan(~) and any(~) methods.
Meta Canonicalnull
Boilerpipe Text
To remove rows containing NaN in a NumPy array, we can use a combination of the isnan(~) and any(~) methods. Example Consider the following array: np. array ([[ 1 , 2 ,np. nan ], [ 4 , 5 , 6 ]]) array([[ 1., 2., nan], [ 4., 5., 6.]]) To remove rows containing NaN : a = np. array ([[ 1 , 2 ,np. nan ], [ 4 , 5 , 6 ]]) a[~np. isnan (a). any ( axis= 1 )] array([[4., 5., 6.]]) Explanation In the above code snippet, first we are checking each element in array a for np.nan using isnan(~) : np. isnan (a) array([[False, False, True], [False, False, False]]) Next any(axis=1) returns True if at least one element in each row evaluates to True : np. isnan (a). any ( axis= 1 ) array([ True, False]) Finally, the bitwise NOT ( ~ ) operator inverts the True and False values: ~np. isnan (a). any ( axis= 1 ) array([False, True]) Now we apply this boolean mask to the original array a to return only the rows not containing NaN : a[~np. isnan (a). any ( axis= 1 )] array([[4., 5., 6.]])
Markdown
menu [home About](https://www.skytowner.com/) [store Store](https://www.skytowner.com/shop) [paid Pricing](https://www.skytowner.com/#pricing) login Log in [team\_dashboard Dashboard](https://www.skytowner.com/app) [near\_me **Linear Algebra**](https://www.skytowner.com/explore/introduction_to_vectors_in_linear_algebra) [casino **Prob and Stats**](https://www.skytowner.com/explore/population_samples_and_sampling_techniques) [function **Other math topics**](https://www.skytowner.com/explore/introduction_to_complex_numbers) [smart\_toy **Machine Learning**](https://www.skytowner.com/explore/introduction_to_linear_regression) [![](https://www.skytowner.com/images/topic_logo/pandas_mark_white.svg) **Pandas**](https://www.skytowner.com/explore/getting_started_with_pandas) [![](https://www.skytowner.com/images/topic_logo/numpy.svg) **NumPy**](https://www.skytowner.com/explore/getting_started_with_numpy) [![](https://www.skytowner.com/images/topic_logo/matplotlib.svg) **Matplotlib**](https://www.skytowner.com/explore/getting_started_with_matplotlib) [![](https://www.skytowner.com/images/topic_logo/spark.svg) **PySpark**](https://www.skytowner.com/explore/getting_started_with_pyspark) [![](https://www.skytowner.com/images/topic_logo/mysql.svg) **MySQL**](https://www.skytowner.com/explore/getting_started_with_mysql) [![](https://www.skytowner.com/images/topic_logo/dagster.svg) **Dagster (NEW)**](https://www.skytowner.com/explore/getting_started_with_dagster) [SkyTowner BETA](https://www.skytowner.com/) *search* Search Login [Unlock 100+ guides](https://www.skytowner.com/) ![]() menu *menu* [web](https://www.skytowner.com/app) [SkyTowner](https://www.skytowner.com/) *search* *toc* *close* [history\_edu Blog](https://www.skytowner.com/blog) [help Help](https://www.skytowner.com/help) Outline [Example](https://www.skytowner.com/explore/removing_rows_containing_nan_in_a_numpy_array#example)[Explanation](https://www.skytowner.com/explore/removing_rows_containing_nan_in_a_numpy_array#example/explanation) Comments Log in or [sign up](https://www.skytowner.com/signup) Cancel Post [*account\_circle* Profile]() *exit\_to\_app* Sign out What does this mean? Why is this true? Give me some examples\! search keyboard\_voice close **Searching Tips** Search for a recipe: "Creating a table in MySQL" Search for an API documentation: "@append" Search for code: "!dataframe" Apply a tag filter: "\#python" **Useful Shortcuts** / to open search panel Esc to close search panel ↑↓ to navigate between search results ⌘d to clear all current filters ⌘Enter to expand content preview ![icon\_star](https://www.skytowner.com/images/search_documentation_icon.svg) Doc Search ![icon\_star](https://www.skytowner.com/images/icon_searching_api.svg) Code Search Beta ![](https://www.skytowner.com/images/robocat/unhappy_robocat_circular.svg) SORRY NOTHING FOUND\! *mic* Start speaking... ![](https://www.skytowner.com/images/robocat/unhappy_robocat_50_50.png) Voice search is only supported in Safari and Chrome. [fullscreen\_exit]() Shrink [north\_east]() Navigate to ![](https://www.skytowner.com/images/topic_logo/numpy.svg) **NumPy** 319 guides keyboard\_arrow\_down [near\_me **Linear Algebra** 54 guides](https://www.skytowner.com/explore/introduction_to_vectors_in_linear_algebra) [casino **Prob and Stats** 38 guides](https://www.skytowner.com/explore/population_samples_and_sampling_techniques) [smart\_toy **Machine Learning** 36 guides](https://www.skytowner.com/explore/introduction_to_linear_regression) [function **Other math topics** 10 guides](https://www.skytowner.com/explore/introduction_to_complex_numbers) [![](https://www.skytowner.com/images/topic_logo/dagster.svg) **Dagster** 11 guides](https://www.skytowner.com/explore/getting_started_with_dagster) [![](https://www.skytowner.com/images/topic_logo/pandas_mark_white.svg) **Pandas** 655 guides](https://www.skytowner.com/explore/getting_started_with_pandas) [![](https://www.skytowner.com/images/topic_logo/numpy.svg) **NumPy** 319 guides](https://www.skytowner.com/explore/getting_started_with_numpy) [![](https://www.skytowner.com/images/topic_logo/matplotlib.svg) **Matplotlib** 83 guides](https://www.skytowner.com/explore/getting_started_with_matplotlib) [![](https://www.skytowner.com/images/topic_logo/spark.svg) **PySpark** 147 guides](https://www.skytowner.com/explore/getting_started_with_pyspark) [![](https://www.skytowner.com/images/topic_logo/mysql.svg) **MySQL** 295 guides](https://www.skytowner.com/explore/getting_started_with_mysql) *chevron\_left***Cookbooks** [Accessing a value in a 2D array](https://www.skytowner.com/explore/accessing_a_value_in_a_numpy_2d_array)[Accessing columns of a 2D array](https://www.skytowner.com/explore/accessing_columns_of_a_2d_numpy_array)[Accessing rows of a 2D array](https://www.skytowner.com/explore/accessing_rows_of_a_2d_numpy_array)[Calculating the determinant of a matrix](https://www.skytowner.com/explore/calculating_the_determinant_of_a_matrix_in_python)[Checking allowed values for a NumPy data type](https://www.skytowner.com/explore/checking_allowed_values_for_a_numpy_data_type)[Checking if a NumPy array is a view or copy](https://www.skytowner.com/explore/checking_if_a_numpy_array_is_a_view_or_copy)[Checking the version of NumPy](https://www.skytowner.com/explore/checking_the_version_of_numpy)[Checking whether a NumPy array contains a given row](https://www.skytowner.com/explore/checking_whether_a_numpy_array_contains_a_given_row)[Computing Euclidean distance using Numpy](https://www.skytowner.com/explore/computing_euclidean_distance_using_numpy)[Concatenating 1D arrays](https://www.skytowner.com/explore/concatenating_1d_numpy_arrays)[Converting array to lowercase](https://www.skytowner.com/explore/converting_numpy_array_to_lowercase)[Converting type of NumPy array to string](https://www.skytowner.com/explore/converting_type_of_numpy_array_to_string)[Creating a copy of an array](https://www.skytowner.com/explore/creating_a_copy_of_a_numpy_array)[Difference between Python List and Numpy array](https://www.skytowner.com/explore/difference_between_python_list_and_numpy_array)[Difference between the methods array\_equal and array\_equiv](https://www.skytowner.com/explore/difference_between_the_methods_array_equal_and_array_equiv_in_numpy)[Difference between the methods mod and fmod](https://www.skytowner.com/explore/difference_between_the_methods_mod_and_fmod_in_numpy)[Difference between the methods power and float\_power](https://www.skytowner.com/explore/difference_between_the_methods_power_and_float_power_in_numpy)[Finding the closest value in an array](https://www.skytowner.com/explore/finding_the_closest_value_in_a_numpy_array)[Finding the Index of Largest Value in a Numpy Array](https://www.skytowner.com/explore/finding_the_index_of_largest_value_in_a_numpy_array)[Finding the Index of Smallest Value in a Numpy Array](https://www.skytowner.com/explore/finding_the_index_of_smallest_value_in_a_numpy_array)[Finding the most frequent value in a NumPy array](https://www.skytowner.com/explore/finding_the_most_frequent_value_in_a_numpy_array)[Flattening Numpy arrays](https://www.skytowner.com/explore/flattening_numpy_arrays)[Getting constant Pi](https://www.skytowner.com/explore/getting_constant_pi_in_numpy)[Getting elements from a two dimensional array using two dimensional array of indices](https://www.skytowner.com/explore/getting_elements_from_a_two_dimensional_array_using_two_dimensional_array_of_indices_in_numpy)[Getting indices of N maximum values](https://www.skytowner.com/explore/getting_indices_of_n_maximum_values_in_numpy)[Getting indices of N minimum values](https://www.skytowner.com/explore/getting_indices_of_n_minimum_values_in_numpy)[Getting the number of columns of a 2D array](https://www.skytowner.com/explore/getting_the_number_of_columns_of_a_2d_numpy_array)[Getting the number of non-zero elements in a NumPy array](https://www.skytowner.com/explore/getting_the_number_of_non_zero_elements_in_a_numpy_array)[Getting the number of rows of a 2D array](https://www.skytowner.com/explore/getting_the_number_of_rows_of_a_2d_numpy_array)[Initializing an array of ones](https://www.skytowner.com/explore/initializing_a_numpy_array_of_ones)[Initializing an array of zeros](https://www.skytowner.com/explore/initializing_a_numpy_array_of_zeros)[Initializing an identity matrix](https://www.skytowner.com/explore/initializing_an_identity_matrix_in_numpy)[Limiting array values to a certain range](https://www.skytowner.com/explore/limiting_array_values_to_a_certain_range_in_numpy)[Performing linear regression](https://www.skytowner.com/explore/performing_linear_regression_in_numpy)[Printing full or truncated NumPy array](https://www.skytowner.com/explore/printing_full_or_truncated_numpy_array)[Printing large Numpy arrays without truncation](https://www.skytowner.com/explore/printing_large_numpy_arrays_without_truncation)[Removing rows containing NaN in a NumPy array](https://www.skytowner.com/explore/removing_rows_containing_nan_in_a_numpy_array)[Reversing a NumPy array](https://www.skytowner.com/explore/reversing_a_numpy_array)[Saving NumPy array to a file](https://www.skytowner.com/explore/saving_numpy_array_to_a_file)[Shape of Numpy Arrays](https://www.skytowner.com/explore/shape_of_numpy_arrays)[Sorting value of one array according to another](https://www.skytowner.com/explore/sorting_value_of_one_array_according_to_another_in_python)[Suppressing scientific notation](https://www.skytowner.com/explore/suppressing_scientific_notation_when_printing_numpy_arrays) check\_circle Mark as learned thumb\_up 1 thumb\_down 0 chat\_bubble\_outline 0 Comment auto\_stories Bi-column layout settings # Removing rows containing NaN in a NumPy array *schedule* Aug 10, 2023 Last updated local\_offer Python●NumPy Tags *toc*Table of Contents *expand\_more* [Example](https://www.skytowner.com/explore/removing_rows_containing_nan_in_a_numpy_array#example)[Explanation](https://www.skytowner.com/explore/removing_rows_containing_nan_in_a_numpy_array#example/explanation) [mode\_heat Master the **mathematics behind data science** with 100+ top-tier guides Start your free 7-days trial now\!](https://www.skytowner.com/) To remove rows containing `NaN` in a NumPy array, we can use a combination of the [`isnan(~)`](https://www.skytowner.com/explore/numpy_isnan_method) and [`any(~)`](https://www.skytowner.com/explore/numpy_any_method) methods. # Example Consider the following array: ``` np.array([[1,2,np.nan], [4,5,6]]) array([[ 1., 2., nan], [ 4., 5., 6.]]) ``` To remove rows containing `NaN`: ``` a = np.array([[1,2,np.nan], [4,5,6]]) a[~np.isnan(a).any(axis=1)] array([[4., 5., 6.]]) ``` ## Explanation In the above code snippet, first we are checking each element in array `a` for `np.nan` using `isnan(~)`: ``` np.isnan(a) array([[False, False, True], [False, False, False]]) ``` Next `any(axis=1)` returns `True` if at least one element in each row evaluates to `True`: ``` np.isnan(a).any(axis=1) array([ True, False]) ``` Finally, the bitwise NOT (`~`) operator inverts the `True` and `False` values: ``` ~np.isnan(a).any(axis=1) array([False, True]) ``` Now we apply this boolean mask to the original array `a` to return only the rows not containing `NaN`: ``` a[~np.isnan(a).any(axis=1)] array([[4., 5., 6.]]) ``` [![robocat](https://storage.googleapis.com/skytowner_public/users/jo42E3w6Unbqe8vKejJonz4GTtx1/profile_image/UrUX43oCWAMmHvhqtV8_mini)](https://www.skytowner.com/profile/jo42E3w6Unbqe8vKejJonz4GTtx1) Published by [Arthur Yanagisawa](https://www.skytowner.com/profile/jo42E3w6Unbqe8vKejJonz4GTtx1) Edited by 0 others Did you find this page useful? thumb\_up thumb\_down Comment Citation Ask a question or leave a feedback... Outline [Example](https://www.skytowner.com/explore/removing_rows_containing_nan_in_a_numpy_array#example)[Explanation](https://www.skytowner.com/explore/removing_rows_containing_nan_in_a_numpy_array#example/explanation) thumb\_up 1 thumb\_down 0 chat\_bubble\_outline 0 settings Enjoy our search Hit / to insta-search docs and recipes\! Navigation [Home](https://www.skytowner.com/) [Blog](https://www.skytowner.com/blog) Contact us Resources [Python](https://www.skytowner.com/explore/getting_started_with_python) [Pandas](https://www.skytowner.com/explore/getting_started_with_pandas) [MySQL](https://www.skytowner.com/explore/getting_started_with_mysql) [Beautiful Soup](https://www.skytowner.com/explore/getting_started_with_beautiful_soup) [Matplotlib](https://www.skytowner.com/explore/getting_started_with_matplotlib) [NumPy](https://www.skytowner.com/explore/getting_started_with_numpy) [PySpark](https://www.skytowner.com/explore/user_guide_pyspark) Community [![](https://www.skytowner.com/images/icon_discord_white.svg) Join our Discord](https://discord.gg/fwy7emdn9Y) [mail Join our newsletter for updates on new comprehensive DS/ML guides](https://www.skytowner.com/signup) [Terms](https://www.skytowner.com/terms) \| [Privacy](https://www.skytowner.com/privacy)
Readable Markdown
To remove rows containing `NaN` in a NumPy array, we can use a combination of the [`isnan(~)`](https://www.skytowner.com/explore/numpy_isnan_method) and [`any(~)`](https://www.skytowner.com/explore/numpy_any_method) methods. ## Example Consider the following array: To remove rows containing `NaN`: ## Explanation In the above code snippet, first we are checking each element in array `a` for `np.nan` using `isnan(~)`: Next `any(axis=1)` returns `True` if at least one element in each row evaluates to `True`: Finally, the bitwise NOT (`~`) operator inverts the `True` and `False` values: Now we apply this boolean mask to the original array `a` to return only the rows not containing `NaN`:
Shard121 (laksa)
Root Hash9074883843937675921
Unparsed URLcom,skytowner!www,/explore/removing_rows_containing_nan_in_a_numpy_array s443