1313 randn = np.random.randn
1414 randint = np.random.randint
1515 np.set_printoptions(precision = 4 , suppress = True )
16- from pandas.compat import lrange, lzip
16+ from pandas.compat import range , zip
1717
1818***************************
1919Indexing and Selecting Data
@@ -294,7 +294,7 @@ The ``.iloc`` attribute is the primary access method. The following are valid in
294294
295295.. ipython :: python
296296
297- s1 = Series(np.random.randn(5 ),index = lrange( 0 ,10 ,2 ))
297+ s1 = Series(np.random.randn(5 ),index = list ( range ( 0 ,10 ,2 ) ))
298298 s1
299299 s1.iloc[:3 ]
300300 s1.iloc[3 ]
@@ -311,8 +311,8 @@ With a DataFrame
311311.. ipython :: python
312312
313313 df1 = DataFrame(np.random.randn(6 ,4 ),
314- index = lrange( 0 ,12 ,2 ),
315- columns = lrange( 0 ,8 ,2 ))
314+ index = list ( range ( 0 ,12 ,2 ) ),
315+ columns = list ( range ( 0 ,8 ,2 ) ))
316316 df1
317317
318318 Select via integer slicing
@@ -787,7 +787,7 @@ numpy array. For instance,
787787.. ipython :: python
788788
789789 dflookup = DataFrame(np.random.rand(20 ,4 ), columns = [' A' ,' B' ,' C' ,' D' ])
790- dflookup.lookup(lrange( 0 ,10 ,2 ), [' B' ,' C' ,' A' ,' B' ,' D' ])
790+ dflookup.lookup(list ( range ( 0 ,10 ,2 ) ), [' B' ,' C' ,' A' ,' B' ,' D' ])
791791
792792 Setting values in mixed-type DataFrame
793793~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -897,7 +897,7 @@ display:
897897
898898.. ipython :: python
899899
900- index = Index(lrange( 5 ), name = ' rows' )
900+ index = Index(list ( range ( 5 ) ), name = ' rows' )
901901 columns = Index([' A' , ' B' , ' C' ], name = ' cols' )
902902 df = DataFrame(np.random.randn(5 , 3 ), index = index, columns = columns)
903903 df
@@ -972,7 +972,7 @@ can think of ``MultiIndex`` an array of tuples where each tuple is unique. A
972972
973973 arrays = [[' bar' , ' bar' , ' baz' , ' baz' , ' foo' , ' foo' , ' qux' , ' qux' ],
974974 [' one' , ' two' , ' one' , ' two' , ' one' , ' two' , ' one' , ' two' ]]
975- tuples = lzip( * arrays)
975+ tuples = list ( zip ( * arrays) )
976976 tuples
977977 index = MultiIndex.from_tuples(tuples, names = [' first' , ' second' ])
978978 s = Series(randn(8 ), index = index)
0 commit comments