143
143
Append ``.squeeze("columns")`` to the call to ``read_excel`` to squeeze
144
144
the data.
145
145
dtype : Type name or dict of column -> type, default None
146
- Data type for data or columns. E.g. {'a': np.float64, 'b': np.int32}
146
+ Data type for data or columns. E.g. {{ 'a': np.float64, 'b': np.int32} }
147
147
Use `object` to preserve data as stored in Excel and not interpret dtype.
148
148
If converters are specified, they will be applied INSTEAD
149
149
of dtype conversion.
227
227
each as a separate date column.
228
228
* list of lists. e.g. If [[1, 3]] -> combine columns 1 and 3 and parse as
229
229
a single date column.
230
- * dict, e.g. {'foo' : [1, 3]} -> parse columns 1, 3 as date and call
230
+ * dict, e.g. {{ 'foo' : [1, 3]} } -> parse columns 1, 3 as date and call
231
231
result 'foo'
232
232
233
233
If a column or index contains an unparsable date, the entire column or
277
277
Duplicate columns will be specified as 'X', 'X.1', ...'X.N', rather than
278
278
'X'...'X'. Passing in False will cause data to be overwritten if there
279
279
are duplicate names in the columns.
280
- storage_options : dict, optional
281
- Extra options that make sense for a particular storage connection, e.g.
282
- host, port, username, password, etc., if using a URL that will
283
- be parsed by ``fsspec``, e.g., starting "s3://", "gcs://". An error
284
- will be raised if providing this argument with a local path or
285
- a file-like buffer. See the fsspec and backend storage implementation
286
- docs for the set of allowed keys and values.
280
+ {storage_options}
287
281
288
282
.. versionadded:: 1.2.0
289
283
329
323
Column types are inferred but can be explicitly specified
330
324
331
325
>>> pd.read_excel('tmp.xlsx', index_col=0,
332
- ... dtype={'Name': str, 'Value': float}) # doctest: +SKIP
326
+ ... dtype={{ 'Name': str, 'Value': float} }) # doctest: +SKIP
333
327
Name Value
334
328
0 string1 1.0
335
329
1 string2 2.0
@@ -425,6 +419,7 @@ def read_excel(
425
419
...
426
420
427
421
422
+ @doc (storage_options = _shared_docs ["storage_options" ])
428
423
@deprecate_nonkeyword_arguments (allowed_args = ["io" , "sheet_name" ], version = "2.0" )
429
424
@Appender (_read_excel_doc )
430
425
def read_excel (
@@ -766,6 +761,7 @@ def parse(
766
761
return output [asheetname ]
767
762
768
763
764
+ @doc (storage_options = _shared_docs ["storage_options" ])
769
765
class ExcelWriter (metaclass = abc .ABCMeta ):
770
766
"""
771
767
Class for writing DataFrame objects into excel sheets.
@@ -799,16 +795,13 @@ class ExcelWriter(metaclass=abc.ABCMeta):
799
795
datetime_format : str, default None
800
796
Format string for datetime objects written into Excel files.
801
797
(e.g. 'YYYY-MM-DD HH:MM:SS').
802
- mode : {'w', 'a'}, default 'w'
798
+ mode : {{ 'w', 'a'} }, default 'w'
803
799
File mode to use (write or append). Append does not work with fsspec URLs.
804
- storage_options : dict, optional
805
- Extra options that make sense for a particular storage connection, e.g.
806
- host, port, username, password, etc., if using a URL that will
807
- be parsed by ``fsspec``, e.g., starting "s3://", "gcs://".
800
+ {storage_options}
808
801
809
802
.. versionadded:: 1.2.0
810
803
811
- if_sheet_exists : {'error', 'new', 'replace', 'overlay'}, default 'error'
804
+ if_sheet_exists : {{ 'error', 'new', 'replace', 'overlay'} }, default 'error'
812
805
How to behave when trying to write to a sheet that already
813
806
exists (append mode only).
814
807
@@ -929,7 +922,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):
929
922
>>> with pd.ExcelWriter(
930
923
... "path_to_file.xlsx",
931
924
... engine="xlsxwriter",
932
- ... engine_kwargs={"options": {"nan_inf_to_errors": True}}
925
+ ... engine_kwargs={{ "options": {{ "nan_inf_to_errors": True}} }}
933
926
... ) as writer:
934
927
... df.to_excel(writer) # doctest: +SKIP
935
928
@@ -940,7 +933,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):
940
933
... "path_to_file.xlsx",
941
934
... engine="openpyxl",
942
935
... mode="a",
943
- ... engine_kwargs={"keep_vba": True}
936
+ ... engine_kwargs={{ "keep_vba": True} }
944
937
... ) as writer:
945
938
... df.to_excel(writer, sheet_name="Sheet2") # doctest: +SKIP
946
939
"""
0 commit comments