|
13 | 13 | import pandas as pd
|
14 | 14 | np.set_printoptions(precision=4, suppress=True)
|
15 | 15 | options.display.mpl_style='default'
|
16 |
| - from pandas.compat import lrange, lzip |
17 | 16 |
|
18 | 17 | #### portions of this were borrowed from the
|
19 | 18 | #### Pandas cheatsheet
|
@@ -63,7 +62,7 @@ Creating a ``DataFrame`` by passing a dict of objects that can be converted to s
|
63 | 62 |
|
64 | 63 | df2 = pd.DataFrame({ 'A' : 1.,
|
65 | 64 | 'B' : pd.Timestamp('20130102'),
|
66 |
| - 'C' : pd.Series(1,index=lrange(4),dtype='float32'), |
| 65 | + 'C' : pd.Series(1,index=list(range(4)),dtype='float32'), |
67 | 66 | 'D' : np.array([3] * 4,dtype='int32'),
|
68 | 67 | 'E' : 'foo' })
|
69 | 68 | df2
|
@@ -510,10 +509,10 @@ Stack
|
510 | 509 |
|
511 | 510 | .. ipython:: python
|
512 | 511 |
|
513 |
| - tuples = lzip(*[['bar', 'bar', 'baz', 'baz', |
514 |
| - 'foo', 'foo', 'qux', 'qux'], |
515 |
| - ['one', 'two', 'one', 'two', |
516 |
| - 'one', 'two', 'one', 'two']]) |
| 512 | + tuples = list(zip(*[['bar', 'bar', 'baz', 'baz', |
| 513 | + 'foo', 'foo', 'qux', 'qux'], |
| 514 | + ['one', 'two', 'one', 'two', |
| 515 | + 'one', 'two', 'one', 'two']])) |
517 | 516 | index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second'])
|
518 | 517 | df = pd.DataFrame(np.random.randn(8, 2), index=index, columns=['A', 'B'])
|
519 | 518 | df2 = df[:4]
|
@@ -619,6 +618,7 @@ Plotting
|
619 | 618 |
|
620 | 619 | import matplotlib.pyplot as plt
|
621 | 620 | plt.close('all')
|
| 621 | + from pandas import options |
622 | 622 | options.display.mpl_style='default'
|
623 | 623 |
|
624 | 624 | .. ipython:: python
|
|
0 commit comments