diff options
author | Xiang Zhang <angwerzx@126.com> | 2017-02-06 02:50:09 (GMT) |
---|---|---|
committer | Xiang Zhang <angwerzx@126.com> | 2017-02-06 02:50:09 (GMT) |
commit | 6aee6fbce8f3d7b8c8eae5d8f88fc2282698a6dc (patch) | |
tree | c182428131363312d21a6d9aa07c873048c79439 /Lib/csv.py | |
parent | 97353845f87e0a260a119240f27f2ab22fcaebd1 (diff) | |
download | cpython-6aee6fbce8f3d7b8c8eae5d8f88fc2282698a6dc.zip cpython-6aee6fbce8f3d7b8c8eae5d8f88fc2282698a6dc.tar.gz cpython-6aee6fbce8f3d7b8c8eae5d8f88fc2282698a6dc.tar.bz2 |
Issue #29405: Make total calculation in _guess_delimiter more accurate.
Diffstat (limited to 'Lib/csv.py')
-rw-r--r-- | Lib/csv.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -307,7 +307,7 @@ class Sniffer: charFrequency = {} modes = {} delims = {} - start, end = 0, min(chunkLength, len(data)) + start, end = 0, chunkLength while start < len(data): iteration += 1 for line in data[start:end]: @@ -336,7 +336,7 @@ class Sniffer: # build a list of possible delimiters modeList = modes.items() - total = float(chunkLength * iteration) + total = float(min(chunkLength * iteration, len(data))) # (rows of consistent data) / (number of rows) = 100% consistency = 1.0 # minimum consistency threshold |