Skip to content

Commit 7dd824c

Browse files
committed
add text wrap.fill
1 parent 6645b2b commit 7dd824c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pandas/io/excel.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from warnings import warn
3030
from distutils.version import LooseVersion
3131
from pandas.util.decorators import Appender
32+
from textwrap import fill
3233

3334
__all__ = ["read_excel", "ExcelWriter", "ExcelFile"]
3435

@@ -97,7 +98,7 @@
9798
na_values : scalar, str, list-like, or dict, default None
9899
Additional strings to recognize as NA/NaN. If dict passed, specific
99100
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) + """'.
101102
thousands : str, default None
102103
Thousands separator for parsing string columns to numeric. Note that
103104
this parameter is only necessary for columns stored as TEXT in Excel,
@@ -168,7 +169,20 @@ def get_writer(engine_name):
168169
raise ValueError("No Excel writer '%s'" % engine_name)
169170

170171

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))
172186
def read_excel(io, sheetname=0, header=0, skiprows=None, skip_footer=0,
173187
index_col=None, names=None, parse_cols=None, parse_dates=False,
174188
date_parser=None, na_values=None, thousands=None,

0 commit comments

Comments
 (0)