We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0535192 + 54dd2a1 commit be45e0dCopy full SHA for be45e0d
doc/source/indexing.rst
@@ -206,15 +206,19 @@ as an attribute:
206
dfa.A
207
panel.one
208
209
-Setting is allowed as well
+You can use attribute access to modify an existing element of a Series or column of a DataFrame, but be careful;
210
+if you try to use attribute access to create a new column, it fails silently, creating a new attribute rather than a
211
+new column.
212
213
.. ipython:: python
214
215
sa.a = 5
216
sa
- dfa.A = list(range(len(dfa.index)))
217
+ dfa.A = list(range(len(dfa.index))) # ok if A already exists
218
dfa
-
219
+ dfa['A'] = list(range(len(dfa.index))) # use this form to create a new column
220
+ dfa
221
+
222
.. warning::
223
224
- You can use this access only if the index element is a valid python identifier, e.g. ``s.1`` is not allowed.
0 commit comments