Closed
Description
Hello team,
Here is a simple working exemple of value assignment on a dataframe:
df = pd.DataFrame({'A': [np.nan, np.nan, 'b']})
df['A'].loc[[0, 1]] = ['a', np.nan]
df.notna()
Out[126]:
A
0 True
1 False
2 True
However, if we use loc to assign the entire column with an array including NaNs, all values are converted to strings, breaking notna():
df = pd.DataFrame({'A': [np.nan, np.nan, 'b']})
df['A'].loc[[0, 1, 2]] = ['a', np.nan, np.nan]
df['A'].notna()
Out[133]:
0 True
1 True
2 True
Name: A, dtype: bool