Skip to content

Commit d39e7e0

Browse files
committed
DOC: start some docs re: integer API changes, GH #627
1 parent 08a5523 commit d39e7e0

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

doc/source/groupby.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ only verifies that you've passed a valid mapping.
125125
GroupBy operations (though can't be guaranteed to be the most
126126
efficient). You can get quite creative with the label mapping functions.
127127

128-
.. _groupby.atributes:
128+
.. _groupby.attributes:
129129

130130
GroupBy object attributes
131131
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -302,6 +302,8 @@ same result as the column names are stored in the resulting ``MultiIndex``:
302302
303303
df.groupby(['A', 'B']).sum().reset_index()
304304
305+
.. _groupby.aggregate.multifunc:
306+
305307
Applying multiple functions at once
306308
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
307309

doc/source/whatsnew/v0.7.0.txt

+50-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,55 @@
33
v.0.7.0 (Not Yet Released)
44
--------------------------
55

6-
API Changes
7-
~~~~~~~~~~~
6+
API Changes to integer indexing
7+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
9+
One of the potentially riskiest API changes in 0.7.0, but also one of the most
10+
important, was a complete review of how **integer indexes** are handled with
11+
regard to label-based indexing. Here is an example:
12+
13+
.. ipython:: python
14+
15+
s = Series(randn(10), index=range(0, 20, 2))
16+
s
17+
s[0]
18+
s[2]
19+
s[4]
20+
21+
This is all exactly identical to the behavior before. However, if you ask for a
22+
key **not** contained in the Series, in versions 0.6.1 and prior, Series would
23+
*fall back* on a location-based lookup. This now raises a ``KeyError``:
24+
25+
.. code-block:: ipython
26+
27+
In [2]: s[1]
28+
KeyError: 1
29+
30+
This change also has the same impact on DataFrame:
31+
32+
.. code-block:: ipython
33+
34+
In [3]: df = DataFrame(randn(8, 4), index=range(0, 16, 2))
35+
36+
In [4]: df
37+
0 1 2 3
38+
0 0.88427 0.3363 -0.1787 0.03162
39+
2 0.14451 -0.1415 0.2504 0.58374
40+
4 -1.44779 -0.9186 -1.4996 0.27163
41+
6 -0.26598 -2.4184 -0.2658 0.11503
42+
8 -0.58776 0.3144 -0.8566 0.61941
43+
10 0.10940 -0.7175 -1.0108 0.47990
44+
12 -1.16919 -0.3087 -0.6049 -0.43544
45+
14 -0.07337 0.3410 0.0424 -0.16037
46+
47+
In [5]: df.ix[3]
48+
KeyError: 3
49+
50+
API refinements regarding label-based slicing
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52+
53+
Other relevant API Changes
54+
~~~~~~~~~~~~~~~~~~~~~~~~~~
855

956
New features
1057
~~~~~~~~~~~~
@@ -75,7 +122,7 @@ New features
75122
- :ref:`Added <io.formatting>` ``justify`` argument to ``DataFrame.to_string``
76123
to allow different alignment of column headers
77124

78-
- :ref:`Add <groupby.atributes>` ``sort`` option to GroupBy to allow disabling
125+
- :ref:`Add <groupby.attributes>` ``sort`` option to GroupBy to allow disabling
79126
sorting of the group keys for potential speedups (GH595_)
80127

81128
- :ref:`Can <basics.dataframe.from_series>` pass MaskedArray to Series

0 commit comments

Comments
 (0)