Skip to content

fix dtypes not used on csv parse #657

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

Merged

Conversation

risenW
Copy link
Member

@risenW risenW commented Apr 2, 2025

No description provided.

@risenW risenW linked an issue Apr 2, 2025 that may be closed by this pull request
@risenW risenW requested a review from Copilot April 2, 2025 15:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the issue where the configured dtypes were not being applied during CSV parsing, resulting in unwanted conversion of certain values such as leading zeros.

  • Updated tests in both Node and browser environments to validate the preservation of leading zeros when dtype is set to "string".
  • Modified the CSV parsing logic in both Node and browser implementations to conditionally disable dynamic typing when dtypes include "string", and explicitly set the delimiter.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
src/danfojs-node/test/io/csv.reader.test.ts Added tests to ensure correct behavior when using the "string" dtype.
src/danfojs-browser/tests/io/csv.reader.test.js Added corresponding tests for browser CSV parsing.
src/danfojs-base/io/node/io.csv.ts Updated CSV parsing logic to conditionally disable dynamic typing and set delimiter.
src/danfojs-base/io/browser/io.csv.ts Updated CSV parsing logic for browser to conditionally disable dynamic typing and set delimiter.
Comments suppressed due to low confidence (1)

src/danfojs-node/test/io/csv.reader.test.ts:136

  • [nitpick] Consider refactoring the file cleanup logic by using a finally block instead of duplicating fs.unlinkSync in both the try and catch blocks to ensure consistent cleanup.
fs.unlinkSync(filePath);

@risenW risenW merged commit 90aa135 into dev Apr 2, 2025
2 checks passed
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.

Leading Zeros Are Removed After dtypes Set to "string"
1 participant