I have this pandas DataFrame filled with lists filled with strings, that I wish to split into two frames:
Input:
df = pd.DataFrame({
'A': {'a': ['NaN'],'b': ['1.11', '0.00']},
'B': {'a': ['3.33', '0.22'],'b': ['NaN']},
})
Desired output:
df1 = pd.DataFrame({
'A': {'a': ['NaN'],'b': ['1.11']},
'B': {'a': ['3.33'],'b': ['NaN']},
})
df2 = pd.DataFrame({
'A': {'a': ['NaN'],'b': ['0.00']},
'B': {'a': ['0.22'],'b': ['NaN']},
})
I tried to use the apply function, which works for Series, and was wondering if there is an easy way to apply an operation that achieves this on the entire df.