Issue #29405: Make total calculation in _guess_delimiter more accurate.
This commit is contained in:
parent
97353845f8
commit
6aee6fbce8
|
@ -307,7 +307,7 @@ class Sniffer:
|
||||||
charFrequency = {}
|
charFrequency = {}
|
||||||
modes = {}
|
modes = {}
|
||||||
delims = {}
|
delims = {}
|
||||||
start, end = 0, min(chunkLength, len(data))
|
start, end = 0, chunkLength
|
||||||
while start < len(data):
|
while start < len(data):
|
||||||
iteration += 1
|
iteration += 1
|
||||||
for line in data[start:end]:
|
for line in data[start:end]:
|
||||||
|
@ -336,7 +336,7 @@ class Sniffer:
|
||||||
|
|
||||||
# build a list of possible delimiters
|
# build a list of possible delimiters
|
||||||
modeList = modes.items()
|
modeList = modes.items()
|
||||||
total = float(chunkLength * iteration)
|
total = float(min(chunkLength * iteration, len(data)))
|
||||||
# (rows of consistent data) / (number of rows) = 100%
|
# (rows of consistent data) / (number of rows) = 100%
|
||||||
consistency = 1.0
|
consistency = 1.0
|
||||||
# minimum consistency threshold
|
# minimum consistency threshold
|
||||||
|
|
Loading…
Reference in New Issue