@@ -1623,7 +1623,7 @@ def _normalize_tabular_data(tabular_data, headers, showindex="default"):
1623
1623
return rows , headers , headers_pad
1624
1624
1625
1625
1626
- def _wrap_text_to_colwidths (list_of_lists , colwidths , numparses = True ):
1626
+ def _wrap_text_to_colwidths (list_of_lists , colwidths , numparses = True , missingval = _DEFAULT_MISSINGVAL ):
1627
1627
if len (list_of_lists ):
1628
1628
num_cols = len (list_of_lists [0 ])
1629
1629
else :
@@ -1646,7 +1646,7 @@ def _wrap_text_to_colwidths(list_of_lists, colwidths, numparses=True):
1646
1646
# explicit than just `str` of the object. Also doesn't work for
1647
1647
# custom floatfmt/intfmt, nor with any missing/blank cells.
1648
1648
casted_cell = (
1649
- str (cell ) if _isnumber (cell ) else _type (cell , numparse )(cell )
1649
+ missingval if cell is None else str (cell ) if _isnumber (cell ) else _type (cell , numparse )(cell )
1650
1650
)
1651
1651
wrapped = [
1652
1652
"\n " .join (wrapper .wrap (line ))
@@ -2247,7 +2247,7 @@ def tabulate(
2247
2247
2248
2248
numparses = _expand_numparse (disable_numparse , num_cols )
2249
2249
list_of_lists = _wrap_text_to_colwidths (
2250
- list_of_lists , maxcolwidths , numparses = numparses
2250
+ list_of_lists , maxcolwidths , numparses = numparses , missingval = missingval
2251
2251
)
2252
2252
2253
2253
if maxheadercolwidths is not None :
@@ -2261,7 +2261,7 @@ def tabulate(
2261
2261
2262
2262
numparses = _expand_numparse (disable_numparse , num_cols )
2263
2263
headers = _wrap_text_to_colwidths (
2264
- [headers ], maxheadercolwidths , numparses = numparses
2264
+ [headers ], maxheadercolwidths , numparses = numparses , missingval = missingval
2265
2265
)[0 ]
2266
2266
2267
2267
# empty values in the first column of RST tables should be escaped (issue #82)
0 commit comments