Skip to content

Commit 25fd443

Browse files
committed
DOC: update attribute access docs for Series/Panel access
1 parent cba88ed commit 25fd443

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

doc/source/indexing.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,33 @@ Attribute Access
174174

175175
.. _indexing.df_cols:
176176

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
178178
as an attribute:
179179

180180
.. ipython:: python
181181
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
183189
panel.one
184190
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+
185204
If you are using the IPython environment, you may also use tab-completion to
186205
see these accessable attributes.
187206

doc/source/release.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ See :ref:`Internal Refactoring<whatsnew_0130.refactoring>`
187187
- ``Series.copy`` no longer accepts the ``order`` parameter and is now consistent with ``NDFrame`` copy
188188
- Refactor ``rename`` methods to core/generic.py; fixes ``Series.rename`` for (:issue:`4605`), and adds ``rename``
189189
with the same signature for ``Panel``
190+
- Series (for index) / Panel (for items) now as attribute access to its elements (:issue:`1903`)
190191

191192
**Experimental Features**
192193

doc/source/v0.13.0.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,14 @@ and behaviors. Series formerly subclassed directly from ``ndarray``. (:issue:`40
247247
- ``Series.copy`` no longer accepts the ``order`` parameter and is now consistent with ``NDFrame`` copy
248248
- Refactor ``rename`` methods to core/generic.py; fixes ``Series.rename`` for (:issue`4605`), and adds ``rename``
249249
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
250258

251259
Bug Fixes
252260
~~~~~~~~~

0 commit comments

Comments
 (0)