Skip to content

Conversation

sah0725
Copy link
Contributor

@sah0725 sah0725 commented Oct 7, 2025

Closes #13159

Summary

This PR adds comprehensive documentation for floating point precision issues in CSV operations, addressing the documentation gap identified in issue #13159.

Changes

  • Added new section "Floating Point Precision in CSV" to doc/source/user_guide/io.rst
  • Includes explanation of why precision loss occurs during CSV roundtrips
  • Documents proper usage of float_format parameter with practical examples
  • Provides format specifier reference (%.6f, %.10g, %.6e, etc.)
  • Includes best practices for different data types (scientific, financial, high-precision)
  • Adds testing function for users to validate their precision needs
  • Covers dtype preservation behavior after CSV roundtrips

Examples Added

  • 6 working code examples with proper cleanup
  • Interactive ipython blocks for documentation building
  • Real-world scenarios demonstrating precision issues and solutions

Validation

  • All code examples tested and verified to work correctly
  • Proper reStructuredText formatting confirmed
  • Addresses all requirements mentioned in the original issue

sah0725 and others added 4 commits October 7, 2025 23:37
… operations

Addresses issue pandas-dev#13159 by adding detailed documentation about:
- Why floating point precision loss occurs in CSV roundtrips
- How to use float_format parameter to control precision
- Format specifier reference (%.6f, %.10g, %.6e, etc.)
- Best practices for different data types (scientific, financial)
- Testing function to validate roundtrip precision
- dtype preservation behavior

Includes 6 working code examples with proper cleanup and
comprehensive guidance for users experiencing CSV precision issues.
Removes trailing spaces that were causing pre-commit checks to fail.
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

Successfully merging this pull request may close these issues.

DOC: floating point precision on writing/reading to csv
1 participant