You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the underlying issue here is that we have _getitem_cache for label-based lookups but no analogous _igetitem_cache. So either making _igetitem_cache or getting rid of _getitem_cache should do the trick.
That boils down to the question if the retrieval of a DataFrame column or row should return a copy or a reference. I'm relatively new to pandas and therefore might have a rather naive look on this but I would expect a copy and my gut feeling tells me that a copy would have less side effects.
It's a little bit strange when the retrieval of a column delivers something different from the column as shown by the __repr__ method of the DataFrame.
Also assignment to an element of a new row in the DataFrame does extend the DataFrame and create NaN values for the other elements of the new row. In the context of my simple example above:
df.loc['c','A'] =7df
A
B
a
1.0
2.0
b
3.0
4.0
c
7.0
NaN
If the Series 's' in my example would be a reference to the DataFrame column I would expect the same to happen when I add an element to the Series 's'.
Currently it behaves like a copy of the DataFrame column and the DataFrame is not extended.
This is at least inconsistent. However, I would also expect to see no change of the retrieved Series under point 4.
df
s
df
The text was updated successfully, but these errors were encountered: