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

Leading Zeros Are Removed After dtypes Set to "string" #642

Open
chunkangwong opened this issue Jun 18, 2024 · 0 comments
Open

Leading Zeros Are Removed After dtypes Set to "string" #642

chunkangwong opened this issue Jun 18, 2024 · 0 comments

Comments

@chunkangwong
Copy link

Describe the bug
When using readCSV and readExcel, with a CSV file that contains zero-leading numbers, the leading zeros are not preserved even after setting dtypes to string

To Reproduce
Steps to reproduce the behavior:

  1. Prepare the following .csv file:

./sample.csv

codes
012345
067890
import { readCSV, toJSON } from "danfojs";

const df = await readCSV("./sample.csv", { 
    frameConfig: {
        dtypes: ["string"],
    },
});
const data = toJSON(df);
console.log(data) // [{ codes: 12345 }, { codes: 67890 }]

Expected behavior
Leading-zeros should be retained if dtypes is string

Desktop (please complete the following information):

  • OS: Windos 10
  • Browser Chrome
  • Version 1.1.1
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

1 participant