2727__all__ = ['read_excel' ]
2828
2929
30- # TODO: remove ' # doctest: +SKIP' next to arr.info when Python 2.7 will be dropped
30+ # We use " # doctest: +SKIP" for all tests because they work only if xlrd (an *optional* dependency) is installed
3131@deprecate_kwarg ('nb_index' , 'nb_axes' , arg_converter = lambda x : x + 1 )
3232@deprecate_kwarg ('sheetname' , 'sheet' )
3333def read_excel (filepath , sheet = 0 , nb_axes = None , index_col = None , fill_value = nan , na = nan ,
@@ -80,7 +80,7 @@ def read_excel(filepath, sheet=0, nb_axes=None, index_col=None, fill_value=nan,
8080 Read array from first sheet
8181
8282 >>> # The data below is derived from a subset of the demo_pjan table from Eurostat
83- >>> read_excel(fname)
83+ >>> read_excel(fname) # doctest: +SKIP
8484 country gender\time 2013 2014 2015
8585 Belgium Male 5472856 5493792 5524068
8686 Belgium Female 5665118 5687048 5713206
@@ -92,7 +92,7 @@ def read_excel(filepath, sheet=0, nb_axes=None, index_col=None, fill_value=nan,
9292 Read array from a specific sheet
9393
9494 >>> # The data below is derived from a subset of the demo_fasec table from Eurostat
95- >>> read_excel(fname, 'births')
95+ >>> read_excel(fname, 'births') # doctest: +SKIP
9696 country gender\time 2013 2014 2015
9797 Belgium Male 64371 64173 62561
9898 Belgium Female 61235 60841 59713
@@ -115,7 +115,7 @@ def read_excel(filepath, sheet=0, nb_axes=None, index_col=None, fill_value=nan,
115115 By default, cells associated with missing label combinations are filled with NaN. In that case, an int array
116116 is converted to a float array.
117117
118- >>> read_excel(fname, sheet='population_missing_values')
118+ >>> read_excel(fname, sheet='population_missing_values') # doctest: +SKIP
119119 country gender\time 2013 2014 2015
120120 Belgium Male 5472856.0 5493792.0 5524068.0
121121 Belgium Female 5665118.0 5687048.0 5713206.0
@@ -126,7 +126,7 @@ def read_excel(filepath, sheet=0, nb_axes=None, index_col=None, fill_value=nan,
126126
127127 Using the ``fill_value`` argument, you can choose another value to use to fill missing cells.
128128
129- >>> read_excel(fname, sheet='population_missing_values', fill_value=0)
129+ >>> read_excel(fname, sheet='population_missing_values', fill_value=0) # doctest: +SKIP
130130 country gender\time 2013 2014 2015
131131 Belgium Male 5472856 5493792 5524068
132132 Belgium Female 5665118 5687048 5713206
@@ -148,7 +148,7 @@ def read_excel(filepath, sheet=0, nb_axes=None, index_col=None, fill_value=nan,
148148 Germany Female 41142770 41210540 41362080
149149
150150 >>> # read the array stored in the sheet 'population_missing_axis_name' as is
151- >>> arr = read_excel(fname, sheet='population_missing_axis_name')
151+ >>> arr = read_excel(fname, sheet='population_missing_axis_name') # doctest: +SKIP
152152 >>> # we expected a 3 x 2 x 3 array with data of type int
153153 >>> # but we got a 6 x 4 array with data of type object
154154 >>> arr.info # doctest: +SKIP
@@ -158,7 +158,7 @@ def read_excel(filepath, sheet=0, nb_axes=None, index_col=None, fill_value=nan,
158158 dtype: object
159159 memory used: 192 bytes
160160 >>> # using argument 'nb_axes', you can force the number of axes of the output array
161- >>> arr = read_excel(fname, sheet='population_missing_axis_name', nb_axes=3)
161+ >>> arr = read_excel(fname, sheet='population_missing_axis_name', nb_axes=3) # doctest: +SKIP
162162 >>> # as expected, we have a 3 x 2 x 3 array with data of type int
163163 >>> arr.info # doctest: +SKIP
164164 3 x 2 x 3
@@ -181,14 +181,14 @@ def read_excel(filepath, sheet=0, nb_axes=None, index_col=None, fill_value=nan,
181181 France 2015 66458153
182182
183183 >>> # to read arrays stored in 'narrow' format, you must pass wide=False to read_excel
184- >>> read_excel(fname, 'population_narrow_format', wide=False)
184+ >>> read_excel(fname, 'population_narrow_format', wide=False) # doctest: +SKIP
185185 country\time 2013 2014 2015
186186 Belgium 11137974 11180840 11237274
187187 France 65600350 66165980 66458153
188188
189189 Extract array from a given range (xlwings only)
190190
191- >>> read_excel(fname, 'population_births_deaths', range='A9:E15') # doctest: +SKIP
191+ >>> read_excel(fname, 'population_births_deaths', range='A9:E15') # doctest: +SKIP
192192 country gender\time 2013 2014 2015
193193 Belgium Male 64371 64173 62561
194194 Belgium Female 61235 60841 59713
0 commit comments