Pandas Series: str.isspace() function
Series-str.isspace() function
The str.isspace() function is used to check whether all characters in each string are whitespace or not.
This is equivalent to running the Python string method str.isspace() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Syntax:
Series.str.isspace(self)
Returns: Series or Index of bool
Series or Index of boolean values with the same length as the original Series/Index.
Checks for Alphabetic and Numeric Characters:
Example - Checks for Whitespace:
Python-Pandas Code:
import numpy as np
import pandas as pd
s = pd.Series([' ', '\t\r\n ', ''])
s.str.isspace()
Output:
0 True 1 True 2 False dtype: bool
Previous: Series-str.isdigit() function
Next: Series-str.islower() function
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics