|
3 | 3 | v.0.7.0 (Not Yet Released)
|
4 | 4 | --------------------------
|
5 | 5 |
|
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 | +~~~~~~~~~~~~~~~~~~~~~~~~~~ |
8 | 55 |
|
9 | 56 | New features
|
10 | 57 | ~~~~~~~~~~~~
|
@@ -75,7 +122,7 @@ New features
|
75 | 122 | - :ref:`Added <io.formatting>` ``justify`` argument to ``DataFrame.to_string``
|
76 | 123 | to allow different alignment of column headers
|
77 | 124 |
|
78 |
| -- :ref:`Add <groupby.atributes>` ``sort`` option to GroupBy to allow disabling |
| 125 | +- :ref:`Add <groupby.attributes>` ``sort`` option to GroupBy to allow disabling |
79 | 126 | sorting of the group keys for potential speedups (GH595_)
|
80 | 127 |
|
81 | 128 | - :ref:`Can <basics.dataframe.from_series>` pass MaskedArray to Series
|
|
0 commit comments