Skip to content

Commit 986943c

Browse files
authored
DOC: fix doc-build for .ix deprecations (#15158)
1 parent 8e13da2 commit 986943c

12 files changed

+66
-36
lines changed

doc/source/indexing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ Using ``.loc``. Here we will select the appropriate indexes from the index, then
586586

587587
.. ipython:: python
588588
589-
dfd.loc[df.index[[0, 2]], 'A']
589+
dfd.loc[dfd.index[[0, 2]], 'A']
590590
591591
This can also be expressed using ``.iloc``, by explicitly getting locations on the indexers, and using
592592
*positional* indexing to select things.

doc/source/whatsnew/v0.10.1.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ perform queries on a table, by passing a list to ``data_columns``
5151
df = DataFrame(randn(8, 3), index=date_range('1/1/2000', periods=8),
5252
columns=['A', 'B', 'C'])
5353
df['string'] = 'foo'
54-
df.ix[4:6,'string'] = np.nan
55-
df.ix[7:9,'string'] = 'bar'
54+
df.loc[df.index[4:6], 'string'] = np.nan
55+
df.loc[df.index[7:9], 'string'] = 'bar'
5656
df['string2'] = 'cool'
5757
df
5858

@@ -78,7 +78,7 @@ You can now store ``datetime64`` in data columns
7878

7979
df_mixed = df.copy()
8080
df_mixed['datetime64'] = Timestamp('20010102')
81-
df_mixed.ix[3:4,['A','B']] = np.nan
81+
df_mixed.loc[df_mixed.index[3:4], ['A','B']] = np.nan
8282

8383
store.append('df_mixed', df_mixed)
8484
df_mixed1 = store.select('df_mixed')
@@ -208,4 +208,3 @@ combined result, by using ``where`` on a selector table.
208208
See the :ref:`full release notes
209209
<release>` or issue tracker
210210
on GitHub for a complete list.
211-

doc/source/whatsnew/v0.11.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Furthermore ``datetime64[ns]`` columns are created by default, when passed datet
190190
df.get_dtype_counts()
191191

192192
# use the traditional nan, which is mapped to NaT internally
193-
df.ix[2:4,['A','timestamp']] = np.nan
193+
df.loc[df.index[2:4], ['A','timestamp']] = np.nan
194194
df
195195

196196
Astype conversion on ``datetime64[ns]`` to ``object``, implicity converts ``NaT`` to ``np.nan``

doc/source/whatsnew/v0.13.0.txt

-2
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ Float64Index API Change
274274
.. ipython:: python
275275

276276
s[3]
277-
s.ix[3]
278277
s.loc[3]
279278

280279
The only positional indexing is via ``iloc``
@@ -290,7 +289,6 @@ Float64Index API Change
290289
.. ipython:: python
291290

292291
s[2:4]
293-
s.ix[2:4]
294292
s.loc[2:4]
295293
s.iloc[2:4]
296294

doc/source/whatsnew/v0.13.1.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Highlights include:
3636
.. ipython:: python
3737

3838
df = DataFrame(dict(A = np.array(['foo','bar','bah','foo','bar'])))
39-
df.ix[0,'A'] = np.nan
39+
df.loc[0,'A'] = np.nan
4040
df
4141

4242
Output Formatting Enhancements
@@ -121,7 +121,7 @@ API changes
121121

122122
.. ipython:: python
123123
:okwarning:
124-
124+
125125
df = DataFrame({'col':['foo', 0, np.nan]})
126126
df2 = DataFrame({'col':[np.nan, 0, 'foo']}, index=[2,1,0])
127127
df.equals(df2)

doc/source/whatsnew/v0.14.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ See also issues (:issue:`6134`, :issue:`4036`, :issue:`3057`, :issue:`2598`, :is
516516
names=['lvl0', 'lvl1'])
517517
df = DataFrame(np.arange(len(index)*len(columns)).reshape((len(index),len(columns))),
518518
index=index,
519-
columns=columns).sortlevel().sortlevel(axis=1)
519+
columns=columns).sort_index().sort_index(axis=1)
520520
df
521521

522522
Basic multi-index slicing using slices, lists, and labels.

doc/source/whatsnew/v0.15.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ Other notable API changes:
705705
s = Series(np.arange(3,dtype='int64'),
706706
index=MultiIndex.from_product([['A'],['foo','bar','baz']],
707707
names=['one','two'])
708-
).sortlevel()
708+
).sort_index()
709709
s
710710
try:
711711
s.loc[['D']]

doc/source/whatsnew/v0.15.2.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ API changes
3535
df.loc[(1, 'z')]
3636

3737
# lexically sorting
38-
df2 = df.sortlevel()
38+
df2 = df.sort_index()
3939
df2
4040
df2.index.lexsort_depth
4141
df2.loc[(1,'z')]

doc/source/whatsnew/v0.16.0.txt

+7-2
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,14 @@ The behavior of a small sub-set of edge cases for using ``.loc`` have changed (:
300300

301301
New Behavior
302302

303-
.. ipython:: python
303+
.. code-block:: python
304304

305-
s.ix[-1.0:2]
305+
In [2]: s.ix[-1.0:2]
306+
Out[2]:
307+
-1 1
308+
1 2
309+
2 3
310+
dtype: int64
306311

307312
- Provide a useful exception for indexing with an invalid type for that index when using ``.loc``. For example trying to use ``.loc`` on an index of type ``DatetimeIndex`` or ``PeriodIndex`` or ``TimedeltaIndex``, with an integer (or a float).
308313

doc/source/whatsnew/v0.18.0.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ New Behavior:
448448
columns=list('abc'),
449449
index=[[4,4,8], [8,10,12]])
450450
df
451-
df.ix[4, 'c'] = np.array([0., 1.])
451+
df.loc[4, 'c'] = np.array([0., 1.])
452452
df
453453

454454
.. _whatsnew_0180.enhancements.xarray:
@@ -1115,7 +1115,6 @@ Other indexers will coerce to a like integer for both getting and setting. The `
11151115

11161116
s[5.0]
11171117
s.loc[5.0]
1118-
s.ix[5.0]
11191118

11201119
and setting
11211120

@@ -1127,30 +1126,31 @@ and setting
11271126
s_copy = s.copy()
11281127
s_copy.loc[5.0] = 10
11291128
s_copy
1130-
s_copy = s.copy()
1131-
s_copy.ix[5.0] = 10
1132-
s_copy
11331129

11341130
Positional setting with ``.ix`` and a float indexer will ADD this value to the index, rather than previously setting the value by position.
11351131

1136-
.. ipython:: python
1132+
.. code-block:: python
11371133

1138-
s2.ix[1.0] = 10
1139-
s2
1134+
In [3]: s2.ix[1.0] = 10
1135+
In [4]: s2
1136+
Out[4]:
1137+
a 1
1138+
b 2
1139+
c 3
1140+
1.0 10
1141+
dtype: int64
11401142

11411143
Slicing will also coerce integer-like floats to integers for a non-``Float64Index``.
11421144

11431145
.. ipython:: python
11441146

11451147
s.loc[5.0:6]
1146-
s.ix[5.0:6]
11471148

11481149
Note that for floats that are NOT coercible to ints, the label based bounds will be excluded
11491150

11501151
.. ipython:: python
11511152

11521153
s.loc[5.1:6]
1153-
s.ix[5.1:6]
11541154

11551155
Float indexing on a ``Float64Index`` is unchanged.
11561156

doc/source/whatsnew/v0.7.0.txt

+38-10
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,30 @@ API tweaks regarding label-based slicing
169169
Label-based slicing using ``ix`` now requires that the index be sorted
170170
(monotonic) **unless** both the start and endpoint are contained in the index:
171171

172-
.. ipython:: python
172+
.. code-block:: python
173173

174-
s = Series(randn(6), index=list('gmkaec'))
175-
s
174+
In [1]: s = Series(randn(6), index=list('gmkaec'))
175+
176+
In [2]: s
177+
Out[2]:
178+
g -1.182230
179+
m -0.276183
180+
k -0.243550
181+
a 1.628992
182+
e 0.073308
183+
c -0.539890
184+
dtype: float64
176185

177186
Then this is OK:
178187

179-
.. ipython:: python
188+
.. code-block:: python
180189

181-
s.ix['k':'e']
190+
In [3]: s.ix['k':'e']
191+
Out[3]:
192+
k -0.243550
193+
a 1.628992
194+
e 0.073308
195+
dtype: float64
182196

183197
But this is not:
184198

@@ -189,11 +203,26 @@ But this is not:
189203

190204
If the index had been sorted, the "range selection" would have been possible:
191205

192-
.. ipython:: python
206+
.. code-block:: python
207+
208+
In [4]: s2 = s.sort_index()
193209

194-
s2 = s.sort_index()
195-
s2
196-
s2.ix['b':'h']
210+
In [5]: s2
211+
Out[5]:
212+
a 1.628992
213+
c -0.539890
214+
e 0.073308
215+
g -1.182230
216+
k -0.243550
217+
m -0.276183
218+
dtype: float64
219+
220+
In [6]: s2.ix['b':'h']
221+
Out[6]:
222+
c -0.539890
223+
e 0.073308
224+
g -1.182230
225+
dtype: float64
197226

198227
Changes to Series ``[]`` operator
199228
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -269,4 +298,3 @@ Performance improvements
269298
``level`` parameter passed (:issue:`545`)
270299
- Ported skiplist data structure to C to speed up ``rolling_median`` by about
271300
5-10x in most typical use cases (:issue:`374`)
272-

doc/source/whatsnew/v0.9.1.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ New features
3636

3737
df = DataFrame(np.random.randn(6, 3), columns=['A', 'B', 'C'])
3838

39-
df.ix[2:4] = np.nan
39+
df.loc[2:4] = np.nan
4040

4141
df.rank()
4242

0 commit comments

Comments
 (0)