File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -174,14 +174,33 @@ Attribute Access
174
174
175
175
.. _indexing.df_cols :
176
176
177
- You may access a column on a ``DataFrame ``, and a item on a ``Panel `` directly
177
+ You may access an index on a `` Series ``, column on a ``DataFrame ``, and a item on a ``Panel `` directly
178
178
as an attribute:
179
179
180
180
.. ipython :: python
181
181
182
- df.A
182
+ sa = Series([1 ,2 ,3 ],index = list (' abc' ))
183
+ dfa = df.copy()
184
+
185
+ .. ipython :: python
186
+
187
+ sa.b
188
+ dfa.A
183
189
panel.one
184
190
191
+ Setting is allowed as well
192
+
193
+ .. ipython :: python
194
+
195
+ sa.a = 5
196
+ sa
197
+ dfa.A = list (range (len (dfa.index)))
198
+ dfa
199
+
200
+ .. warning ::
201
+
202
+ You can use this convience access only if the index element is a valid python string, e.g. ``s.1 `` is not allowed.
203
+
185
204
If you are using the IPython environment, you may also use tab-completion to
186
205
see these accessable attributes.
187
206
Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ See :ref:`Internal Refactoring<whatsnew_0130.refactoring>`
187
187
- ``Series.copy `` no longer accepts the ``order `` parameter and is now consistent with ``NDFrame `` copy
188
188
- Refactor ``rename `` methods to core/generic.py; fixes ``Series.rename `` for (:issue: `4605 `), and adds ``rename ``
189
189
with the same signature for ``Panel ``
190
+ - Series (for index) / Panel (for items) now as attribute access to its elements (:issue: `1903 `)
190
191
191
192
**Experimental Features **
192
193
Original file line number Diff line number Diff line change @@ -247,6 +247,14 @@ and behaviors. Series formerly subclassed directly from ``ndarray``. (:issue:`40
247
247
- ``Series.copy`` no longer accepts the ``order`` parameter and is now consistent with ``NDFrame`` copy
248
248
- Refactor ``rename`` methods to core/generic.py; fixes ``Series.rename`` for (:issue`4605`), and adds ``rename``
249
249
with the same signature for ``Panel``
250
+ - ``Series`` (for index) / ``Panel`` (for items) now allow attribute access to its elements (:issue:`1903`)
251
+
252
+ .. ipython:: python
253
+
254
+ s = Series([1,2,3],index=list('abc'))
255
+ s.b
256
+ s.a = 5
257
+ s
250
258
251
259
Bug Fixes
252
260
~~~~~~~~~
You can’t perform that action at this time.
0 commit comments