Skip to content

Parser: Type inference is locale-dependent and mishandles edge cases (inf, nan, leading spaces) #45

Description

@im-anishraj

Description

The infer_type function uses std::strtoll and std::strtod which are locale-dependent on some platforms. In European locales where , is the decimal separator, "3.14" may be inferred as STRING instead of FLOAT64.

Additionally, the inference has edge cases:

  • "inf" and "nan" are parsed as valid floats by strtod but should arguably be STRING
  • " 123" (leading space) is treated as STRING because the space isn't trimmed before inference
  • "1e10" is correctly inferred as FLOAT64 but "1E10" behavior may vary by platform

Acceptance Criteria

  • Use std::strtod with "C" locale explicitly, or use a locale-independent parser
  • Trim whitespace from values before type inference
  • "inf", "-inf", "nan" are treated as FLOAT64 (matching pandas)
  • Add tests for locale-edge-case values
  • Add tests for scientific notation variants

Difficulty: Intermediate
Files: cpp/src/csv_reader.cpp, tests/test_csv.py

Metadata

Metadata

Labels

area:cpp-coreC++ Frame, Column, pybind11, memory, and core engine internalsarea:csv-parserCSV reading, scanning, parsing, delimiters, encodings, row handlingarea:pandas-interopto_pandas, from_pandas, dtype compatibility, pandas workflowsbackendBackend, Python API, C++ core, parser, data engine, or library runtime workbugSomething isn't workingdifficulty:intermediateRequires understanding one or two modules and testsgssocPart of the GSSoC 2026 contributor programgssoc:level-2GSSoC intermediate-level tasklevel:intermediateGSSoC-compatible intermediate-level contribution labelpandas-compatPandas compatibility and interopparserCSV parser correctness and edge casespriority:highImportant and should be handled soonsize:sSmall focused changetype:bugGSSoC-compatible bug label for confirmed defects

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions