"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
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week