I have a pandas DataFrame with a combination of numpy.ndarray and categorical variables.
import pandas as pd
import numpy as np
df = pd.DataFrame({
'i': [0, 1, 2],
'a': [np.array([]), np.array([]), 'A']
})
df['a'][0]
array([], dtype=float64)
I'd like to replace the arrays with np.nan.
I tried: df['a'].replace(np.array([]), np.nan) but it didn't work.