"isna()" Function in PythonThe isna() method in Python is a robust data manipulation and analysis toolbox that is widely utilized while working with pandas. The isna() function finds missing or null values in a pandas DataFrame or Series. The usage of the isna() function in various scenarios is as follows:
The isna() method returns a boolean-valued DataFrame of the same shape when applied to a Pandas DataFrame. The corresponding element in the original DataFrame is displayed for each element in the generated DataFrame as NaN (not present). The corresponding element in the resulting DataFrame is True if one of the elements is NaN; If not, it is false. Example code snippet: Output: Column1 Column2 0 False False 1 False True 2 True False 3 False False
When applied to a pandas Series, the isna() method returns a Series of boolean values. Each resultant Series member represents whether or not the matching element in the original Series is NaN. Example: Output: 0 False 1 False 2 True 3 False dtype: bool Explanation: When dealing with missing data, the isna() function comes in handy because it allows you to locate NaN values within your DataFrame or Series. After that, this information can be used to handle or manipulate the missing data as needed.
Example: Output: Column1 1 Column2 1 dtype: int64 Next TopicBarrier Objects in Python |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India