Inserting list into a cell - why does loc ACTUALLY work here?
问题 We are aware that the standard method of setting a single cell is using at or iat . However, I noticed some interesting behaviour I was wondering if anyone could rationalise. In solving this question, I come across some weird behaviour of loc . # Setup. pd.__version__ # '0.24.0rc1' df = pd.DataFrame({'A': [12, 23], 'B': [['a', 'b'], ['c', 'd']]}) df A B 0 12 [a, b] 1 23 [c, d] To set cell (1, 'B'), it suffices to do this with at, like df.at[1, 'B'] = ... . But with loc, I initially tried this