|
29 | 29 | from warnings import warn
|
30 | 30 | from distutils.version import LooseVersion
|
31 | 31 | from pandas.util.decorators import Appender
|
| 32 | +from textwrap import fill |
32 | 33 |
|
33 | 34 | __all__ = ["read_excel", "ExcelWriter", "ExcelFile"]
|
34 | 35 |
|
|
97 | 98 | na_values : scalar, str, list-like, or dict, default None
|
98 | 99 | Additional strings to recognize as NA/NaN. If dict passed, specific
|
99 | 100 | per-column NA values. By default the following values are interpreted
|
100 |
| - as NaN: '""" + "', '".join(sorted(_NA_VALUES)) + """'. |
| 101 | + as NaN: '""" + fill("', '".join(sorted(_NA_VALUES)), 80) + """'. |
101 | 102 | thousands : str, default None
|
102 | 103 | Thousands separator for parsing string columns to numeric. Note that
|
103 | 104 | this parameter is only necessary for columns stored as TEXT in Excel,
|
@@ -168,7 +169,20 @@ def get_writer(engine_name):
|
168 | 169 | raise ValueError("No Excel writer '%s'" % engine_name)
|
169 | 170 |
|
170 | 171 |
|
171 |
| -@Appender(_read_excel_doc) |
| 172 | +def split_doc(doc_string, word_wrap=80): |
| 173 | + doc_lines = doc_string.split('\n') |
| 174 | + doc_string = '' |
| 175 | + for line in doc_lines: |
| 176 | + if len(line) > word_wrap: |
| 177 | + break_pos = line[:word_wrap].rfind(' ') |
| 178 | + indent_width = len(line) - len(line.lstrip()) |
| 179 | + line = line[:break_pos] + '\n' + \ |
| 180 | + ' ' * indent_width + line[break_pos + 1:] |
| 181 | + doc_string += (line + '\n') |
| 182 | + return doc_string |
| 183 | + |
| 184 | + |
| 185 | +@Appender(split_doc(_read_excel_doc)) |
172 | 186 | def read_excel(io, sheetname=0, header=0, skiprows=None, skip_footer=0,
|
173 | 187 | index_col=None, names=None, parse_cols=None, parse_dates=False,
|
174 | 188 | date_parser=None, na_values=None, thousands=None,
|
|
0 commit comments