How can I replace all empty list [] values to None in the following df:
import pandas as pd
d = pd.Timestamp.now()
df = pd.DataFrame({'col1': ['a', 'b', 'c'],
'col2': [1, list(), 3],
'col3': ['x', 'y', list()],
'col4': [d, d, d]})
The solution:
df[df.applymap(lambda x: x == [])] = None gives TypeError: Cannot do inplace boolean setting on mixed-types with a non np.nan value