@@ -230,7 +230,7 @@ of tuples:
230
230
Advanced indexing with hierarchical index
231
231
-----------------------------------------
232
232
233
- Syntactically integrating ``MultiIndex `` in advanced indexing with ``.loc/.ix `` is a
233
+ Syntactically integrating ``MultiIndex `` in advanced indexing with ``.loc `` is a
234
234
bit challenging, but we've made every effort to do so. for example the
235
235
following works as you would expect:
236
236
@@ -258,7 +258,7 @@ Passing a list of labels or tuples works similar to reindexing:
258
258
259
259
.. ipython :: python
260
260
261
- df.ix [[(' bar' , ' two' ), (' qux' , ' one' )]]
261
+ df.loc [[(' bar' , ' two' ), (' qux' , ' one' )]]
262
262
263
263
.. _advanced.mi_slicers :
264
264
@@ -604,7 +604,7 @@ intended to work on boolean indices and may return unexpected results.
604
604
605
605
ser = pd.Series(np.random.randn(10 ))
606
606
ser.take([False , False , True , True ])
607
- ser.ix [[0 , 1 ]]
607
+ ser.iloc [[0 , 1 ]]
608
608
609
609
Finally, as a small note on performance, because the ``take `` method handles
610
610
a narrower range of inputs, it can offer performance that is a good deal
@@ -620,7 +620,7 @@ faster than fancy indexing.
620
620
timeit arr.take(indexer, axis=0)
621
621
622
622
ser = pd.Series(arr[:, 0])
623
- timeit ser.ix [indexer]
623
+ timeit ser.iloc [indexer]
624
624
timeit ser.take(indexer)
625
625
626
626
.. _indexing.index_types :
@@ -661,7 +661,7 @@ Setting the index, will create create a ``CategoricalIndex``
661
661
df2 = df.set_index(' B' )
662
662
df2.index
663
663
664
- Indexing with ``__getitem__/.iloc/.loc/.ix `` works similarly to an ``Index `` with duplicates.
664
+ Indexing with ``__getitem__/.iloc/.loc `` works similarly to an ``Index `` with duplicates.
665
665
The indexers MUST be in the category or the operation will raise.
666
666
667
667
.. ipython :: python
@@ -759,14 +759,12 @@ same.
759
759
sf = pd.Series(range (5 ), index = indexf)
760
760
sf
761
761
762
- Scalar selection for `` [],.ix,. loc`` will always be label based. An integer will match an equal float index (e.g. `` 3 `` is equivalent to `` 3.0 `` )
762
+ Scalar selection for `` [],.loc`` will always be label based. An integer will match an equal float index (e.g. `` 3 `` is equivalent to `` 3.0 `` )
763
763
764
764
.. ipython:: python
765
765
766
766
sf[3 ]
767
767
sf[3.0 ]
768
- sf.ix[3 ]
769
- sf.ix[3.0 ]
770
768
sf.loc[3 ]
771
769
sf.loc[3.0 ]
772
770
@@ -783,7 +781,6 @@ Slicing is ALWAYS on the values of the index, for ``[],ix,loc`` and ALWAYS posit
783
781
.. ipython:: python
784
782
785
783
sf[2 :4 ]
786
- sf.ix[2 :4 ]
787
784
sf.loc[2 :4 ]
788
785
sf.iloc[2 :4 ]
789
786
@@ -813,14 +810,6 @@ In non-float indexes, slicing using floats will raise a ``TypeError``
813
810
In [3 ]: pd.Series(range (5 )).iloc[3.0 ]
814
811
TypeError : cannot do positional indexing on < class ' pandas.indexes.range.RangeIndex' > with these indexers [3.0 ] of < type ' float' >
815
812
816
- Further the treatment of `` .ix`` with a float indexer on a non- float index, will be label based, and thus coerce the index.
817
-
818
- .. ipython:: python
819
-
820
- s2 = pd.Series([1 , 2 , 3 ], index = list (' abc' ))
821
- s2
822
- s2.ix[1.0 ] = 10
823
- s2
824
813
825
814
Here is a typical use- case for using this type of indexing. Imagine that you have a somewhat
826
815
irregular timedelta- like indexing scheme, but the data is recorded as floats. This could for
0 commit comments