File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 55 :suppress:
66
77 import numpy as np
8- np.random.seed(123456 )
98 import pandas as pd
10- import pandas.util.testing as tm
9+
10+ np.random.seed(123456 )
1111 np.set_printoptions(precision = 4 , suppress = True )
1212 pd.options.display.max_rows = 15
1313
@@ -26,7 +26,7 @@ data structures have a ``to_sparse`` method:
2626
2727.. ipython :: python
2828
29- ts = pd.Series(randn(10 ))
29+ ts = pd.Series(np.random. randn(10 ))
3030 ts[2 :- 2 ] = np.nan
3131 sts = ts.to_sparse()
3232 sts
@@ -44,7 +44,7 @@ large, mostly NA ``DataFrame``:
4444
4545.. ipython :: python
4646
47- df = pd.DataFrame(randn(10000 , 4 ))
47+ df = pd.DataFrame(np.random. randn(10000 , 4 ))
4848 df.iloc[:9998 ] = np.nan
4949 sdf = df.to_sparse()
5050 sdf
@@ -94,7 +94,8 @@ distinct from the ``fill_value``:
9494.. ipython :: python
9595
9696 arr = np.random.randn(10 )
97- arr[2 :5 ] = np.nan; arr[7 :8 ] = np.nan
97+ arr[2 :5 ] = np.nan
98+ arr[7 :8 ] = np.nan
9899 sparr = pd.SparseArray(arr)
99100 sparr
100101
@@ -244,7 +245,7 @@ The method requires a ``MultiIndex`` with two or more levels.
244245 (1 , 1 , ' b' , 1 ),
245246 (2 , 1 , ' b' , 0 ),
246247 (2 , 1 , ' b' , 1 )],
247- names = [' A' , ' B' , ' C' , ' D' ])
248+ names = [' A' , ' B' , ' C' , ' D' ])
248249
249250 s
250251 # SparseSeries
You can’t perform that action at this time.
0 commit comments