replace empty cells with nan pandas code example
Example 1: pandas replace empty string with nan
df = df.replace(r'^\s*$', np.NaN, regex=True)
Example 2: replace empty or nan excel date rows with custom date pandas python
>>> import collections
>>> Point = collections.namedtuple('Point', ['x', 'y'])
>>> p = Point(x=1.0, y=2.0)
>>> p
Point(x=1.0, y=2.0)
>>> p.x
1.0
>>> p.y
2.0