|
86 | 86 | )
|
87 | 87 | _read_excel_doc = (
|
88 | 88 | """
|
89 |
| -Read an Excel file into a pandas DataFrame. |
| 89 | +Read an Excel file into a ``pandas`` ``DataFrame``. |
90 | 90 |
|
91 | 91 | Supports `xls`, `xlsx`, `xlsm`, `xlsb`, `odf`, `ods` and `odt` file extensions
|
92 | 92 | read from a local filesystem or URL. Supports an option to read
|
|
112 | 112 | Strings are used for sheet names. Integers are used in zero-indexed
|
113 | 113 | sheet positions (chart sheets do not count as a sheet position).
|
114 | 114 | Lists of strings/integers are used to request multiple sheets.
|
115 |
| - Specify None to get all worksheets. |
| 115 | + Specify ``None`` to get all worksheets. |
116 | 116 |
|
117 | 117 | Available cases:
|
118 | 118 |
|
|
121 | 121 | * ``"Sheet1"``: Load sheet with name "Sheet1"
|
122 | 122 | * ``[0, 1, "Sheet5"]``: Load first, second and sheet named "Sheet5"
|
123 | 123 | as a dict of `DataFrame`
|
124 |
| - * None: All worksheets. |
| 124 | + * ``None``: All worksheets. |
125 | 125 |
|
126 | 126 | header : int, list of int, default 0
|
127 | 127 | Row (0-indexed) to use for the column labels of the parsed
|
|
155 | 155 | Returns a subset of the columns according to behavior above.
|
156 | 156 | dtype : Type name or dict of column -> type, default None
|
157 | 157 | Data type for data or columns. E.g. {{'a': np.float64, 'b': np.int32}}
|
158 |
| - Use `object` to preserve data as stored in Excel and not interpret dtype, |
159 |
| - which will necessarily result in `object` dtype. |
| 158 | + Use ``object`` to preserve data as stored in Excel and not interpret dtype, |
| 159 | + which will necessarily result in ``object`` dtype. |
160 | 160 | If converters are specified, they will be applied INSTEAD
|
161 | 161 | of dtype conversion.
|
162 |
| - If you use `None`, it will infer the dtype of each column based on the data. |
| 162 | + If you use ``None``, it will infer the dtype of each column based on the data. |
163 | 163 | engine : str, default None
|
164 | 164 | If io is not a buffer or path, this must be set to identify io.
|
165 | 165 | Supported engines: "xlrd", "openpyxl", "odf", "pyxlsb", "calamine".
|
166 | 166 | Engine compatibility :
|
167 | 167 |
|
168 |
| - - "xlrd" supports old-style Excel files (.xls). |
169 |
| - - "openpyxl" supports newer Excel file formats. |
170 |
| - - "odf" supports OpenDocument file formats (.odf, .ods, .odt). |
171 |
| - - "pyxlsb" supports Binary Excel files. |
172 |
| - - "calamine" supports Excel (.xls, .xlsx, .xlsm, .xlsb) |
| 168 | + - ``xlr`` supports old-style Excel files (.xls). |
| 169 | + - ``openpyxl`` supports newer Excel file formats. |
| 170 | + - ``odf`` supports OpenDocument file formats (.odf, .ods, .odt). |
| 171 | + - ``pyxlsb`` supports Binary Excel files. |
| 172 | + - ``calamine`` supports Excel (.xls, .xlsx, .xlsm, .xlsb) |
173 | 173 | and OpenDocument (.ods) file formats.
|
174 | 174 |
|
175 | 175 | .. versionchanged:: 1.2.0
|
|
215 | 215 | + """'.
|
216 | 216 | keep_default_na : bool, default True
|
217 | 217 | Whether or not to include the default NaN values when parsing the data.
|
218 |
| - Depending on whether `na_values` is passed in, the behavior is as follows: |
| 218 | + Depending on whether ``na_values`` is passed in, the behavior is as follows: |
219 | 219 |
|
220 |
| - * If `keep_default_na` is True, and `na_values` are specified, `na_values` |
221 |
| - is appended to the default NaN values used for parsing. |
222 |
| - * If `keep_default_na` is True, and `na_values` are not specified, only |
| 220 | + * If ``keep_default_na`` is True, and ``na_values`` are specified, |
| 221 | + ``na_values`` is appended to the default NaN values used for parsing. |
| 222 | + * If ``keep_default_na`` is True, and ``na_values`` are not specified, only |
223 | 223 | the default NaN values are used for parsing.
|
224 |
| - * If `keep_default_na` is False, and `na_values` are specified, only |
225 |
| - the NaN values specified `na_values` are used for parsing. |
226 |
| - * If `keep_default_na` is False, and `na_values` are not specified, no |
| 224 | + * If ``keep_default_na`` is False, and ``na_values`` are specified, only |
| 225 | + the NaN values specified ``na_values`` are used for parsing. |
| 226 | + * If ``keep_default_na`` is False, and ``na_values`` are not specified, no |
227 | 227 | strings will be parsed as NaN.
|
228 | 228 |
|
229 |
| - Note that if `na_filter` is passed in as False, the `keep_default_na` and |
230 |
| - `na_values` parameters will be ignored. |
| 229 | + Note that if `na_filter` is passed in as False, the ``keep_default_na`` and |
| 230 | + ``na_values`` parameters will be ignored. |
231 | 231 | na_filter : bool, default True
|
232 | 232 | Detect missing value markers (empty strings and the value of na_values). In
|
233 |
| - data without any NAs, passing na_filter=False can improve the performance |
234 |
| - of reading a large file. |
| 233 | + data without any NAs, passing ``na_filter=False`` can improve the |
| 234 | + performance of reading a large file. |
235 | 235 | verbose : bool, default False
|
236 | 236 | Indicate number of NA values placed in non-numeric columns.
|
237 | 237 | parse_dates : bool, list-like, or dict, default False
|
238 | 238 | The behavior is as follows:
|
239 | 239 |
|
240 |
| - * bool. If True -> try parsing the index. |
241 |
| - * list of int or names. e.g. If [1, 2, 3] -> try parsing columns 1, 2, 3 |
| 240 | + * ``bool``. If True -> try parsing the index. |
| 241 | + * ``list`` of int or names. e.g. If [1, 2, 3] -> try parsing columns 1, 2, 3 |
242 | 242 | each as a separate date column.
|
243 |
| - * list of lists. e.g. If [[1, 3]] -> combine columns 1 and 3 and parse as |
| 243 | + * ``list`` of lists. e.g. If [[1, 3]] -> combine columns 1 and 3 and parse as |
244 | 244 | a single date column.
|
245 |
| - * dict, e.g. {{'foo' : [1, 3]}} -> parse columns 1, 3 as date and call |
| 245 | + * ``dict``, e.g. {{'foo' : [1, 3]}} -> parse columns 1, 3 as date and call |
246 | 246 | result 'foo'
|
247 | 247 |
|
248 | 248 | If a column or index contains an unparsable date, the entire column or
|
|
372 | 372 | 1 NaN 2
|
373 | 373 | 2 #Comment 3
|
374 | 374 |
|
375 |
| -Comment lines in the excel input file can be skipped using the `comment` kwarg |
| 375 | +Comment lines in the excel input file can be skipped using the |
| 376 | +``comment`` kwarg. |
376 | 377 |
|
377 | 378 | >>> pd.read_excel('tmp.xlsx', index_col=0, comment='#') # doctest: +SKIP
|
378 | 379 | Name Value
|
|
0 commit comments