Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Detection Error #44

Open
ben-bitdotio opened this issue Aug 17, 2021 · 1 comment
Open

Header Detection Error #44

ben-bitdotio opened this issue Aug 17, 2021 · 1 comment

Comments

@ben-bitdotio
Copy link

ben-bitdotio commented Aug 17, 2021

CleverCSV's Sniffer assumes the following .csv file does not have a header. More specifically, it recognizes "1" (an inferred int) and "1.2" (an inferred float) as incompatible types. As the third column has "incompatible" types, Detector.has_header() will return False.

col1,col2,col3
hello,"hello world", 1.2
world,"hello world", 1.2
test,"hello world 您", 1

Relevant code:

def clevercsv_guess_if_headers_exist(input: IO) -> bool:
    input_data = input
    if not isinstance(input, io.TextIOBase):
        input_data = io.StringIO(input.read(SAMPLE_LENGTH).decode())
    stream_pos = input_data.tell()
    sniffer = clevercsv.Sniffer()
    input_data.seek(0)
    has_header = sniffer.has_header(input_data.read(SAMPLE_LENGTH))
    input_data.seek(stream_pos)
    return has_header
@hugepanda
Copy link

hugepanda commented Feb 24, 2023

Is there any update for this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants